Compare commits

...

1001 Commits
v1.10 ... main

Author SHA1 Message Date
Starbeamrainbowlabs e89d61034f
Add GitHub issue templates 2023-12-05 22:54:06 +00:00
Starbeamrainbowlabs 8efceeaa4c
build: switch to deploying the website from dev rather than main 2023-08-02 23:59:52 +01:00
Starbeamrainbowlabs 5ca5d1f1de
add more namespace comments 2023-08-02 00:14:48 +01:00
Starbeamrainbowlabs 2a9dca6926
update changelog 2023-08-01 00:43:04 +01:00
Starbeamrainbowlabs dd6e34bde1
Update changelog, prepare for (another) release 2023-08-01 00:34:35 +01:00
Starbeamrainbowlabs 125638a079
pos_marker, pos_marker_wall: default to 1 hp 2023-08-01 00:27:07 +01:00
Starbeamrainbowlabs 7be2fb125e
add more debug logging 2023-08-01 00:16:36 +01:00
Starbeamrainbowlabs 6231132055
pos_marker: debug logging; set health = 0 2023-08-01 00:14:43 +01:00
Starbeamrainbowlabs abfd76930a
reference: add //listentities 2023-08-01 00:11:49 +01:00
Starbeamrainbowlabs aec204de8e
add //listentities 2023-08-01 00:07:10 +01:00
Starbeamrainbowlabs daae15eb57
EventEmitter: improve debug logging 2023-07-31 22:06:44 +01:00
Starbeamrainbowlabs 200e588c59
README: update title; add discord link 2023-07-31 20:51:09 +01:00
Starbeamrainbowlabs 2840ba4dea
bump version, prepare for release 2023-07-31 18:24:32 +01:00
Starbeamrainbowlabs 564785ddf6
When any segment of the marker wall is punched, unmark the entire wall
Fixes #102
2023-07-31 18:22:00 +01:00
Starbeamrainbowlabs a465a50244
Bump version to 1.14.3 2023-07-18 00:35:19 +01:00
Starbeamrainbowlabs 5505575cf9
Fix regions not remembering their state and being unresettable
This fix means that wwe require minetest 5.2 as a minimum rather than 5.1
ref https://rubenwardy.com/minetest_modding_book/en/quality/common_mistakes.html#be-careful-when-storing-objectrefs-ie-players-or-entities
2023-07-18 00:35:07 +01:00
Starbeamrainbowlabs fd3ee43728
//subdivide: fix crash 2023-07-15 21:59:24 +01:00
Starbeamrainbowlabs ee4b3e09bb
Bump version 2023-07-12 20:30:13 +01:00
Starbeamrainbowlabs 0645bc7b8e
Update changelog 2023-07-12 20:25:38 +01:00
VorTechnix 7766af8a8a pos1-2 better implementation (used round) 2023-07-12 09:18:15 -07:00
VorTechnix d2fb6db3d0 emergency patch for pos1-2 not aligned to node 2023-07-12 08:43:15 -07:00
Starbeamrainbowlabs a6e8753e64
README: Update FAQ 2023-07-11 21:11:12 +01:00
Starbeamrainbowlabs 1a227e3bd8
docs: h5→h4, h4→h3; style subheadings 2023-07-11 20:31:43 +01:00
Starbeamrainbowlabs ffc90ed179
typo 2023-07-11 19:30:43 +01:00
Starbeamrainbowlabs ab3120fe79
Update changelog, README command list 2023-07-11 19:29:50 +01:00
Starbeamrainbowlabs 87a80d2faf
reference: add //metaball
....oops
2023-07-11 19:23:39 +01:00
Starbeamrainbowlabs 83b4b02b40
codium settings: add spelling words 2023-07-11 19:15:14 +01:00
Starbeamrainbowlabs 95a82add86
//metaball: address a number of stability issues 2023-07-11 19:14:59 +01:00
Starbeamrainbowlabs 5baa72cf6f
core/run_command: guard against invalid potential_changes 2023-07-11 19:12:04 +01:00
Starbeamrainbowlabs 177aea02a8
//metaball: fix crash 2023-07-11 18:55:34 +01:00
Starbeamrainbowlabs 7f4798432e
Bump version! 2023-07-11 18:16:02 +01:00
Starbeamrainbowlabs 7236232dc0
docs: fix the 1st command documented not showing up in the site
Rogue .slice(1)
2023-07-11 00:52:04 +01:00
Starbeamrainbowlabs c8e717a6d6
typo 2023-07-11 00:39:48 +01:00
Starbeamrainbowlabs 4745009632
//saplingaliases: update moretrees aliases
Alias to normal rather than *_ongen
2023-07-10 21:33:37 +01:00
Starbeamrainbowlabs f7429fa40e
//move+, //copy+ override //move, //copy by default 2023-07-10 21:12:54 +01:00
Starbeamrainbowlabs 277f3a8155
//move+: respect param2
Also update changelog
2023-07-10 21:08:17 +01:00
Starbeamrainbowlabs d63400e697
//copy+: respect param2 2023-07-10 21:02:03 +01:00
Starbeamrainbowlabs 5c632df658
Override basic selection commands
//mark
//unmark
//pos1 //1
//pos2 //2
//reset
Also add //pos <index>
2023-07-10 20:17:28 +01:00
Starbeamrainbowlabs 693fc145d5
pos: avoid calling worldedit.marker_update unless necessary 2023-07-10 19:25:48 +01:00
Starbeamrainbowlabs 2c30ed8634
Tweak changelog 2023-07-09 23:39:52 +01:00
Starbeamrainbowlabs bf365d2d11
reference: update //maze and //maze3d
Ref https://forum.minetest.net/viewtopic.php?p=414718#p414718
2023-07-09 19:57:02 +01:00
Starbeamrainbowlabs f2214150f2
Update minetest.chatcommands → minetest.registered_chatcommands 2023-07-09 19:49:38 +01:00
Starbeamrainbowlabs 3bfc62be24
Make //unmark WEA-aware
Backwards compatibility with WE is maintained.
2023-07-09 19:44:31 +01:00
Starbeamrainbowlabs e916057133
safe_region: update comment
We need @value
2023-07-07 01:31:06 +01:00
Starbeamrainbowlabs 3194a2c53e
finish updating comments
@module is now banished to the history booked!

Phew, I'm pooped.
2023-07-07 01:25:42 +01:00
Starbeamrainbowlabs 20935d8379
maze2d: add comment 2023-07-07 00:53:02 +01:00
Starbeamrainbowlabs 74cc6669c0
floodfill,line: add proper comments
All @module declarations must go!
2023-07-07 00:42:57 +01:00
Starbeamrainbowlabs 2edc9f6f6c
forest: update comment 2023-07-04 23:14:18 +01:00
Starbeamrainbowlabs a78d385666
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions 2023-07-04 22:55:15 +01:00
Starbeamrainbowlabs fd9d76353d
fillcaves: update comment 2023-07-04 22:55:12 +01:00
VorTechnix 5cf155772d Merge branch 'main' of https://github.com/sbrl/Minetest-WorldEditAdditions 2023-07-04 14:50:17 -07:00
VorTechnix 55ddc16b2e small fix to file:read error 2023-07-04 14:50:14 -07:00
Starbeamrainbowlabs 6bc1987916
Update and correct a bunch of comments
note that @module is outdated and should not be used
2023-07-04 22:45:02 +01:00
Starbeamrainbowlabs 365b491aa1
contributing guide: update example command 2023-07-04 22:44:28 +01:00
Starbeamrainbowlabs 5d18f6d0db
comment debug 2023-07-04 22:00:28 +01:00
Starbeamrainbowlabs 66c257c146
split_shell: added some more test cases for unclosed quotes 2023-07-04 20:35:01 +01:00
Starbeamrainbowlabs 7bdefc8d42
split_shell: comment out debug 2023-07-04 19:10:05 +01:00
Starbeamrainbowlabs 78c4a67c7b
split_test: even more tests 2023-07-04 19:09:42 +01:00
Starbeamrainbowlabs 02ad40eaae
split_shell: add automated tests, and fix an obscure bug 2023-07-04 19:04:11 +01:00
Starbeamrainbowlabs c988daeda6
update more comments 2023-07-02 20:05:46 +01:00
Starbeamrainbowlabs 047033a6ef
comments: update @class definitions 2023-07-02 19:03:46 +01:00
Starbeamrainbowlabs c6bc6e26e7
add chisel image 2023-07-02 18:22:03 +01:00
Starbeamrainbowlabs 8981bc4baa
weac.pos: update comments 2023-07-02 17:48:43 +01:00
Starbeamrainbowlabs 464ea53465
vector3: fix comments 2023-07-02 17:03:39 +01:00
Starbeamrainbowlabs e9c3d51863
Update changelog, name release 2023-07-02 15:12:25 +01:00
Starbeamrainbowlabs 5a76b3eaa9
art: attempt at a chisel
I'm not happy with it really.
2023-07-02 03:02:26 +01:00
Starbeamrainbowlabs 2e8642b4d7
rearrange and update changelog 2023-07-02 02:42:17 +01:00
Starbeamrainbowlabs 9b4a777a67
//scale, //subdivide, //spop: use new position api 2023-07-02 02:02:42 +01:00
Starbeamrainbowlabs 9be7854297
//move+, //copy+: add integrated airapply
fixes #97
2023-07-02 01:52:25 +01:00
Starbeamrainbowlabs 09ee1ae3fa
airapply: update docbloc comment 2023-07-02 01:38:27 +01:00
Starbeamrainbowlabs f970a8d6bb
reference: update docs for //sculpt 2023-07-02 01:37:48 +01:00
Starbeamrainbowlabs 61403108d6
disable a bunch of debug logging 2023-07-01 02:46:08 +01:00
Starbeamrainbowlabs f5e2ada5bd
//sculpt: put height at the end 2023-07-01 02:38:14 +01:00
Starbeamrainbowlabs 2756eb0eb5
docs: update npm dependencies 2023-07-01 01:15:13 +01:00
Starbeamrainbowlabs 92fd201b42
pos_marker_lua: add last_reset to properly clear huge regions 2023-07-01 01:11:56 +01:00
Starbeamrainbowlabs f800d7e3d7
A (bad) concept art for a //sculpt brush 2023-06-30 02:11:21 +01:00
Starbeamrainbowlabs b3f7ae9d7c
pos_marker_wall: add support for customising sides displayed
...it's not exposed in the UI yet tho.
2023-06-30 02:08:46 +01:00
Starbeamrainbowlabs 46587164bd
//sculpt: tweak the default settings
I got the idea from an MC video about voxelsniper. Surprisingly it works rather well :P
2023-06-29 03:19:30 +01:00
Starbeamrainbowlabs e3dac29a80
README: update inspiration section 2023-06-29 02:18:12 +01:00
Starbeamrainbowlabs 109c69502a
Changelog: add boxing ui WIP 2023-06-29 02:05:42 +01:00
Starbeamrainbowlabs 277da67dda
marker wall: got it! 2023-06-29 01:49:15 +01:00
Starbeamrainbowlabs a173edfbc4
wall markers: it shouldn't work, but it does
....I'll take it!
2023-06-29 01:22:50 +01:00
Starbeamrainbowlabs c622fb554f
Hook in the new marker wall system
it works!
now for the other walls.
2023-06-29 00:39:55 +01:00
Starbeamrainbowlabs 1b0001d88e
README: add an inspiration section
more for my own benefit, but perhaps it'll help people who swing by with energy they want to dedicate to the project.
2023-06-28 21:14:26 +01:00
Starbeamrainbowlabs 5fe84ada79
Update installation instructions for git
we should recommend that everyone checks out the latest release, even when installing via git.
2023-06-27 23:16:23 +01:00
Starbeamrainbowlabs f7530da608
initial pos marker wall for +x only
it's not hooked up yet.
2023-06-27 21:45:48 +01:00
Starbeamrainbowlabs 8cc2c735b1
Reference: I searched for wireframe, but didn't get the command I wanted 2023-06-27 20:57:04 +01:00
Starbeamrainbowlabs 61e04952e0
move pos marker textures. will this help #90? 2023-06-27 20:16:04 +01:00
Starbeamrainbowlabs 141ea2f0a7
For compatibility, ensure that we also clear the legacy worldedit region too 2023-06-27 20:00:07 +01:00
Starbeamrainbowlabs bfecc2da80
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions 2023-06-27 19:40:12 +01:00
Starbeamrainbowlabs 53bbe14c63
update cloud wand to use new wea_c.pos interface 2023-06-27 19:39:57 +01:00
VorTechnix 8d9f51de35 handler patch
I should have done this in a branch lol
2023-05-28 08:45:39 -07:00
VorTechnix 67baee7465 fixed missing underscore 2023-05-28 08:37:57 -07:00
VorTechnix 8de2892907 added setting_handler 2023-05-24 16:02:51 -07:00
VorTechnix 16afb9eddc Create setting_handler.lua 2023-05-24 14:44:38 -07:00
Starbeamrainbowlabs 1c163186b6
//count: improve formatting of output 2023-05-24 22:20:52 +01:00
Starbeamrainbowlabs daad494c7e
reference //for: add command example from @VorTechnix 2023-05-24 22:09:51 +01:00
Starbeamrainbowlabs b2556934b1
reference: fix incorrect example 2023-05-24 22:01:33 +01:00
Starbeamrainbowlabs 7cb1160e65
//multi: fix luacheck error 2023-05-24 22:00:16 +01:00
VorTechnix b88cec64d4 Fix bad logic in parts check 2023-05-24 13:03:41 -07:00
Starbeamrainbowlabs 8652ad6335
website: add midding mobile meta tag 2023-02-25 02:21:08 +00:00
Starbeamrainbowlabs ebbaed88d8
Update 11ty to 2.0 o/ 2023-02-22 00:46:55 +00:00
Starbeamrainbowlabs 558fc1c04b
//revolve: try :round() instead of :floor()
not sure if ti helps or not tho
2023-02-12 03:32:10 +00:00
Starbeamrainbowlabs 1d53233621
typo 2023-02-12 02:19:53 +00:00
Starbeamrainbowlabs 66aab7ba64
Changelog: add //revolve 2023-02-12 02:18:15 +00:00
Starbeamrainbowlabs fcde8e581c
cloud wand: right clicking now resets all WEA multipoints 2023-02-12 02:18:04 +00:00
Starbeamrainbowlabs cfef411bbd
//revolve: write initial docs 2023-02-12 02:08:57 +00:00
Starbeamrainbowlabs cf8406b80f
//revolve: don't rotate air nodes
this is important because when rotating multiple times it can easily overwrite parts of the structure with pointless air nodes where it shouldn't do
2023-02-12 02:08:44 +00:00
Starbeamrainbowlabs e942e4fb2f
Finish initial implementation of //revolve
it's not quite done yet - got docs to go
2023-02-12 01:40:29 +00:00
Starbeamrainbowlabs d1b9d1c1c1
vector3.round_dp(): todo 2023-01-21 03:27:02 +00:00
Starbeamrainbowlabs 392708b190
initial wea.revolve() implementation
....but it's not tested or hooked up yet.
Next up: a chat command definition so we can test it.
2023-01-21 03:24:44 +00:00
Starbeamrainbowlabs 87812679d9
table_reduce: typo 2023-01-21 02:34:47 +00:00
Starbeamrainbowlabs 2ecc8cb2d7
add implementation of array.reduce() from JS 2023-01-21 02:32:09 +00:00
Starbeamrainbowlabs 66227153d0
add wea_c.range(min, max, step) 2023-01-21 01:32:17 +00:00
Starbeamrainbowlabs 42fb6571da
Vector3.rotate_3d(): write tests 2023-01-20 23:43:20 +00:00
Starbeamrainbowlabs 9c66288827
Vector3: add rotate3d.
Thanks to GitHub Copilot for the implementation, it just needed
improving around the edges to make it work perfectly.
For the record, copilot generated it in JS, and then
I manually ported it to Lua.
If the Copilot code looks sufficiently similar to your own source,
get in touch and I will give you full credit.
2023-01-20 23:43:07 +00:00
Starbeamrainbowlabs cbd2ae7df8
copilot rotate: reapply origin offset 2023-01-20 23:41:31 +00:00
Starbeamrainbowlabs 3e123ddc56
comment 2023-01-19 23:30:43 +00:00
Starbeamrainbowlabs 8372a12f48
initial WIP 3d point rotation algorithm
Thanks to GitHub Copilot for the implementation!
Just need to fully check it actually works, and then we can port it to Lua and Vector3.
2023-01-17 02:13:15 +00:00
Starbeamrainbowlabs 53609ac83e
vector3: .volume() is already implemented
remove todo comment
2023-01-17 00:08:13 +00:00
Starbeamrainbowlabs 2e275e3993
docs: initial pass at a dark theme
some of the colours still suck though
2023-01-11 03:26:49 +00:00
Starbeamrainbowlabs cfc1fe3639
huh, weird. evidently we need all the checks ever
ref #88
2023-01-11 02:32:01 +00:00
Starbeamrainbowlabs 97bb896829
fixup, ref #88 2023-01-11 02:25:41 +00:00
Starbeamrainbowlabs 58dd3ea875
Bugfix new marker system: properly check that the lua entity is a thing
Missing ()
Might fix #88, but needs testing.
2023-01-11 02:18:06 +00:00
Starbeamrainbowlabs 554bc86b3d
reference: tweak //spline 2022-10-23 02:26:05 +01:00
Starbeamrainbowlabs 902d03ca0b
Update changelog 2022-10-23 00:54:29 +01:00
Starbeamrainbowlabs 410841562a
img2brush: allow customising the channel to pull from 2022-09-26 03:27:58 +01:00
Starbeamrainbowlabs dea51cb9a3
typos 2022-09-25 23:02:23 +01:00
Starbeamrainbowlabs 9f2bfb33c7
reference: add //spline 2022-09-25 23:02:18 +01:00
Starbeamrainbowlabs b493c0073a
//spline: add sample image 2022-09-25 22:57:49 +01:00
Starbeamrainbowlabs bc0276875d
//spline: update params description 2022-09-25 22:55:50 +01:00
Starbeamrainbowlabs c319be5840
fix //spline :D 2022-09-25 17:07:37 +01:00
Starbeamrainbowlabs fe30fd5c51
add comment 2022-09-25 16:16:03 +01:00
Starbeamrainbowlabs 2748f4cdfa
//spline: plot chaikin curve 2022-09-25 15:30:16 +01:00
Starbeamrainbowlabs 9a4b4beb76
EventEmitter: add debug printing (disabled by default) 2022-09-25 15:03:16 +01:00
Starbeamrainbowlabs 9806828760
core pos: fix worldedit compat 2022-09-25 15:02:48 +01:00
Starbeamrainbowlabs 888e4b0f78
saferegion: fix missing return 2022-09-25 14:39:57 +01:00
Starbeamrainbowlabs 5d9dee9523
pos: fix warning 2022-09-25 02:03:44 +01:00
Starbeamrainbowlabs 268e123221
run_command require_pos: also check WEA pos subsystem 2022-09-25 02:02:23 +01:00
Starbeamrainbowlabs 363acde496
core pos: make function names actually make sense 2022-09-25 01:59:59 +01:00
Starbeamrainbowlabs 7a14e8a590
comment all the debug prints 2022-09-25 01:57:41 +01:00
Starbeamrainbowlabs f998110303
core pos: Add (complicated) compat w/worldedit 2022-09-25 01:43:30 +01:00
Starbeamrainbowlabs 285572e16b
saferegion: allow nodes_needed to return string 2022-09-25 01:19:36 +01:00
Starbeamrainbowlabs 258a9c1cde
implement initial //spline, but it isn't finished yet 2022-09-25 01:18:40 +01:00
Starbeamrainbowlabs a768378dfd
core: add transparent WorldEdit compatibility to the position subsystem 2022-09-25 01:07:48 +01:00
Starbeamrainbowlabs c2d19105ed
get_pos_all → get_all 2022-09-24 23:50:45 +01:00
Starbeamrainbowlabs 3583de4731
wea_c.pos: add get_bounds
....though tbh, I think this should go elsewhere.
2022-09-24 23:48:36 +01:00
Starbeamrainbowlabs dfb24e679b
table_apply: write tests 2022-09-24 18:47:13 +01:00
Starbeamrainbowlabs da9f578e86
table_contains: write tests 2022-09-24 18:42:54 +01:00
Starbeamrainbowlabs 8f03c6473b
test makeset 2022-09-24 13:45:50 +01:00
Starbeamrainbowlabs bdaedf0e7a
fixup 2022-09-24 13:42:00 +01:00
Starbeamrainbowlabs 38a72468d9
utils: rename folder tables → table to match API 2022-09-24 13:41:44 +01:00
Starbeamrainbowlabs bc5dc6b2b4
write tests for parse.map 2022-09-24 03:15:44 +01:00
Starbeamrainbowlabs c9fd68fac3
fixup 2022-09-24 02:54:36 +01:00
Starbeamrainbowlabs 84226a9909
write tests for parse.chance+seed 2022-09-24 02:51:56 +01:00
Starbeamrainbowlabs 2473c1ce41
Implement Vector3.volume () 2022-09-24 02:33:10 +01:00
Starbeamrainbowlabs 6357d590d9
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions 2022-09-20 20:03:42 +01:00
Starbeamrainbowlabs 440cdcc504
Fix luacheck
The problem was that we moved bit.lua from worldeditadditions to worldeditadditions_core, but failed to update .luacheckrc
2022-09-20 20:03:36 +01:00
VorTechnix 98a74c63dc fixed colour offset bug and refactored hex values 2022-09-20 08:59:49 -07:00
Starbeamrainbowlabs 7f2be74580
position markers: colourise numbers 2022-09-20 03:21:55 +01:00
Starbeamrainbowlabs 3fa6dbefcf
Update background of positional marker entities 2022-09-20 02:31:04 +01:00
Starbeamrainbowlabs 1473074d4a
Reference: add multi-point selection wand 2022-09-20 02:17:28 +01:00
Starbeamrainbowlabs fd1e3fb20f
fix crash on punching new position marker 2022-09-20 02:17:11 +01:00
Starbeamrainbowlabs f7bd17131a
Update changelog 2022-09-20 01:20:40 +01:00
Starbeamrainbowlabs ea6a7ced2b
update README 2022-09-20 01:06:16 +01:00
Starbeamrainbowlabs 7423bee714
pos: add set_pos1 and set_pos2 convenience functions 2022-09-19 23:40:42 +01:00
Starbeamrainbowlabs e2e235ce6d
pos_marker_manage: listen on clear event 2022-09-19 23:35:49 +01:00
Starbeamrainbowlabs 9910bfad44
pos_marker_manage: listen on the set() event 2022-09-19 23:33:38 +01:00
Starbeamrainbowlabs 47b1c44b38
Upgrade position system, add initial position markers 2022-09-19 23:18:49 +01:00
Starbeamrainbowlabs d9877b8c6c
more crash fixes 2022-09-19 19:42:22 +01:00
Starbeamrainbowlabs 6c8ce90593
Fix crashes in wireframe commands 2022-09-19 18:59:45 +01:00
Starbeamrainbowlabs 44e6ba8e3c
Upgrade more old vector stuff in the corners 2022-09-19 18:54:53 +01:00
Starbeamrainbowlabs c3ae96548e
//floodfill: fix crash 2022-09-19 18:41:27 +01:00
Starbeamrainbowlabs d03e333e35
fixup 2022-09-19 18:33:19 +01:00
Starbeamrainbowlabs c82c83d008
spiral: comment debug 2022-09-19 18:33:10 +01:00
Starbeamrainbowlabs 073d621629
test geometry commands 2022-09-19 18:30:43 +01:00
Starbeamrainbowlabs 4be7bf33d0
//ellipsoid: fix crash 2022-09-19 18:10:06 +01:00
Starbeamrainbowlabs 9dc8165464
fixup 2022-09-19 17:34:53 +01:00
Starbeamrainbowlabs 5ec877f2b7
strip remaining worldeditadditions.vector.tostring calls 2022-09-19 17:33:02 +01:00
Starbeamrainbowlabs 8ec118eed7
remove debug logging 2022-09-19 17:29:12 +01:00
Starbeamrainbowlabs 1024b19629
fix startup crashes; crashes in cloudwand 2022-09-19 17:27:59 +01:00
Starbeamrainbowlabs 7a688969b2
fix tests 2022-09-19 01:31:47 +01:00
Starbeamrainbowlabs 1ae36d3898
Update tests to wea_c 2022-09-19 01:18:48 +01:00
Starbeamrainbowlabs 2af1226b49
port everything else
phew!
2022-09-19 01:16:22 +01:00
Starbeamrainbowlabs 41e3ebc7dd
Upgrade all main commands 2022-09-19 00:18:03 +01:00
Starbeamrainbowlabs a3acf3b16e
Update a bunch of APi methods 2022-09-18 22:58:33 +01:00
Starbeamrainbowlabs 21c5b9d483
Upgrade the last of the commands o/ 2022-09-18 22:46:20 +01:00
Starbeamrainbowlabs 6102a1adf5
Upgrade meta commands 2022-09-18 22:37:26 +01:00
Starbeamrainbowlabs 4a56d45c4b
Upgrade all selection commands 2022-09-18 22:20:04 +01:00
Starbeamrainbowlabs c3e8df3a9e
next batch of upgraded commands 2022-09-18 21:39:48 +01:00
Starbeamrainbowlabs 459e15b5c2
finish upgrading top-level commands 2022-09-18 21:30:28 +01:00
Starbeamrainbowlabs 128dc8f103
Update changelog 2022-09-18 21:05:43 +01:00
Starbeamrainbowlabs 0641a9f55c
Merge branch 'utils-move' of github.com:sbrl/Minetest-WorldEditAdditions into utils-move 2022-09-18 21:05:16 +01:00
Starbeamrainbowlabs 927f2f90f8
//hollow: upgrade; fix nodes_needed 2022-09-18 21:05:13 +01:00
Starbeamrainbowlabs 2f4c333ca0
//layers: upgrade 2022-09-18 21:05:03 +01:00
VorTechnix e2947c4ae2 Create settingtypes.txt 2022-09-18 13:00:36 -07:00
Starbeamrainbowlabs 8d6db6d3f5
upgrade 7 more commands 2022-09-18 20:58:28 +01:00
Starbeamrainbowlabs adfc6d6499
Merge branch 'main' into utils-move 2022-09-18 20:57:49 +01:00
Starbeamrainbowlabs e167fb1536
start working on converting everything to the new utils location
after we've done this, we'll rename utils → lib
2022-09-18 17:59:57 +01:00
Starbeamrainbowlabs 6f3118036d
Update utils 2022-09-18 17:32:13 +01:00
Starbeamrainbowlabs 2625ed1a53
Add positional textures 2022-09-18 16:54:33 +01:00
Starbeamrainbowlabs 58a7629ea1
Initial move of utils wea → wea_c
Here we go...!
2022-09-18 16:45:08 +01:00
Starbeamrainbowlabs 2b88fa867e
fix more warnings 2022-09-18 16:33:37 +01:00
Starbeamrainbowlabs 4a6cb2551c
math.pow → ^ 2022-09-18 16:30:27 +01:00
Starbeamrainbowlabs 52d24a63f3
Update changelog 2022-09-18 16:27:34 +01:00
Starbeamrainbowlabs 0983e09f50
multiwand: fix crash on left clicking background 2022-09-18 16:21:36 +01:00
Starbeamrainbowlabs cf0be6c1fb
EventEmitter: document 2022-09-18 16:19:52 +01:00
Starbeamrainbowlabs 17d92870b3
Add EventEmitter support to wea_c.pos 2022-09-18 16:06:23 +01:00
Starbeamrainbowlabs 817387d7f2
Port EventEmitter from Node.js 2022-09-18 15:57:23 +01:00
Starbeamrainbowlabs fa62864e16
implement multi-point wand 2022-09-18 15:30:53 +01:00
Starbeamrainbowlabs 9932852053
core: add position manager system
it doesn't save them to disk, but that would not be too difficult to add
2022-09-18 03:25:49 +01:00
Starbeamrainbowlabs fd42d96702
create initial texture for a multi-select wand 2022-09-18 02:25:18 +01:00
Starbeamrainbowlabs 08d40c8780
fix warnings 2022-09-17 23:42:46 +01:00
Starbeamrainbowlabs 763ae3db8d
Implement 2D bresenham line drawing for #35
We need it to be 3D though.
We essentially just ported f51f153459/src/index.js to Lua, as https://medium.com/geekculture/bresenhams-line-drawing-algorithm-2e0e953901b3 was WRONG as it didn't handle all edge cases and this one is much more optimised.
2022-09-17 23:27:57 +01:00
Starbeamrainbowlabs 382194321b
fixup 2022-08-06 15:17:16 +01:00
Starbeamrainbowlabs e6a48c8799
fix CI 2022-08-06 15:15:36 +01:00
Starbeamrainbowlabs d3900e2ad9
Update dependencies
also add missing debug dependency
Ref CI job output
2022-08-06 15:03:33 +01:00
Starbeamrainbowlabs 63abd1f539
build.sh: add export NODE_ENV=production 2022-07-06 02:33:37 +01:00
Starbeamrainbowlabs 0e7b292bb1
docs: serve GitHub avatars locally 2022-07-06 01:41:27 +01:00
Starbeamrainbowlabs 8eec6a32f7
Add CSS minification 2022-07-06 00:28:55 +01:00
Starbeamrainbowlabs bd88f93296
Update dependencies 2022-07-05 20:58:19 +01:00
Starbeamrainbowlabs c465d6efb0
Commands that modify the terrain now ignore liquids 2022-06-11 21:56:26 +01:00
Starbeamrainbowlabs 2d989acee5
reference: typo 2022-06-11 18:54:04 +01:00
Starbeamrainbowlabs 6e0779a4e5
//sculpt: Fix undefined `default` brush 2022-06-11 18:53:54 +01:00
Starbeamrainbowlabs 77c634dd7d
reference: fix subheadings disappearing 2022-06-11 16:58:25 +01:00
Starbeamrainbowlabs fc4f64d25a
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions into main 2022-06-05 17:13:49 +01:00
Starbeamrainbowlabs e294d96efe
//dome+: ensure domes include pos1 2022-06-05 17:10:41 +01:00
VorTechnix dc73e0e1e9 sum param clarification 2022-05-30 08:38:33 -07:00
Starbeamrainbowlabs be0612e6be
Merge pull request #80 from sbrl/VorTechnix
Implement new axis keyword parser system
2022-05-30 16:00:01 +01:00
VorTechnix 74ca84fcee Create axes_parser.test.lua 2022-05-29 17:49:01 -07:00
VorTechnix 53600789d8 added compass directions, fixed tmp.sign bug 2022-05-29 16:23:59 -07:00
VorTechnix 6e3252b471 Merge branch 'main' into VorTechnix 2022-05-24 18:47:41 -07:00
Starbeamrainbowlabs 5ac98cfa22
tests.sh: use $OSTYPE to decide how to call luarocks
this is ridiculous
2022-05-25 02:14:17 +01:00
Starbeamrainbowlabs b94c38bb99
tests.sh: add logging to test github actions 2022-05-25 02:07:16 +01:00
VorTechnix 98e9888897 Merge branch 'main' into VorTechnix 2022-05-24 17:35:33 -07:00
Starbeamrainbowlabs 50b1df57c4
tests.sh: more windows weirdness 2022-05-25 01:33:07 +01:00
VorTechnix d79c187a9d Merge branch 'main' into VorTechnix 2022-05-24 16:47:38 -07:00
Starbeamrainbowlabs cb75776164
tests.sh: fix eval luarocks path on Windows
Annoyingly luarocks generates batch commands on Windows, even when being 
called from Git Bash :-/
2022-05-25 00:45:37 +01:00
VorTechnix 021fdac284 variable refactor 2022-05-23 18:49:24 -07:00
Starbeamrainbowlabs 64ff61a4d2
Fix override aliases 2022-05-24 02:24:43 +01:00
VorTechnix 6ed65074b8 unexposed number parser 2022-05-23 18:04:34 -07:00
VorTechnix a8655373a2 fixed typo 2022-05-23 17:11:26 -07:00
VorTechnix 3196a590f5 changed: functions returned
(and unexposed key_instance class)
2022-05-23 17:08:42 -07:00
VorTechnix 1cef968731 Key Instance type checking 2022-05-23 17:06:23 -07:00
Starbeamrainbowlabs af7d39110b
//spiral2: fix params description 2022-05-24 01:05:09 +01:00
Starbeamrainbowlabs 9bfb428c3f
add override aliases behind a setting 2022-05-24 00:11:22 +01:00
VorTechnix e17b2cce4e small correction 2022-05-23 15:02:59 -07:00
VorTechnix 23140467d2 new parser connected 2022-05-23 14:58:45 -07:00
VorTechnix 2cddccdca4 working (tested) parser implementation 2022-05-23 14:58:27 -07:00
VorTechnix 8789b39d1d Merge branch 'main' into VorTechnix 2022-05-21 07:04:09 -07:00
VorTechnix a0982c70f0 check_dir update (unification) 2022-05-20 19:29:01 -07:00
VorTechnix a6b4d047b8 axes_parser implemented (not added to init) 2022-05-20 19:27:47 -07:00
Starbeamrainbowlabs 1750d62d3c
core: add register_alias command
it is backwards-compatible with worldedit.register_command
2022-05-19 22:50:53 +01:00
Starbeamrainbowlabs c2c0fa5d8d
core: if worldedit is installed also register commands there
This ensures that e.g. //cubeapply continues to work as expected
2022-05-19 22:13:09 +01:00
Starbeamrainbowlabs 8de49ac0af
register commands with worldeditadditions, not worldedit 2022-05-19 22:10:09 +01:00
Starbeamrainbowlabs 3bcca82b43
//maze, //maze3d: registere with our new WEA core rather than WorldEdit 2022-05-19 02:43:19 +01:00
Starbeamrainbowlabs c53fb32d2b
core: fix register_command and run_command 2022-05-19 02:40:05 +01:00
Starbeamrainbowlabs 95c0e96da9
core: fix luacheck errors 2022-05-19 02:32:17 +01:00
Starbeamrainbowlabs b816133716
core: implement fetch_command_def
This rovides an abstraction to fetch a worldedit command's definition, 
regardless of where it was registered.

We would normally expect all commands to be registered in 
wea_c.registered_commands, but before we only do a one-off pass to 
import commands from worldedit should a new mod we aren't aware of 
register a command with worldedit and get loaded after us, we won't 
detect it - hencee  the need for this function.
2022-05-19 02:31:01 +01:00
Starbeamrainbowlabs c60b5c5bad
core: fix bugs, enable! 2022-05-19 01:45:36 +01:00
Starbeamrainbowlabs 4306035ef2
core: implement safe_region 2022-05-18 02:31:08 +01:00
Starbeamrainbowlabs 8f6c3e020f
fixup 2022-05-17 01:04:51 +01:00
Starbeamrainbowlabs d21f7ca5fb
core: minor fixes 2022-05-17 01:04:38 +01:00
Starbeamrainbowlabs 1fda9725c7
Implement run_command, but it's not quite finished yet
We still have yet to implement safe_region. Doing so will be 
non-trivial, as we'll need to override //y and //n, but then  also keep 
track of commands defined in worldedit and call the right version of //y 
and //n.
2022-05-17 01:03:58 +01:00
Starbeamrainbowlabs 4ab386788d
fixup 2022-05-16 23:41:09 +01:00
Starbeamrainbowlabs 9bdd7d2a25
core: add run_command shim, but it's not finished yet 2022-05-16 23:40:17 +01:00
Starbeamrainbowlabs fa9b511e33
core: finish initial register_command 2022-05-16 23:40:03 +01:00
Starbeamrainbowlabs 19c8d0e7b9
core: make options.nodes_needed optional 2022-05-16 23:33:22 +01:00
Starbeamrainbowlabs f984f5d7b7
Begin rewriting worldeditadditions_core
We should be able to make things a lot cleaner and more robust.
2022-05-16 23:32:40 +01:00
Starbeamrainbowlabs d3119ee54a
Delete more copied code 2022-05-16 22:37:10 +01:00
Starbeamrainbowlabs 10f350c967
Delete copied code
Given licence incompatibilities, we can't really copy code from 
WorldEdit
2022-05-16 21:21:15 +01:00
Starbeamrainbowlabs 9d3a4ce263
refactor aliases into a separate file 2022-05-16 20:33:04 +01:00
Starbeamrainbowlabs 60c8f30109
Update changelog 2022-05-16 20:16:48 +01:00
Starbeamrainbowlabs 98909f0fae
//metaball: bugfix
It works!
2022-05-16 20:14:31 +01:00
Starbeamrainbowlabs 722e62bae0
Finish initial //metaballs command implementation, but it's untested 2022-05-16 01:21:09 +01:00
Starbeamrainbowlabs 3311d80a2a
Rework metaballs backend
We need a way of defining metaballs per-player. Our solution to this is 
a custom in-memory per-player storage system. The reason for this is 
because just a position (e.g. that provided by pos1/pos2) is not enough 
- we need a radius as well.
2022-05-16 01:01:01 +01:00
Starbeamrainbowlabs 0d7922d747
typo 2022-05-16 00:29:50 +01:00
VorTechnix bcfe39cd21 Merge branch 'main' into VorTechnix 2022-05-15 13:09:57 -07:00
Starbeamrainbowlabs f34617a3d3
Add backend functionality for metaballs
Implementing a frontend command sounds like a headache to me
2022-05-15 17:42:19 +01:00
Starbeamrainbowlabs 03fb033b70
//dome+: add option to make the resulting dome hollow inside 2022-05-15 15:38:50 +01:00
Starbeamrainbowlabs 04e971e12d
Add //dome+
Improvements oveer //dome:

 - Allow customising the direction it points in
 - Allow multiple pointing directions at once to give the effect of 
creating multiple domes on top of each other in a single command (it's 
actually implemented as an implicit union, and doesn't actually call 
wea.dome more than once).
2022-05-15 15:27:43 +01:00
Starbeamrainbowlabs a99cef7bf9
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions into main 2022-05-15 13:53:08 +01:00
Starbeamrainbowlabs 6d075be525
docs: fix warning 2022-05-15 13:52:59 +01:00
Starbeamrainbowlabs dbc056139a
Merge pull request #74 from sbrl/dependabot/npm_and_yarn/dot-docs/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6 in /.docs
2022-05-01 17:10:55 +01:00
Starbeamrainbowlabs 8eb1faf1b9
Update changelog
fixes #75
2022-05-01 17:10:24 +01:00
Starbeamrainbowlabs 8b385690c0
modpack.conf: add name field, since mesecons has one 2022-05-01 17:09:00 +01:00
Starbeamrainbowlabs a4237dcca5
depends.txt → mod.conf 2022-05-01 17:07:30 +01:00
Starbeamrainbowlabs 7622d85efa
docs: update dependencies 2022-05-01 17:01:03 +01:00
dependabot[bot] 1c80bbc031
Bump minimist from 1.2.5 to 1.2.6 in /.docs
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-30 02:25:54 +00:00
Starbeamrainbowlabs d77799a871
Merge pull request #73 from sbrl/dependabot/npm_and_yarn/dot-docs/follow-redirects-1.14.8
Bump follow-redirects from 1.14.1 to 1.14.8 in /.docs
2022-02-17 23:53:09 +00:00
dependabot[bot] 2ed3042bc8
Bump follow-redirects from 1.14.1 to 1.14.8 in /.docs
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.1 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.1...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 08:13:49 +00:00
VorTechnix 9995ea2fb9 Merge branch 'main' into VorTechnix 2022-01-03 06:56:58 -08:00
Starbeamrainbowlabs c443459282
wireframe/corner_set: fix luacheck warnings 2022-01-03 13:30:22 +00:00
Starbeamrainbowlabs 3d12345972
//smake: fix luacheck warnings 2022-01-03 13:28:43 +00:00
Starbeamrainbowlabs 4c7bb6a980
//sfactor: fix luacheck warnings; fix crash 2022-01-03 13:26:51 +00:00
Starbeamrainbowlabs 67b4495aad
README: add link to edit full reference 2022-01-03 12:54:33 +00:00
Starbeamrainbowlabs ee465070c9
fixup 2022-01-03 12:53:41 +00:00
Starbeamrainbowlabs 58933c6435
README: Update command list 2022-01-03 12:49:59 +00:00
Starbeamrainbowlabs 6c49b9d598
fixup again 2022-01-03 02:42:12 +00:00
Starbeamrainbowlabs 364de73fd0
fixup 2022-01-03 02:40:44 +00:00
Starbeamrainbowlabs 5bc8687ff1
Prepare 1.13 release! It's happening :D 2022-01-03 02:37:42 +00:00
Starbeamrainbowlabs bc1ded787c
wea.sculpt.apply: Comment debug logging 2022-01-02 17:19:53 +00:00
Starbeamrainbowlabs 3db39a3789
update changelog 2022-01-02 17:17:50 +00:00
Starbeamrainbowlabs 81773c8556
//forest: use local wea alias 2022-01-02 17:17:05 +00:00
Starbeamrainbowlabs 80e230a9d7
saplingnames: update cool_trees bamboo 2022-01-02 17:16:38 +00:00
Starbeamrainbowlabs 6a1fd707d4
//sculpt: fix crash when pos2 is not defined 2022-01-02 14:45:46 +00:00
Starbeamrainbowlabs d9204e95b5
selection: Improve message shown to players 2022-01-02 13:19:31 +00:00
Starbeamrainbowlabs dc5f8f0753
Changelog: Add moar links 2022-01-01 14:56:55 +00:00
Starbeamrainbowlabs 1da5599e80
remove debug logging 2021-12-31 14:46:23 +00:00
Starbeamrainbowlabs d45e4e893a
docs reference: tweak wording 2021-12-31 14:05:05 +00:00
Starbeamrainbowlabs 98bf0ef386
//maze: Fix seed when generating multiple mazes in the same second 2021-12-31 14:02:53 +00:00
Starbeamrainbowlabs cce27525cc
Changelog: add //move+
Now that we've fixed the bug therewith, I feel happy with officially 
adding it to the changelog
2021-12-31 13:39:18 +00:00
Starbeamrainbowlabs 2d53869f11
//move+: fix leaving-source-behind problem 2021-12-31 13:38:13 +00:00
Starbeamrainbowlabs 8170ecb1f1
reference //for: add more examples 2021-12-31 13:19:22 +00:00
Starbeamrainbowlabs d6cd0cdb59
tokenize_commands: fix crash 2021-12-31 13:16:09 +00:00
Starbeamrainbowlabs c93f692f9d
docs: Add basic documentation for //for 2021-12-31 13:10:40 +00:00
Starbeamrainbowlabs b87c846e67
fixup 2021-12-31 13:02:13 +00:00
Starbeamrainbowlabs b0019b87e1
Update changelog 2021-12-31 13:01:12 +00:00
Starbeamrainbowlabs 9d0ca493b8
docs //sculpt: add note about contributing your own brushes back
we'd lvoe to expand our collection of inbuilt custom brushes :D
2021-12-31 12:53:05 +00:00
Starbeamrainbowlabs c5276ae47e
docs //sculpt: add note about negative height values 2021-12-31 12:45:47 +00:00
Starbeamrainbowlabs db7602a8b3
//sculpt, //sculptlist: add to documentation 2021-12-31 12:44:15 +00:00
Starbeamrainbowlabs d252ec4675
wea.move: add potential solution as a comment 2021-12-31 03:05:02 +00:00
Starbeamrainbowlabs 934007c07b
//move+ add comment about bug 2021-12-31 03:01:51 +00:00
Starbeamrainbowlabs 56a83572e7
fixup 2021-12-31 02:46:15 +00:00
Starbeamrainbowlabs 1310dae884
Refactor: Split up terrain.lua, make subtable wea.terrain
This is just the start, if my plans work out.

The eventual aim here is to implement a generic Heightmap2D class, just 
like Vector3.

This will make interacting with heightmaps much easier.
2021-12-31 02:42:32 +00:00
Starbeamrainbowlabs 9df5ba6fe5
//sculpt, //sculptlist: fix naming of static brushes; prettify output 2021-12-31 01:43:53 +00:00
Starbeamrainbowlabs 227265db72
//sculpt: fix importing static brushes 2021-12-31 01:39:04 +00:00
Starbeamrainbowlabs dd8cd78d6b
wea.inspect: pull metatable names from item.__name
this is completely arbitrary, but will assist in discovering types of 
tables etc.
2021-12-31 01:38:24 +00:00
Starbeamrainbowlabs 70d6f36444
tests/str_starts: fix assert calls 2021-12-31 01:34:41 +00:00
Starbeamrainbowlabs 4597edcf1e
str_ends: write tests 2021-12-31 01:33:44 +00:00
Starbeamrainbowlabs 08cff1c967
strings/polyfill/str_ends: actually export it correctly 2021-12-31 01:14:08 +00:00
Starbeamrainbowlabs f19b22e906
//sculpt: add simple test ellipse static brush 2021-12-31 01:04:27 +00:00
Starbeamrainbowlabs ec04cc58be
Add support for autoloading static brushes on server start 2021-12-31 01:03:56 +00:00
Starbeamrainbowlabs 3f1e01a282
docs/img2brush: tweak file extension in instructions 2021-12-31 00:59:44 +00:00
Starbeamrainbowlabs f259f85771
Add io compatibility layer
....I can't believe that Lua doesn't have an inbuilt scandir 
equivalent?!
2021-12-31 00:57:17 +00:00
Starbeamrainbowlabs 1e9a651537
stings/polyfill: add str_ends
....because seriously, Lua *really* should have this.
2021-12-31 00:55:46 +00:00
Starbeamrainbowlabs d60d3073bd
fixup 2021-12-28 22:18:40 +00:00
Starbeamrainbowlabs 3c279559f5
img2brush: rescale pixel values 2021-12-28 22:16:45 +00:00
Starbeamrainbowlabs 691b71adfe
Add img2brush tool to website
Pending insertion of a link into the reference docs
2021-12-28 22:13:38 +00:00
Starbeamrainbowlabs ef2dbc1806
Reorder brushes
circle_soft1 is now the default brush, as it's awesome
2021-12-28 19:07:02 +00:00
Starbeamrainbowlabs b0e0b83c0d
//sculpt: Add buffer to catch height variations in terrain 2021-12-28 19:04:13 +00:00
Starbeamrainbowlabs be7d46740a
Update changelog (//convolve) 2021-12-28 18:38:23 +00:00
Starbeamrainbowlabs ca6f1e7cea
//sculpt: sort pos{1,2}_compute 2021-12-28 18:38:10 +00:00
Starbeamrainbowlabs 732010a8ee
//layers: comment debug logging 2021-12-28 18:37:54 +00:00
Starbeamrainbowlabs 1de037c341
//sculpt brushes: __smooth → __gaussian 2021-12-28 18:35:16 +00:00
Starbeamrainbowlabs 3e2687f82d
Add soft circle brush 2021-12-28 18:32:40 +00:00
Starbeamrainbowlabs 1cad9f4064
Minor layout tweaks 2021-12-28 18:32:10 +00:00
Starbeamrainbowlabs db5d25d1de
//convolve: update matrix & kernel to use Vector3
A lot of the maths remains in the old style, but at least it doesn't 
take a zero-indexed table
2021-12-28 18:31:46 +00:00
Starbeamrainbowlabs 17cc91ba1c
//sculpt: implement circle brush 2021-12-28 17:45:20 +00:00
Starbeamrainbowlabs 2da0f2dcc2
Add circle brush, but it isn't working right just yet. 2021-12-28 17:22:18 +00:00
Starbeamrainbowlabs a2a9108d36
//sculpt: fix a bunch of bugs
including, but certainly not limited to, wea.make_heightmap now returns 
a Vector3 instance for heightmap_size
2021-12-28 15:22:51 +00:00
Starbeamrainbowlabs bbafca2020
apply: use wea.sculpt.apply_heightmap() 2021-12-28 02:20:47 +00:00
Starbeamrainbowlabs b0c3d34dd0
Implement apply function for VoxelManipulators 2021-12-28 02:17:26 +00:00
Starbeamrainbowlabs 75ffa81b7e
bonemeal: tidy up split_shell call 2021-12-28 01:46:12 +00:00
Starbeamrainbowlabs f1a433b5e3
split_shell: automatically trim whitespace; ignore args that consist solely of whitespace
Hence "//bonemeal       1     4     " now functions correctly
2021-12-28 01:27:39 +00:00
Starbeamrainbowlabs 462570f2eb
//bonemeal: bugfix argument parsing 2021-12-28 01:26:53 +00:00
Starbeamrainbowlabs 58d3c1e43b
Add optional frame to brush previews
This way, it's easiere to see where the edges are of the preview
2021-12-27 19:45:13 +00:00
Starbeamrainbowlabs d657ce1abe
//sculptlist: fix bugs. It works! 2021-12-27 19:36:57 +00:00
Starbeamrainbowlabs 10c9d6f886
Start implementing a //sculpt command, but it's not finished or tested yet.
First up: test that our initial basic dynamic brushes work as intended 
with the //sculptlist [preview] command.

Also on the todo list: document it in the chat command reference!
2021-12-27 03:11:52 +00:00
Starbeamrainbowlabs c030acfd7e
Vector3: add new .clamp() function 2021-12-27 02:18:56 +00:00
Starbeamrainbowlabs eab498aac2
comment debug logging 2021-12-27 01:58:01 +00:00
Starbeamrainbowlabs 6e89fc868f
//maze: fix generated maze not reaching to the very edge of the defined region
Fixes #60.
2021-12-26 22:57:47 +00:00
Starbeamrainbowlabs af0e54cfdf
//maze: update to use Vector3 2021-12-26 22:48:37 +00:00
Starbeamrainbowlabs b962ace8a8
//maze, //maze3d: Fix crash if no arguments are specified 2021-12-26 22:45:37 +00:00
Starbeamrainbowlabs f7a5e223d4
really fix #72 2021-12-26 22:40:00 +00:00
Starbeamrainbowlabs 502595579e
Try fixing #72 2021-12-26 22:36:24 +00:00
Starbeamrainbowlabs 01d6132055
docs/Reference: make filter box autofocus 2021-12-16 21:18:55 +00:00
Starbeamrainbowlabs caa06a5c4c
bnf/axes: make h and v absolute 2021-12-01 20:02:53 +00:00
Starbeamrainbowlabs a7412a2c2f
bnf/axes: add reverse 2021-11-30 19:10:45 +00:00
Starbeamrainbowlabs 2d8dcc7ebc
grammrs/axes: add h / v for horizontal / vertical 2021-11-29 23:24:10 +00:00
Starbeamrainbowlabs 50840ad5b9
Add BNF for axes parsing 2021-11-29 23:20:40 +00:00
VorTechnix 104fe97be3 Update selection.lua 2021-11-16 11:34:58 -08:00
Starbeamrainbowlabs 14ba42fa4a
//move+ add commented otu alias 2021-11-13 12:49:21 +00:00
Starbeamrainbowlabs a321c7d2ab
Reference: Fix heading indents 2021-11-13 12:46:50 +00:00
Starbeamrainbowlabs e773edb58c
//move+: Update documentation 2021-11-13 12:42:58 +00:00
Starbeamrainbowlabs 607f2bfdea
//move+: bugfix 2021-11-13 12:41:00 +00:00
Starbeamrainbowlabs 8ec89c3e67
Implement //move+, but it isn't working right just yet. 2021-11-13 12:36:10 +00:00
Starbeamrainbowlabs eaabf40301
Add commented out alias overrides
Eventually, worldedit *will* become an optional dependency. The
rationale for this is that WorldEditAdditions is outgrowing the core
WorldEdit API, and we want to add new features such as toggling
safe_region on and off with a chat command and other such goodies.

Merging the 2 mods is not something that has been discussed (due
mainly because I'm far too nervous to even ask the question in the
first place), but the 2 codebases are fundamentally different (and
for good reason, as WorldEditAdditions splits code over many different
files to improve maintainability and scalability) so this would
be a significant undertaking.

At no point however will WorldEditAdditions become incompatible
with WorldEdit itself. The 2 mods should happily co-exist with
one another (so long as you keep them both updated of course).
2021-11-11 02:54:44 +00:00
Starbeamrainbowlabs acb1ef1a0a
//copy+: write docs 2021-11-11 02:36:37 +00:00
Starbeamrainbowlabs d560583121
Make //copy+ a thing using the new wea.parse.axes 2021-11-11 02:20:37 +00:00
Starbeamrainbowlabs 9729e82e35
parse_axes: support "true" as alias to activate mirrorring submode 2021-11-11 01:50:12 +00:00
Starbeamrainbowlabs 94f675ddce
parse_axes: add mirroring function 2021-11-11 01:47:22 +00:00
Starbeamrainbowlabs 41604d19ac
player.lua: tidy up comments 2021-11-11 01:33:08 +00:00
Starbeamrainbowlabs 43ea6e34c1
fixup 2021-11-10 02:07:34 +00:00
Starbeamrainbowlabs e82440a096
Add deep copy table function 2021-11-10 02:07:13 +00:00
Starbeamrainbowlabs 35970b31b3
Implement tests for parse_axes 2021-11-08 00:47:35 +00:00
Starbeamrainbowlabs 4fb59a160f
parse_relative_axis_name: write tests 2021-11-08 00:16:51 +00:00
Starbeamrainbowlabs be81e6dfaa
parse_abs_axis_name: add tests for multiple axes at a time 2021-11-07 18:06:05 +00:00
Starbeamrainbowlabs 96c3ede365
parse_axes: bugfix, start writing tests 2021-11-07 18:04:18 +00:00
Starbeamrainbowlabs 3f5fc45e1a
docs: add new image to site 2021-11-07 17:45:03 +00:00
Starbeamrainbowlabs 2babba9c55
first pass on writing an advanced axes parser, but it's untested 2021-11-07 17:14:11 +00:00
Starbeamrainbowlabs f569358229
Merge pull request #71 from sbrl/VorTechnix
Merge Vortechnix's branch
2021-11-07 16:10:15 +00:00
VorTechnix 46bd5d4fce Merge branch 'VorTechnix' of https://github.com/sbrl/Minetest-WorldEditAdditions into VorTechnix 2021-11-07 07:36:45 -08:00
VorTechnix 54268431b5 added missing quotation marks 2021-11-07 07:36:43 -08:00
VorTechnix f7d4c5c6ac
Fix shadowing error 2021-11-07 07:04:07 -08:00
Starbeamrainbowlabs 43a720bec4
GitHub Actions: shorten build output a bit 2021-11-07 14:52:35 +00:00
Starbeamrainbowlabs 579e040bb1
GitHub Actions: Make LuaCheck build fail if LuaCheck errors are encountered
We have fixed our backlog of LuaCheck errors, so we should make LuaCheck 
errors fail the build from now on to ensure new issues don't sneak in.
2021-11-07 14:49:39 +00:00
Starbeamrainbowlabs 3f48832fff
Merge branch 'main' into VorTechnix 2021-11-07 14:31:01 +00:00
Starbeamrainbowlabs 12371a472d
we_core: fix bugs, add more useful error messages 2021-11-07 13:35:40 +00:00
Starbeamrainbowlabs 3f1f3b5628
reference: mark a thing in bold 2021-11-07 12:49:13 +00:00
Starbeamrainbowlabs a5b32bc2d9
worldeditadditions_core: add README 2021-11-07 12:48:27 +00:00
Starbeamrainbowlabs 3eb59633b7
README: fixup 2021-11-07 01:02:36 +00:00
Starbeamrainbowlabs ea8a91568e
//spiral2: fix crash in parser 2021-10-31 19:48:51 +00:00
Starbeamrainbowlabs 33a2ff1ed4
//spiral2 circle: round down 2021-10-31 19:48:40 +00:00
Starbeamrainbowlabs f5133d287b
Default to square spirals 2021-10-31 17:11:24 +00:00
Starbeamrainbowlabs 21902b8512
//spiral2: update docs 2021-10-31 17:10:22 +00:00
Starbeamrainbowlabs 9d7000baed
Add circular spirals :D 2021-10-31 16:59:52 +00:00
Starbeamrainbowlabs e610eb7a92
//spiral2: fix bugs 2021-10-31 16:42:12 +00:00
Starbeamrainbowlabs dae59b63db
//walls: Prevent crash if not parameters are specified by defaulting to dirt as the replace_node 2021-10-31 16:41:52 +00:00
Starbeamrainbowlabs d3a8efb9b8
Add //spiral2, write glue for square spirals
Next up: circular spirals!
2021-10-31 15:11:01 +00:00
Starbeamrainbowlabs a3f26200a0
init: call spiral_square 2021-10-30 02:47:19 +01:00
Starbeamrainbowlabs 0bcd82a11c
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions into main 2021-10-30 02:46:33 +01:00
Starbeamrainbowlabs ad789d500a
Implement spiral square, but it's untested.
It would also be awesome to customise the directional plane upon which 
the spiral is generated. It might actually be possible without melting 
my brain I think....


Looking at http://www.mathematische-basteleien.de/spiral.htm it should 
be possible to go this for circles too. But there's 1 particular 
function in Vector2.js that we need to port to Vector3.lua that we 
haven't yet which we'd need for that.....
2021-10-30 02:46:25 +01:00
Starbeamrainbowlabs 5fca3e4322
Fix bonemeal mod detection to look for the global bonemeal, not whether the bonemeal mod name has been loaded 2021-10-25 15:18:03 +01:00
Starbeamrainbowlabs 84741f5cb9
ellipsoid2: remove todo 2021-10-23 14:32:44 +01:00
Starbeamrainbowlabs 2aa15116e2
docs: Apparently some web servers don't like % characters in filepaths. Wierd! 2021-10-17 03:04:50 +01:00
Starbeamrainbowlabs 6eaa3799d3
docs: massively improve image conversion system
more formats, memoizing, custom <picture> element generation, async 
image conversion to optimise CPU usage, and more!

Too bad that the imagemagick apt package doesn't natively support JPEG 
XL just yet (Imagemagick 7 does though), but that's an easy fix on our 
end once they add support :D

It looks like we need to implement our own alternative to the serve 
command though :-/
2021-10-17 03:00:24 +01:00
Starbeamrainbowlabs 2ae241aee5
Add //ellipsoid2 2021-10-14 01:50:27 +01:00
Starbeamrainbowlabs 91d5b9abc2
ellipsoid: add comment 2021-10-13 22:50:37 +01:00
Starbeamrainbowlabs 5bdd8ddb5e
ellipsoid: remove redundant minetest.get_content_id("air") call
wea.is_airlike() is the new function that should be used instead,  but 
in this case the call wasn't even necessary
2021-10-13 22:46:14 +01:00
Starbeamrainbowlabs 32fb8be8fe
docs: remember searchall setting with localStorage; better categorical command list filtering 2021-10-12 02:23:33 +01:00
Starbeamrainbowlabs 4955aa7579
docs: update dependencies 2021-10-11 02:45:21 +01:00
Starbeamrainbowlabs 653864be99
Start working on //copy, but it's not finished yet.
We need to merge @VorTechnix's branch in first to gain access to 
advanced axis parsing functions before we can complete it.

For this reason, the command registration for //copy is currently 
commented out.
2021-10-11 02:41:45 +01:00
VorTechnix 0352595e41 Merge branch 'main' into VorTechnix 2021-10-10 18:37:58 -07:00
VorTechnix 191e99f0b5 refactored table_tosting 2021-10-10 14:39:50 -07:00
VorTechnix b72d36816e added to_boolean 2021-10-10 14:39:30 -07:00
Starbeamrainbowlabs 8044a9059c
docs: fix title of reference 2021-10-10 20:34:36 +01:00
Starbeamrainbowlabs de60c94c40
docs bugfix: alow filtering command list on category names 2021-10-05 02:38:12 +01:00
Starbeamrainbowlabs c8773efe22
Docs: Upgrade reference to support categorical display
It even persists your preference using localStorage!
2021-10-05 02:02:53 +01:00
Starbeamrainbowlabs 5f2d5216af
Reference: Categorise commands 2021-10-04 22:12:41 +01:00
Starbeamrainbowlabs d642d44e4c
Chat-Command-Reference: add note 2021-10-04 21:52:33 +01:00
Starbeamrainbowlabs da15c577a6
Update quick command reference 2021-10-04 21:51:07 +01:00
Starbeamrainbowlabs 66a3244203
Bugfix docs: fix last section not appearing in reference 2021-10-04 21:45:15 +01:00
Starbeamrainbowlabs 55982b2eab
cloud wand: Improve chat message text 2021-10-03 15:31:27 +01:00
Starbeamrainbowlabs be3166624a
//replacemix: fix crash caused by invalid invocation 2021-09-18 12:16:03 +01:00
Starbeamrainbowlabs 75d40d7a6c
Update dependencies 2021-09-11 01:45:57 +01:00
Starbeamrainbowlabs 889ccf3acc
build.sh: only deploy commits present on the main branch 2021-09-11 01:44:58 +01:00
Starbeamrainbowlabs 4a40e78dd7
build.sh: fix missing exit 2021-09-11 01:29:58 +01:00
Starbeamrainbowlabs d6b5a4c01e
build.sh: fix shellcheck errors 2021-09-11 01:24:51 +01:00
VorTechnix bc0658b545 Update init.lua 2021-09-05 09:35:07 -07:00
VorTechnix a5960983e7 Merge branch 'main' into VorTechnix 2021-09-05 09:34:54 -07:00
Starbeamrainbowlabs 9d00eb26cf
Update changelog 2021-08-12 01:09:51 +01:00
Starbeamrainbowlabs 62582b6abb
Update sapling alias compatibility 2021-08-12 01:09:24 +01:00
Starbeamrainbowlabs eb9236a153
website: add new picture 2021-08-10 18:08:12 +01:00
Starbeamrainbowlabs f1aa481d99
website: remove extra rogue npm package 2021-08-08 22:02:31 +01:00
Starbeamrainbowlabs 115855fc99
Minor website updates 2021-08-08 15:38:03 +01:00
Starbeamrainbowlabs 5228aef56c
//noiseapply2d: document 2021-08-07 23:10:40 +01:00
Starbeamrainbowlabs 2920f7081d
Add `//noiseapply` 2021-08-07 23:01:15 +01:00
Starbeamrainbowlabs 6cd367915d
//airapply: fix rogue args_parsed 2021-08-07 22:37:45 +01:00
Starbeamrainbowlabs fcd4de3429
//airapply: fix nodes_needed 2021-08-07 22:35:32 +01:00
Starbeamrainbowlabs b131970f16
fixup 2021-08-07 22:30:38 +01:00
Starbeamrainbowlabs 6f00394d3d
Noise: add perlinmt algorithm & set as default 2021-08-07 22:30:10 +01:00
Starbeamrainbowlabs 7de09e92b3
README: Send quick reference to the new website 2021-08-07 21:22:27 +01:00
Starbeamrainbowlabs 10a649e597
//airapply: error handling 2021-08-07 21:16:17 +01:00
Starbeamrainbowlabs e1b1efb7ed
//spop: fix wording 2021-08-07 17:50:28 +01:00
Starbeamrainbowlabs 516611db63
fixup 2021-08-07 17:46:10 +01:00
Starbeamrainbowlabs 16f500b465
Update changelog 2021-08-07 17:45:51 +01:00
Starbeamrainbowlabs 82c1ebd42c
//sstack: add human-readable approx volume to output 2021-08-07 17:44:26 +01:00
Starbeamrainbowlabs fc2444c5cd
//floodfill: remove debug 2021-08-07 02:31:21 +01:00
Starbeamrainbowlabs d1b0866af2
//floodfill: fix crash 2021-08-07 02:30:38 +01:00
VorTechnix 551f0c7e16 player_dir debugged (hopefully) 2021-08-05 20:38:59 -07:00
VorTechnix cff58792bf Merge branch 'main' into VorTechnix 2021-08-05 10:43:00 -07:00
VorTechnix 4cf30a0e74 updated @return on sort 2021-08-05 10:41:35 -07:00
VorTechnix 533519d318 streamlined getsign 2021-08-05 10:40:36 -07:00
Starbeamrainbowlabs e9398862b9
wea.inspect: comment out debug 2021-08-05 15:58:14 +01:00
Starbeamrainbowlabs 9bcf242443
Add worldeditadditions.inspect function 2021-08-05 15:55:30 +01:00
Starbeamrainbowlabs 35777b7ae5
//layers: comment debug 2021-08-05 02:38:57 +01:00
Starbeamrainbowlabs f5f486f303
Bugfix //walls: correct nodes_needed calculations to take thickness into account 2021-08-05 02:07:20 +01:00
Starbeamrainbowlabs f30ddbae3b
//walls: add optional thickness argument 2021-08-05 02:00:38 +01:00
Starbeamrainbowlabs c2702a8fde
Website/reference: Update search to also serch command list 2021-08-05 01:32:44 +01:00
Starbeamrainbowlabs 7e008df540
Reference: tweak //layers explanation 2021-08-05 01:18:27 +01:00
Starbeamrainbowlabs 87f84e2482
//bonmeal: add optional node list constraint 2021-08-05 01:17:43 +01:00
Starbeamrainbowlabs 3338a3fddf
Reference: Document new extension to //layers 2021-08-05 00:57:22 +01:00
Starbeamrainbowlabs 5d27ba9ccb
Vector3.new: add test to make sure Vector3.new() returns (0, 0, 0) 2021-08-04 21:24:36 +01:00
Starbeamrainbowlabs c48e9f2ab8
Vector3.min, Vector3.max: allow arguments to be numbers 2021-08-04 21:23:01 +01:00
Starbeamrainbowlabs 7c7abf4509
Queue: document with comments 2021-08-04 21:11:47 +01:00
Starbeamrainbowlabs b7c3f21135
reference: add quick todo 2021-08-04 12:20:32 +01:00
Starbeamrainbowlabs ef678e6a05
//layers: fix 2021-08-04 12:17:39 +01:00
Starbeamrainbowlabs db830c6633
Implement slope constraint for //layers, but it isn't tested yet 2021-08-04 01:41:51 +01:00
Starbeamrainbowlabs 902d5ddc8b
wea.calculate_normals: update comment 2021-08-04 00:53:47 +01:00
Starbeamrainbowlabs 1833e68ec5
terrain.lua: add wea.calculate_slope() 2021-08-04 00:51:16 +01:00
VorTechnix e5443bc3ce check (maybe working?) 2021-08-02 18:54:33 -07:00
VorTechnix f9ac0e65ec alias override 2021-08-02 18:54:18 -07:00
VorTechnix 77ffda46f7 added axis and dir checks 2021-08-02 18:16:50 -07:00
VorTechnix 74ba9cc36f more lib/selector refactoring 2021-08-02 16:01:02 -07:00
VorTechnix 325f1cc11e added init for lib/selectors 2021-08-02 13:29:55 -07:00
VorTechnix af1640c4da Revert "added conventions header and DIR details"
This reverts commit 9669e46ff8.
2021-08-01 10:41:52 -07:00
VorTechnix 9669e46ff8 added conventions header and DIR details 2021-08-01 10:37:13 -07:00
VorTechnix b20c8f9af1 Merge branch 'main' into VorTechnix 2021-08-01 07:03:31 -07:00
Starbeamrainbowlabs a9b746986a
fixup 2021-07-31 16:08:01 +01:00
Starbeamrainbowlabs 07c55dc740
split_shell: comment debug
also, in 45def53 we fixed a bug with quotes being left behind at the and 
of a string
2021-07-31 16:07:48 +01:00
Starbeamrainbowlabs 38b095d33e
Update changelog 2021-07-31 16:06:37 +01:00
Starbeamrainbowlabs 45def53294
various commands: Upgrade to use wea.split_shell 2021-07-31 16:03:04 +01:00
VorTechnix f0cd689049 Update CHANGELOG.md 2021-07-30 14:30:21 -07:00
VorTechnix bd84979393 //sshift added 2021-07-30 14:02:46 -07:00
Starbeamrainbowlabs e16fa0f5c8
Move luacheck config file to standard location 2021-07-30 21:21:50 +01:00
Starbeamrainbowlabs 655d9ebac9
//many, //multi, parse_reference: various luacheck fixes 2021-07-30 20:07:08 +01:00
Starbeamrainbowlabs c14bb40f7e
//ellipsoidapply: undefined variable fixes 2021-07-30 20:03:31 +01:00
Starbeamrainbowlabs 23e08c5693
//multi: luacheck fix 2021-07-30 20:03:16 +01:00
Starbeamrainbowlabs 1c8d572bb8
//airapply: fix undefined variables 2021-07-30 20:01:38 +01:00
Starbeamrainbowlabs 47303acac1
//convolve: fix wea.convolve returns false, then return the associated error message 2021-07-30 20:00:41 +01:00
Starbeamrainbowlabs 9ccd62845f
//line: correctly return error in parsing function 2021-07-30 19:59:34 +01:00
Starbeamrainbowlabs ee561cd6e4
//convolve: fix luacheck issue 2021-07-30 19:58:23 +01:00
Starbeamrainbowlabs 8c76b3b760
Queue: fix accessing undefined variable result 2021-07-30 19:57:16 +01:00
Starbeamrainbowlabs f0e1111b7c
tokenise_commands: fix luacheck issue 2021-07-30 19:56:44 +01:00
Starbeamrainbowlabs 0164a9b9eb
wea.parse.map: fix autoconverting to number / bool 2021-07-30 19:56:01 +01:00
Starbeamrainbowlabs 05eaf01912
nodes.lua: fix shadowing definition of loop variable i on line 22 2021-07-30 19:54:57 +01:00
Starbeamrainbowlabs 3ac0fa14f9
is_airlike: Fix accessing undefined global variable 2021-07-30 19:54:13 +01:00
Starbeamrainbowlabs a8e0a3088b
lru_benchmark: fix luacheck errors 2021-07-30 19:53:29 +01:00
Starbeamrainbowlabs 3c414f2dbd
Fix more issues discovered by luacheck 2021-07-30 19:52:36 +01:00
Starbeamrainbowlabs 64ed01132e
scale_down: fix redefining posi_copy 2021-07-30 19:49:11 +01:00
Starbeamrainbowlabs 54d0f5a3a3
run2d: Fix accidental redefining global variable 2021-07-30 19:48:10 +01:00
Starbeamrainbowlabs 51e1e7dcbd
noise.params_apply_default: Fix shadowing variable 2021-07-30 19:47:21 +01:00
Starbeamrainbowlabs 1f4a115063
//maze3d: Fix accidental global variable definition 2021-07-30 19:46:33 +01:00
Starbeamrainbowlabs f37a2aabcf
//forest: Fix redefining variable i in loop 2021-07-30 19:45:09 +01:00
Starbeamrainbowlabs c6bae3b7e0
//erode river: fix redefining i in nested loop 2021-07-30 19:44:02 +01:00
Starbeamrainbowlabs fd2ae78625
typo 2021-07-30 19:19:09 +01:00
Starbeamrainbowlabs 082f491fa6
add comment 2021-07-30 19:04:21 +01:00
Starbeamrainbowlabs 910d4b036f
maze2d: squash another undefined variable 2021-07-30 19:03:54 +01:00
Starbeamrainbowlabs e10dd1ff2e
Luacheck: start drafting config file 2021-07-30 19:03:40 +01:00
Starbeamrainbowlabs 73a9ff3d60
GitHub Actions: tweak 2021-07-30 18:49:05 +01:00
Starbeamrainbowlabs 6f8c4d0c7c
GitHub Actions: Run tests 2021-07-30 18:47:21 +01:00
Starbeamrainbowlabs 37f25d40a1
GitHub Actions: Add Checkout action 2021-07-30 18:45:31 +01:00
Starbeamrainbowlabs 04b5723db2
GitHub Actions: sanity check 2021-07-30 18:43:02 +01:00
Starbeamrainbowlabs 624b9539a7
GitHub Actions: lua --version → lua -v 2021-07-30 18:39:55 +01:00
Starbeamrainbowlabs 26617d71a7
GitHub Actions: sudo 2021-07-30 18:38:48 +01:00
Starbeamrainbowlabs 591ffb977e
fixup 2021-07-30 18:37:48 +01:00
Starbeamrainbowlabs 1c4310b6dd
GitHub Actions: Fix docker container name 2021-07-30 18:35:46 +01:00
Starbeamrainbowlabs caee6a8443
fixup 2021-07-30 18:34:53 +01:00
Starbeamrainbowlabs c86cff6de6
GitHub Actions: alter steps values 2021-07-30 18:32:20 +01:00
Starbeamrainbowlabs 5a211279e2
GitHub Actions: main → test 2021-07-30 18:28:48 +01:00
Starbeamrainbowlabs ce923353f2
GitHub Actions: define steps 2021-07-30 18:28:13 +01:00
Starbeamrainbowlabs 7a77fffbca
GitHub Actions: and again 2021-07-30 18:27:38 +01:00
Starbeamrainbowlabs 971deaa63b
GitHub Actions: does this work? I hate yaml SO MUCH. 2021-07-30 18:27:04 +01:00
Starbeamrainbowlabs baf8a5e02d
GitHub Actions: fix 2021-07-30 18:22:51 +01:00
Starbeamrainbowlabs 21043f7c9d
Move GitHub Actions definition 2021-07-30 18:19:46 +01:00
Starbeamrainbowlabs b2fcc4d72f
GitHub actions 2021-07-30 18:16:43 +01:00
Starbeamrainbowlabs 7ef3d694a7
Add syntax check 2021-07-30 18:12:28 +01:00
Starbeamrainbowlabs f7cda8c817
//subdivide: Fix referencing undefined global variable 2021-07-30 18:06:44 +01:00
Starbeamrainbowlabs 92451cf125
scale.lua: fix inconsistent whitespace 2021-07-30 18:05:45 +01:00
Starbeamrainbowlabs ecb846fcfe
//erode river: fix undefined global variable 2021-07-30 18:03:39 +01:00
VorTechnix b795f3b169 dissabled macros -- too buggy 2021-07-29 15:49:37 -07:00
VorTechnix 5757ef892d added //macro 2021-07-28 18:13:15 -07:00
VorTechnix ebae1cd844 update to use player_vector 2021-07-28 18:08:22 -07:00
VorTechnix 0ecd6233ad Update for.lua 2021-07-28 18:06:26 -07:00
VorTechnix 8225199520 renamed axes.lua to player.lua 2021-07-28 18:06:10 -07:00
VorTechnix 43a59b68ff converted //for to step function 2021-07-28 13:35:52 -07:00
Starbeamrainbowlabs bd1da727a4
Integrate split_shell into worldeditadditions
...it's not used anywhere yet though
2021-07-28 18:32:41 +01:00
VorTechnix 57369099a7 Update basename.lua 2021-07-28 10:15:03 -07:00
Starbeamrainbowlabs b708fec2db
fixup 2021-07-28 18:07:21 +01:00
Starbeamrainbowlabs 6a77b3cd21
split_shell: fix escape handling by unwinding escaping by 1 level 2021-07-28 17:54:44 +01:00
Starbeamrainbowlabs c282e286bb
split_shell: correctly handle escaping edge cases 2021-07-28 17:49:18 +01:00
Starbeamrainbowlabs 31a4d89a49
TEST: implement split_shell 2021-07-28 17:39:09 +01:00
VorTechnix 1436974e9b added //for 2021-07-27 19:56:45 -07:00
VorTechnix 415f36013f comment tweak 2021-07-27 19:56:29 -07:00
VorTechnix 9ee24cf32f Update README.md 2021-07-26 18:12:20 -07:00
VorTechnix 9b585f2906 Merge branch 'main' into VorTechnix 2021-07-26 16:40:53 -07:00
Starbeamrainbowlabs a3bba21266
CONTRIBUTING.md: fiddle with layout 2021-07-27 00:38:51 +01:00
VorTechnix 9f3bb3a3bb Merge branch 'main' into VorTechnix 2021-07-26 16:36:32 -07:00
VorTechnix db8aef5f7c
fixed contributing link and removed redundent entry 2021-07-26 16:35:18 -07:00
VorTechnix 77fef22d29 Update CONTRIBUTING.md with template 2021-07-26 16:29:37 -07:00
VorTechnix b4d07e9d75 Update CONTRIBUTING.md with template 2021-07-26 16:29:01 -07:00
Starbeamrainbowlabs 2687c4a5f6
README: Add link to contributing guide 2021-07-27 00:09:05 +01:00
Starbeamrainbowlabs d00b5a6213
docs/Tutorial: typo 2021-07-26 19:06:23 +01:00
VorTechnix af07a158a8 shaved some milliseconds off split 2021-07-23 18:05:54 -07:00
VorTechnix 6e3b9d99e9 removed tests 2021-07-23 16:21:58 -07:00
VorTechnix f6ed5241b4 documentation for wireframe stuff 2021-07-23 14:12:20 -07:00
VorTechnix 24569c37d3 fixed single nodename crash 2021-07-23 13:13:47 -07:00
VorTechnix 8718e59206 added wcompass 2021-07-23 12:11:08 -07:00
VorTechnix 72513b350a revert to fsplit 2021-07-23 10:46:23 -07:00
VorTechnix ce1ba27728 new split function 2021-07-22 13:29:41 -07:00
VorTechnix 4b35142044 params to params_text 2021-07-22 13:29:29 -07:00
VorTechnix 40f0e437fb Merge branch 'main' into VorTechnix 2021-07-21 12:38:18 -07:00
VorTechnix 19404484a0
Preserve Air During Schematic Load 2021-07-21 12:37:52 -07:00
Starbeamrainbowlabs 22c404b320
build.sh: only do ci tasks on main branch 2021-07-21 02:29:05 +01:00
VorTechnix d7d96ae263 //wbox added 2021-07-20 12:52:19 -07:00
VorTechnix 7b17c3675a Update corner_set.lua 2021-07-19 09:50:10 -07:00
VorTechnix 0c9987c745 corner set working 2021-07-19 08:55:39 -07:00
VorTechnix 1a78e61c31 selector aliases to init 2021-07-19 08:55:28 -07:00
VorTechnix 1e7ab670f7 fix typo 2021-07-19 07:47:22 -07:00
VorTechnix 2c42e0495c cornerset broken 2021-07-19 07:42:47 -07:00
VorTechnix dbab2e4a0d added wireframe stuff 2021-07-18 19:29:17 -07:00
VorTechnix 9420be3896 untangle init.lua 2021-07-18 19:24:57 -07:00
VorTechnix f7323afe10 wireframe corner 2021-07-18 17:27:37 -07:00
VorTechnix 7f9c8796d0 meta link fix 2021-07-18 17:27:21 -07:00
Starbeamrainbowlabs 73e07eb013
bit polyfill: tiny tweak 2021-07-19 00:26:52 +01:00
Starbeamrainbowlabs 9020948dc5
bit polyfill: fix undeclared global accessed warning 2021-07-19 00:26:19 +01:00
VorTechnix d94ebd7e54 separate init for meta commands 2021-07-18 13:12:45 -07:00
VorTechnix 5ea6ac18d2 wireframe blanks 2021-07-18 13:12:19 -07:00
VorTechnix 0b01520118 sets (not working) 2021-07-18 12:39:48 -07:00
Starbeamrainbowlabs fa2c0642c1
Fix typo in comment 2021-07-18 20:11:10 +01:00
Starbeamrainbowlabs 53f387344a
fixup 2021-07-18 00:00:22 +01:00
Starbeamrainbowlabs 496d41731a
Update changelog to add //airapply 2021-07-17 21:36:55 +01:00
Starbeamrainbowlabs e4d3f26692
perlin: use wea.bit.band 2021-07-17 21:34:50 +01:00
Starbeamrainbowlabs 5c7b5432d9
Add bit polyfill from https://github.com/Rabios/polyfill.lua 2021-07-17 21:31:31 +01:00
Starbeamrainbowlabs a80ab3b657
reference: update airapply & ellipsoidapply 2021-07-16 23:02:56 +01:00
Starbeamrainbowlabs 8b4ba8ccc1
airapply, ellipsoidapply: allow //multi to be a subcommand 2021-07-16 23:00:31 +01:00
Starbeamrainbowlabs eed691f6e0
Document //airapply 2021-07-16 22:26:41 +01:00
Starbeamrainbowlabs 271032a6d7
Merge pull request #68 from sbrl/VorTechnix
Add measurement tools, the start of worldeditadditions_core, some bug fixes, and other goodness :D
2021-07-15 22:13:01 +01:00
VorTechnix c1bfb496b5 Merge branch 'VorTechnix' of https://github.com/sbrl/Minetest-WorldEditAdditions into VorTechnix 2021-07-15 14:09:16 -07:00
VorTechnix caed5e7195 Create depends.txt 2021-07-15 14:09:14 -07:00
VorTechnix 49617b7f47
params_text in def.parse worldeditadditions_core/register/check.lua
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-07-15 14:04:43 -07:00
VorTechnix 7b651d7abe
Fix typo worldeditadditions_core/init.lua
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-07-15 13:47:37 -07:00
VorTechnix 0ad0c63def
Fix typos in mtools
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-07-15 13:44:56 -07:00
Starbeamrainbowlabs 57caddece7
airapply: fix header 2021-07-15 21:39:25 +01:00
VorTechnix a06413977e
fix mcount Chat-Command-Reference.md
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-07-15 13:29:25 -07:00
VorTechnix c57e8e6558 Merge branch 'main' into VorTechnix 2021-07-15 13:27:30 -07:00
VorTechnix e3dd7ae428 fixed optional dependency on worleditdebug 2021-07-15 12:00:05 -07:00
VorTechnix a6d5ead042 m-tools docs update 2021-07-15 11:45:06 -07:00
VorTechnix b605ab5a5c added m-tools to chat com ref 2021-07-15 11:31:22 -07:00
Starbeamrainbowlabs 1930b8c64d
tests/new: fix Vector3 tests 2021-07-15 02:19:42 +01:00
Starbeamrainbowlabs 0fef39d707
Vector3: Implement __concat operator overloading
Now you can do this:

local v = wea.Vector3.new(3, 4, 5)
print(v.."yay")
2021-07-15 02:18:21 +01:00
Starbeamrainbowlabs 0b379c48cb
Implement //airapply
For #56, but the docs aren't written yet so we'll wait on closing it 
until I've written them.
2021-07-15 02:17:14 +01:00
VorTechnix 0d7043b537 Update CHANGELOG.md 2021-07-13 19:44:18 -07:00
VorTechnix 5ac0b8a04c Update mtrig.lua 2021-07-13 19:43:56 -07:00
Starbeamrainbowlabs 0d1900d37c
Add airlike backend command, but it's nto tested or hooked up yet 2021-07-13 23:49:21 +01:00
Starbeamrainbowlabs aeea17524d
benchmark the new LRU cache implementation 2021-07-13 23:42:19 +01:00
Starbeamrainbowlabs 81957070f9
Implement an LRU cache 2021-07-13 23:42:08 +01:00
Starbeamrainbowlabs e799a2ea61
Refactor Queue implementation into separate file 2021-07-13 22:02:34 +01:00
VorTechnix 428ec12918 Update mtrig.lua 2021-07-13 09:59:53 -07:00
VorTechnix 9d2a0ca23c round mtrig values 2021-07-13 09:54:11 -07:00
VorTechnix 3f6b8f4d21 Fix and stabilize //mtrig 2021-07-13 09:09:40 -07:00
VorTechnix f94906c854 force output syntax in msize 2021-07-13 09:08:56 -07:00
Starbeamrainbowlabs e85b91d074
//noise2d infrared: remove debug print 2021-07-13 00:56:26 +01:00
Starbeamrainbowlabs 643e1a2dce
Reference: Add ref 2021-07-13 00:56:10 +01:00
Starbeamrainbowlabs 03038689e2
Add infrared noise 2021-07-13 00:54:52 +01:00
Starbeamrainbowlabs 8891c47e98
wea.parse.map: fix crash if keywords isn't specified 2021-07-13 00:22:35 +01:00
Starbeamrainbowlabs 0dee65ca1d
//noise2d: add red noise 2021-07-13 00:15:23 +01:00
Starbeamrainbowlabs 7db2207aea
noise2d/make_2d: add todo 2021-07-12 02:46:47 +01:00
Starbeamrainbowlabs 46c2a02ade
//noise2d: add white algorithm; fix nasty bug in apply_2d 2021-07-12 02:45:32 +01:00
VorTechnix d69dae5087 comment out worldedit debug stuff 2021-07-08 21:04:51 -07:00
VorTechnix 71460cb316 Added mtrig (vector3 broken) 2021-07-08 20:54:05 -07:00
Starbeamrainbowlabs b55f7018f9
Docs: add syntax highlighting to command invocations 2021-07-06 02:47:45 +01:00
Starbeamrainbowlabs a42e296f4e
Reference: Document //noise2d 2021-07-06 01:08:36 +01:00
Starbeamrainbowlabs 40173b2647
Vector3: default to 0 for unspecified args 2021-07-04 23:30:29 +01:00
Starbeamrainbowlabs 8a14d35c04
noise2d: add comment 2021-07-04 16:14:48 +01:00
Starbeamrainbowlabs 30f7927af4
Delete failed test :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( 2021-07-04 16:13:55 +01:00
Starbeamrainbowlabs 457f436a09
Failed implementation of xoshiro256++ becaause Lua doesn't have an integer type :-( :-( :-( :-( :-( :-( :-( 2021-07-04 16:13:32 +01:00
Starbeamrainbowlabs 0b0595a1d3
Remove a whole bunch of stray debug print statements 2021-07-04 14:35:02 +01:00
Starbeamrainbowlabs 0212950d87
wea.apply_heightmap_changes: fix loop 2021-07-04 14:30:22 +01:00
Starbeamrainbowlabs 1d82013d86
//noise2d: add sin; sort out apply_mode as number 2021-07-04 13:21:13 +01:00
Starbeamrainbowlabs 49bf0f19bc
Perlin: remove debug functions 2021-07-04 12:03:29 +01:00
Starbeamrainbowlabs b2eb76d280
//noise2d works!
...just.

Next up more engines and documentation
2021-07-03 22:53:16 +01:00
Starbeamrainbowlabs ad8d8eab6b
wea.format.map: use tostring on values to avoid crashes 2021-07-03 14:44:59 +01:00
Starbeamrainbowlabs 239113d415
Empty commit to test build system 2021-07-03 13:35:42 +01:00
Starbeamrainbowlabs 33e839db29
Reference: Another test 2021-07-03 13:28:39 +01:00
Starbeamrainbowlabs fafe2c22de
Reference: tiny layout to test build system 2021-07-03 13:26:18 +01:00
Starbeamrainbowlabs b6bee59097
Reference: Document //basename 2021-07-03 13:15:29 +01:00
VorTechnix e047372c22 Added //msize 2021-07-02 20:10:03 -07:00
Starbeamrainbowlabs ee2e5716eb
Implement more of the noise command backend
It's still not hooked up yet though, and there's no command parsing 
logic either
2021-07-03 01:44:36 +01:00
Starbeamrainbowlabs cae75ec5a2
Add moar comments 2021-07-03 00:42:19 +01:00
VorTechnix f709d12b75 Update table_tostring.lua 2021-06-30 22:11:34 -07:00
VorTechnix 484b7532eb fixed table.tostring 2021-06-30 11:59:19 -07:00
VorTechnix d479e167b9 //midpos implemented 2021-06-30 11:14:45 -07:00
VorTechnix 11bf486bf2 Update init.lua 2021-06-30 11:14:31 -07:00
VorTechnix 9ad27404b0 implemented chatcommand_handler 2021-06-30 08:36:04 -07:00
VorTechnix ba93cb7bea added WEA Core 2021-06-29 18:53:14 -07:00
VorTechnix d65fe98de6 added mface 2021-06-28 21:15:47 -07:00
VorTechnix 71fb8da089 refactor s-tool init 2021-06-28 20:17:43 -07:00
Starbeamrainbowlabs 442cb8a8d8
Chat-Command-Reference: Update //maze3d docs 2021-06-28 02:09:16 +01:00
VorTechnix 8a57590179
fixed sfac description 2021-06-27 17:21:02 -07:00
Starbeamrainbowlabs 643790dc07
Merge pull request #64 from sbrl/selection-tools
sfactor and housekeeping
2021-06-28 01:08:10 +01:00
Starbeamrainbowlabs 1984c67295
Vector3, Face, Mesh: unconditionally return class 2021-06-28 01:00:38 +01:00
Starbeamrainbowlabs db7b20d485
Refactor table functions into subtable of wea
Also, you can return a value from dofile()!!!!

This changes everything.
2021-06-28 00:56:29 +01:00
VorTechnix 4f895f2da5 Add //sfac to Chat-Command-Reference.md 2021-06-27 16:25:15 -07:00
Starbeamrainbowlabs 624abc899b
node_distribution: add missing \n 2021-06-27 23:52:16 +01:00
Starbeamrainbowlabs 810d3049ee
format.make_ascii_table: make filename match function name 2021-06-27 23:52:05 +01:00
VorTechnix 590a6f3c3a Update CHANGELOG.md 2021-06-27 15:33:24 -07:00
VorTechnix 29bb6a0063 Merge branch 'main' into selection-tools 2021-06-27 15:22:55 -07:00
VorTechnix 5d28179bab remove release block 2021-06-27 15:11:57 -07:00
VorTechnix 79211cf8cb collapse check 2021-06-27 15:11:00 -07:00
VorTechnix df209a9f61 removed tests 2021-06-27 15:06:03 -07:00
VorTechnix 03093112bb added sfactor 2021-06-27 14:54:17 -07:00
VorTechnix d176cb5419 revised comments 2021-06-27 14:53:33 -07:00
VorTechnix 0b23f0174b added separate init.lua for selectors 2021-06-27 14:39:36 -07:00
VorTechnix e5044368b3 added .vdev folder for myself and gitignored it 2021-06-27 14:38:37 -07:00
VorTechnix 3467f9c5b6
fixed min and max 2021-06-26 21:39:16 -07:00
Starbeamrainbowlabs f32d8588e0
Add Mesh & Face classes for #59
Together, these classes provide a way to represent a mesh of faces
generated from the Minetest world. This way, the generation of a mesh
can be abstracted away from any potential output file writers, thereby
allowing for multiple different output file formats to be supported.
2021-06-26 22:03:55 +01:00
Starbeamrainbowlabs dbdf509d79
Add dofile for vector3 2021-06-26 19:48:32 +01:00
Starbeamrainbowlabs 65c07d59ea
Vector3: add sort, is_contained, expand_region, mean, min, and max 2021-06-26 17:48:39 +01:00
Starbeamrainbowlabs 91b77c981b
Vector3: add abs 2021-06-26 17:06:53 +01:00
Starbeamrainbowlabs 88214aef57
Vector3: add min_component, max_component 2021-06-26 17:02:35 +01:00
Starbeamrainbowlabs 0a3680aa7d
Vector3: add unit / normalise 2021-06-26 16:56:26 +01:00
Starbeamrainbowlabs c76a049286
Vector3: tweak 2021-06-26 16:47:22 +01:00
Starbeamrainbowlabs 112bb96e99
Vector3: add equals, equality operator 2021-06-26 16:28:39 +01:00
Starbeamrainbowlabs cfa086ce46
Vector3: add dot product 2021-06-26 15:47:53 +01:00
Starbeamrainbowlabs dc5645cfeb
Vector3: add set_to 2021-06-26 15:43:42 +01:00
Starbeamrainbowlabs 133cae587c
Vector3: add move_towards 2021-06-26 15:39:47 +01:00
Starbeamrainbowlabs 773e6354ad
Vector3: add limit_to 2021-06-26 15:32:47 +01:00
Starbeamrainbowlabs 6d0447a02f
Vector3: add clone 2021-06-26 15:23:16 +01:00
Starbeamrainbowlabs 7549b0eaea
Vector3: add length, length_squared, sqrt 2021-06-26 15:15:32 +01:00
Starbeamrainbowlabs cde3c3360c
Vector3: add snap_to 2021-06-26 14:44:40 +01:00
Starbeamrainbowlabs 8ae0d92e3d
Vector3/tests: flip assert orderings 2021-06-26 14:40:14 +01:00
Starbeamrainbowlabs 57df2d045f
Vector3: add area 2021-06-26 14:26:40 +01:00
Starbeamrainbowlabs 1e1112c34a
Vector3: Add round 2021-06-26 14:22:26 +01:00
Starbeamrainbowlabs 06e19248c7
Vector3: add floor/ceil 2021-06-26 14:19:18 +01:00
Starbeamrainbowlabs 9d197aefd2
Start implementing vector3.
Currently we have the 4 basic operations down, plus tostring.
2021-06-26 14:10:28 +01:00
Starbeamrainbowlabs 597f6d778f
docs/tutorial: Update links 2021-06-26 13:06:35 +01:00
Starbeamrainbowlabs bf71aae1d3
Docs/Reference: Remove arguments from command slugs 2021-06-26 13:03:42 +01:00
Starbeamrainbowlabs 5b26bbc0b8
Add release date for 1.12 2021-06-26 12:26:15 +01:00
Starbeamrainbowlabs b5c45533b7
README: Add cloud wand to quick reference 2021-06-26 12:20:31 +01:00
Starbeamrainbowlabs a403a55ac7
Changelog: tweak ordering 2021-06-26 12:13:33 +01:00
Starbeamrainbowlabs 1d096f7e8c
Prepare v1.12 release 2021-06-26 12:06:15 +01:00
Starbeamrainbowlabs bcc3f8e285
README: Update quick reference with //smake 2021-06-26 12:06:01 +01:00
Starbeamrainbowlabs 07579a2e75
Reference → //smake: Remove factor from operation 2021-06-26 11:56:49 +01:00
Starbeamrainbowlabs 401af8cc35
Reference: tweak //smake some more 2021-06-26 11:51:37 +01:00
Starbeamrainbowlabs 0aff7aa476
Reference: tidy up markdown etc 2021-06-26 02:35:11 +01:00
Starbeamrainbowlabs 25e6ff467c
//smake: describe operation & mode a bit better 2021-06-26 02:26:06 +01:00
Starbeamrainbowlabs 9ad3fd97d9
Implement //Smake (#61) 2021-06-26 02:19:55 +01:00
Starbeamrainbowlabs 90b456a687
Merge branch 'main' into vortechnix 2021-06-26 02:18:48 +01:00
Starbeamrainbowlabs afce954306
Test the rest of the sring polyfills 2021-06-26 02:17:49 +01:00
VorTechnix 3f96fa708f fixed a bug (trailing comma) 2021-06-25 18:15:43 -07:00
VorTechnix 851dde84f8 Merge branch 'vortechnix' of https://github.com/sbrl/Minetest-WorldEditAdditions into vortechnix 2021-06-25 18:12:33 -07:00
VorTechnix 16b7748ac6 some refactoring and commenting in smake 2021-06-25 18:12:30 -07:00
Starbeamrainbowlabs 6a42aa6838
Set out the basics of automated tests for str_padend 2021-06-26 02:05:01 +01:00
VorTechnix 2d6bd676d6
Update --remove tocharset testing tags
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-06-25 17:25:09 -07:00
VorTechnix a6a858046f
Update tochars.lua grammar
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-06-25 16:30:38 -07:00
VorTechnix a40b65af3e
Update --remove old tochars syntax
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-06-25 16:29:47 -07:00
VorTechnix e592e6746f smake documentation 2021-06-25 13:30:40 -07:00
VorTechnix 8be867b2eb Merge branch 'vortechnix' of https://github.com/sbrl/Minetest-WorldEditAdditions into vortechnix 2021-06-25 11:59:01 -07:00
VorTechnix 88c70ee233 restored indentation in torus.lua 2021-06-25 11:58:44 -07:00
VorTechnix 92c7d0447a
Fixed indentation in torus 2021-06-25 11:53:23 -07:00
VorTechnix fc8f76b9dc Merge branch 'main' into vortechnix 2021-06-25 11:43:30 -07:00
VorTechnix 70972f4084 //smake equal stable 2021-06-25 11:42:16 -07:00
VorTechnix 7c92c811e5 odd and even tested, stable 2021-06-22 17:32:24 -07:00
VorTechnix 99c0b26086 Update to smake, fixed odd 2021-06-22 09:41:05 -07:00
VorTechnix efef201fde //smake added 2021-06-22 09:33:49 -07:00
VorTechnix 5b6062017a formatting fix in cookbook 2021-06-21 14:56:03 -07:00
Starbeamrainbowlabs e12114ffcd
Fix bigbox on smallscreens 2021-06-21 16:23:35 +01:00
Starbeamrainbowlabs e5fe220698
docs: improve navbar a bit 2021-06-21 16:14:16 +01:00
Starbeamrainbowlabs 3ec4f6b2c7
docs: Fiddle with opengraph / twitter cards
Don't think Twitter likes the image, but Twitter has always been funny 
about images in Twitter cards.

Only time will tell if it's working as intended!
2021-06-21 01:18:03 +01:00
Starbeamrainbowlabs f0bafdcb64
Support smaller screens 2021-06-21 01:12:18 +01:00
Starbeamrainbowlabs 96a645c546
docs: Add favicon, twitteer cards etc, theme colour, hyperlink to title 2021-06-21 00:52:29 +01:00
Starbeamrainbowlabs 10677e279e
Add CI build script
....unfortunately my CI server is down right now though, so we're still 
running it manually for now.
2021-06-21 00:39:14 +01:00
VorTechnix 4f1c5c95da Merge branch 'main' into vortechnix 2021-06-20 15:40:27 -07:00
Starbeamrainbowlabs b72ba10ea3
README: Add new logo 2021-06-20 22:56:08 +01:00
Starbeamrainbowlabs e805f66681
Add awesome logo by @VorTechnix 2021-06-20 22:55:28 +01:00
Starbeamrainbowlabs 33e90ba6d7
Reference: Add note about output getting cut off to //count 2021-06-20 22:41:35 +01:00
Starbeamrainbowlabs 4a36ef7e17
docs: slight accessibility tweak 2021-06-20 22:18:24 +01:00
Starbeamrainbowlabs cd0bea7219
docs: Add background patterns 2021-06-20 22:16:27 +01:00
Starbeamrainbowlabs 142adc5beb
Add contributors to website 2021-06-20 21:48:30 +01:00
Starbeamrainbowlabs a7abeadb9d
docs: Write some more tutorial.
I think its pretty much finished for now, but it's difficult to know 
without someone reading it.....
2021-06-20 20:28:32 +01:00
Starbeamrainbowlabs 816eb6671a
Write a teeny bit mroe tutorial
bit by bit!
2021-06-20 18:04:56 +01:00
Starbeamrainbowlabs f009cce911
Add some notes to tutorial and reference 2021-06-20 02:27:47 +01:00
Starbeamrainbowlabs f04deaad15
Start writing the tutorial, but it's not finished yet 2021-06-20 02:22:25 +01:00
Starbeamrainbowlabs 4d24e4e884
docs: Add WorldEdit dependency to git installation instructions 2021-06-20 02:03:44 +01:00
Starbeamrainbowlabs 37195edb66
docs: tweak fallback background colour
On Ubuntu, this is also used as the background for the scrollbar I've 
just noticed, so useful to set.
2021-06-20 01:53:51 +01:00
Starbeamrainbowlabs 9232b79925
docs: Spruce up reference page
It looks much fancier now :D
2021-06-20 01:51:55 +01:00
Starbeamrainbowlabs cc20fb499d
Apply css based on aria-current, but I'm not happy with it yet 2021-06-19 18:27:02 +01:00
Starbeamrainbowlabs ed5f583e04
Add content-generic layout and cookbook 2021-06-19 18:20:05 +01:00
Starbeamrainbowlabs 5362c8956e
Add ContentDB image 2021-06-19 18:14:23 +01:00
Starbeamrainbowlabs 1dcfc22f7a
docs: add npm start script 2021-06-19 17:49:20 +01:00
Starbeamrainbowlabs ce41e8bc55
Add getting started section
Todo:

Completely revise the changelog / reference to use data & dynamicness, 
because we want to group headings into <section /> elements. That way it 
makes it *much* easier to implement a search feature, and also style it 
nicely too
2021-06-14 02:25:45 +01:00
Starbeamrainbowlabs 70b6adaa0d
Improve handling of PNGs, add background image 2021-06-14 01:36:13 +01:00
Starbeamrainbowlabs 4fff388656
docs: Add next (final?) section of website
Next up: fine tuning
2021-06-13 23:34:38 +01:00
Starbeamrainbowlabs dcc66f2bd0
docs: Add badges to top of page 2021-06-13 22:37:07 +01:00
Starbeamrainbowlabs 79d7712740
Add comment to top of gallerybox 2021-06-12 14:39:06 +01:00
Starbeamrainbowlabs f01fee3699
Tweak description 2021-06-09 00:35:39 +01:00
Starbeamrainbowlabs 8a500735c0
Implement a css-only gallery, with descriptions!
It's an absolutely *glorious* series of hacks :D

Including, but certainly not limited to:

 - CSS Grids with only 1 cell
 - Flexboxes used for positioning text nodes
 - Element heights set indirectly with the width property
 - z-index abused to show the current image in the sequence


it's undefined which image will be shown initially, but given the amount 
of effort this took I'm ok with that

If anyone knows how  to shift the <picture> element 0.25em upwards 
*without* moving the image so that I can remove the upper and lower 
borders, I'd lvoe to know. I've tried everything - including settingit's 
height to zero etc. In the end I've padded out the top to balance it out 
instead :P
2021-06-09 00:34:25 +01:00
Starbeamrainbowlabs b88080a698
Remove CSSBox
We're going to implement our own
2021-06-08 21:17:53 +01:00
Starbeamrainbowlabs 85e5eb3971
docs website: Add bigbutton 2021-06-07 01:28:11 +01:00
Starbeamrainbowlabs 66234cdeae
Minor styling to footer; change heart to emoji 2021-06-06 23:39:00 +01:00
VorTechnix 7553163e11 split tochars to separate file 2021-06-03 10:02:17 -07:00
VorTechnix 622ea7a683 added worldeditadditions.tochars 2021-06-02 21:29:36 -07:00
VorTechnix 3c7cd38459 initialized worldeditadditions.tables 2021-06-02 19:27:23 -07:00
VorTechnix 3dff6fe66c added PARSE header 2021-06-02 19:27:04 -07:00
VorTechnix 0026bcdab7 added sets.lua, reordered dofiles in /tables/init.luas 2021-06-02 19:18:49 -07:00
VorTechnix 38335e291f Merge branch 'main' into vortechnix 2021-06-02 18:03:16 -07:00
VorTechnix 8bffeda5b5 Merge branch 'main' into vortechnix 2021-06-02 17:59:06 -07:00
Starbeamrainbowlabs 1f44e240fb
utils/tables: refactor into separate files
..it was getting rather long, because Lua doesn't exactly come with 
batteries included :-/
2021-06-03 01:57:46 +01:00
Starbeamrainbowlabs 78e6ebe4ae
It does actually work! It's just the gallery that doesn't support the <picture> element. 2021-05-31 21:08:07 +01:00
Starbeamrainbowlabs 722912a0c2
Work on images, but it leaves a lot to be desired
....we'll have to reimplement Image.generateHTML :-/
2021-05-31 21:06:17 +01:00
VorTechnix 21217f20df unified examples and credits 2021-05-31 10:46:59 -07:00
VorTechnix 75c998f369 ellipsoid parse tweak 2021-05-31 08:43:42 -07:00
VorTechnix 830e5f0d53 CHANGELOG update, //ellipsoid hollow keyword 2021-05-30 21:04:13 -07:00
Starbeamrainbowlabs 117002f9e9
Start working on documentation website, but it's not finished yet 2021-05-31 02:20:23 +01:00
Starbeamrainbowlabs 9cb746e86a
noise: add comment 2021-05-31 00:38:07 +01:00
Starbeamrainbowlabs 9c4e23daa8
//floodfill: fix error handling 2021-05-31 00:38:01 +01:00
VorTechnix 5a1fecedd4 Update to //ellipsoid documentation and README 2021-05-30 15:34:59 -07:00
VorTechnix 956fc5370a Ellipsoid parsing overhaul with hollow option addition 2021-05-30 15:29:14 -07:00
VorTechnix 6e04b11e18 added vector.abs 2021-05-30 14:34:57 -07:00
Starbeamrainbowlabs de8b35dfee
.gitignore: ignore lua, node.js 2021-05-30 20:34:10 +01:00
Starbeamrainbowlabs 9325f19de2
screenshot.png: optimise with oxipng 2021-05-30 20:34:00 +01:00
VorTechnix 8884c938e0 Merge branch 'main' into vortechnix 2021-05-30 09:35:41 -07:00
Starbeamrainbowlabs 5083ea05ca
Start on #55, but because Minetest blocks our read attempts to Chat-Command-Reference (symlinks don't help), we can't continue this 2021-05-30 16:18:08 +01:00
Starbeamrainbowlabs 0474f5a0ee
wea.table_filter: also pass i as the 2nd argument 2021-05-30 16:17:19 +01:00
Starbeamrainbowlabs 8bc2e543da
polyfill str_starts: make less dense and mroe readable 2021-05-30 13:06:47 +01:00
Starbeamrainbowlabs 2f18e9d4ab
Chat command reference: tiny tweak to //erode river 2021-05-30 02:12:46 +01:00
Starbeamrainbowlabs 7ca3f26208
README: Fix //erode hyperlink 2021-05-30 02:11:27 +01:00
Starbeamrainbowlabs 9b53b73bc9
//erode river: Update docs,rename some parameters for consistency 2021-05-30 02:09:52 +01:00
Starbeamrainbowlabs af1c1decb0
README: master → main 2021-05-30 01:47:05 +01:00
Starbeamrainbowlabs 74bde4e60c
//erode river: comment debug
...we might need them again in the future
2021-05-30 01:44:00 +01:00
Starbeamrainbowlabs ccf27c8629
Bugfix new //erode river implementation
next stop: docs!
2021-05-30 01:42:06 +01:00
Starbeamrainbowlabs dc7ccf49f3
wea.parse.map: support bools 2021-05-30 01:40:18 +01:00
Starbeamrainbowlabs 0498125ca7
Bugfix table_map: avoid infinite loop 2021-05-30 00:12:13 +01:00
Starbeamrainbowlabs a5c6e82ef3
Bugfix table_map: return result 2021-05-30 00:11:13 +01:00
Starbeamrainbowlabs 00a60eba17
//erode → river: Change only 1 height at a time for extra granularity
this also simplifies it a bit too
2021-05-30 00:04:01 +01:00
Starbeamrainbowlabs 9ecdd01914
//erode: initial river algorithm implementation 2021-05-30 00:02:21 +01:00
Starbeamrainbowlabs 17b8f8a555
erode/snowballs: correct comment 2021-05-29 23:20:34 +01:00
Starbeamrainbowlabs a8ddc7831a
wea.table_filter: add API function
Really, Lua should have this already. At this rate, I'll be implementing 
the entire Javascript standard library... :P
2021-05-29 23:20:11 +01:00
Starbeamrainbowlabs b23f353b19
wea.min, wea.max: add API functions 2021-05-29 23:13:10 +01:00
Starbeamrainbowlabs c7c6a848dc
wea.table_unique(): Add API function 2021-05-29 22:49:50 +01:00
Starbeamrainbowlabs 8eb9a8ed0f
wea.table_map(): Add api function 2021-05-29 22:49:35 +01:00
Starbeamrainbowlabs 1e677c1f3f
wea.split: Standardise comment 2021-05-29 22:49:14 +01:00
Starbeamrainbowlabs f7ecb84da4
Add original screenshot as screenshot2.png 2021-05-29 02:34:29 +01:00
Starbeamrainbowlabs 82f273e19e
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions into main 2021-05-29 02:31:39 +01:00
Starbeamrainbowlabs 0b02ce90af
Changelog: update links 2021-05-29 02:31:29 +01:00
VorTechnix 96b408f575 repoint master links to main 2021-05-28 17:40:01 -07:00
VorTechnix 4d1295ddcd Update screenshot.png 2021-05-28 17:34:09 -07:00
VorTechnix d7ee9545b9 Update screenshot.png 2021-05-28 17:32:42 -07:00
Starbeamrainbowlabs dcc8b2d6f4
Changelog: add more information link about { curly brace } syntax 2021-05-29 01:18:40 +01:00
Starbeamrainbowlabs ffdef17761
//multi: add { curly brace } syntax support for grouping blocks of commands 2021-05-29 01:17:24 +01:00
Starbeamrainbowlabs 98a04b12db
tokenise_commands: fix ordering 2021-05-29 00:57:42 +01:00
Starbeamrainbowlabs 46eaf10884
tokenise_commands: improve comments 2021-05-29 00:54:30 +01:00
Starbeamrainbowlabs 50da328c67
fixup 2021-05-29 00:44:17 +01:00
Starbeamrainbowlabs a937740275
Implement tokenise_commands utility function
This function is intended for use in //multi.
2021-05-29 00:43:09 +01:00
Starbeamrainbowlabs e111decd3a
//multi: reduce code duplication 2021-05-28 21:10:23 +01:00
Starbeamrainbowlabs 87b7254350
erode: add future comment 2021-05-22 02:36:56 +01:00
Starbeamrainbowlabs 75a5f14f01
//erode snowballs: Fix assignment to global variable; slightly refactor changelog
Sincce we've got a number of bugfixes here and the changelog is getting 
a bit longer, I've split bugfixes up.
2021-05-22 01:39:59 +01:00
VorTechnix 93f9a655cd fillcaves note 2021-05-21 11:17:44 -07:00
VorTechnix 9776fc8539 Merge branch 'main' into vortechnix 2021-05-21 10:40:28 -07:00
VorTechnix 912371f5b6 Update torus and hollow torus entries in README 2021-05-21 10:04:10 -07:00
VorTechnix 912ecf09c2 Merge branch 'main' into vortechnix 2021-05-21 09:21:17 -07:00
Starbeamrainbowlabs ff29f9b168
Clarify //fillcaves usage in chat command reference.
Fixes #50.
2021-05-21 02:29:50 +01:00
Starbeamrainbowlabs 4382e0edeb
Update changelog about fixed crash 2021-05-21 02:12:25 +01:00
Starbeamrainbowlabs e3e5710217
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions into main 2021-05-21 02:11:11 +01:00
Starbeamrainbowlabs 97aa24bcd3
wea.parse.weighted_nodes: comment out debug 2021-05-21 02:11:03 +01:00
Starbeamrainbowlabs 6d6252b2c3
Chat comment reference: elaborate on new //torus changes 2021-05-18 15:23:50 +01:00
Starbeamrainbowlabs 5d2df22c0a
CHANGELOG: Small tweaks 2021-05-18 15:23:50 +01:00
VorTechnix 639c2061ef
Bugfix/torus: fix hollow implementation; improve clarity 2021-05-18 15:22:52 +01:00
VorTechnix 45d5f74d0a
Changelog: add note about hollow keyword 2021-05-18 15:20:15 +01:00
VorTechnix d0fdc62d3d
Reference: Add hollow keyword 2021-05-18 15:19:42 +01:00
VorTechnix 313ab6e62a
torus update 2021-05-18 14:57:50 +01:00
VorTechnix 0a44992676
reference: add hollow example to torus 2021-05-18 14:56:19 +01:00
VorTechnix 2b02f9ff2e
Fix typos in comments 2021-05-18 14:55:43 +01:00
VorTechnix 184ca1a328 recovery 2021-05-17 21:12:46 -07:00
VorTechnix d4b457f85d
Merge branch 'main' into vortechnix 2021-05-17 20:45:28 -07:00
VorTechnix 0ca9ed30bc Update torus.lua 2021-05-17 20:33:08 -07:00
VorTechnix cb841bfb80 Update torus.lua 2021-05-17 18:57:51 -07:00
VorTechnix 7defe829c3 Revert "Merge branch 'main' of https://github.com/sbrl/Minetest-WorldEditAdditions into main"
This reverts commit d9069b3cfa, reversing
changes made to 35eeb918d0.
2021-05-17 18:49:07 -07:00
VorTechnix d7f328c65b Revert "Update torus.lua"
This reverts commit 35eeb918d0.
2021-05-17 18:47:34 -07:00
VorTechnix ec1623b230 Merge branch 'main' into vortechnix 2021-05-17 17:40:36 -07:00
VorTechnix 3988e947df Update CHANGELOG.md 2021-05-17 17:38:42 -07:00
VorTechnix 79253b2ce5 Update Chat-Command-Reference.md 2021-05-17 17:26:24 -07:00
VorTechnix 1fda285e39 torus update 2021-05-17 17:24:04 -07:00
VorTechnix 5b893901dc //torus update 2021-05-17 17:16:04 -07:00
VorTechnix 9bb9aeda5c Update torus.lua 2021-05-17 11:18:09 -07:00
VorTechnix 63d284b35b axes + safeguards 2021-05-17 10:41:52 -07:00
VorTechnix d9069b3cfa Merge branch 'main' of https://github.com/sbrl/Minetest-WorldEditAdditions into main 2021-05-17 09:14:55 -07:00
VorTechnix 35eeb918d0 Update torus.lua 2021-05-17 09:13:43 -07:00
Starbeamrainbowlabs 57ff577694
torus: add comment 2021-05-15 02:18:41 +01:00
Starbeamrainbowlabs bf8c847dc1
torus: fix and improve the error messages 2021-05-15 02:15:14 +01:00
Starbeamrainbowlabs 0100725a7b
torus: finish rework 2021-05-15 02:09:43 +01:00
Starbeamrainbowlabs 3fbfc1fb15
torus: rework to add axes, but it's not finished yet 2021-05-15 02:00:40 +01:00
Starbeamrainbowlabs 4d080853d4
reference: add notes about chances 2021-05-11 22:38:17 +01:00
Starbeamrainbowlabs 8eaa76c752
Update changelog 2021-05-11 22:32:09 +01:00
Starbeamrainbowlabs 4e544c555c
replacemix: add support for wea.parse.chance
TODO: use wea.parse.weighted_nodes

The problem here is that we have a target_node with an optional chance 
too, so a finite state machine is needed to parse it currently

Once we've extracted the target_node and it's optional chance though, we 
should be able to use wea.parse.weighted_nodes in theory
2021-05-11 22:29:15 +01:00
Starbeamrainbowlabs ea05d5f559
bonemeal: use wea.parse.chance 2021-05-11 22:20:29 +01:00
Starbeamrainbowlabs f9eb67b4cc
bonemeal: Try bonemealing everything that isn't an air block
fixes #49
2021-05-11 22:17:10 +01:00
Starbeamrainbowlabs 81f3a87180
wea.parse.chance: add weight mode 2021-05-11 22:12:04 +01:00
Starbeamrainbowlabs 040d7fbfde
wea.parse.chance: use not 2021-05-11 21:59:43 +01:00
Starbeamrainbowlabs 4ec04c03b3
worldeditadditions.parse.chance: add API function 2021-05-11 21:55:44 +01:00
Starbeamrainbowlabs efd8a8682e
.gitignore: git ignore git 2021-05-11 21:42:25 +01:00
Starbeamrainbowlabs 8d7d54c8ff
Merge branch 'main' of github.com:sbrl/Minetest-WorldEditAdditions into main 2021-05-11 21:41:38 +01:00
Starbeamrainbowlabs 11fbe5e153
reference: fix typo 2021-05-11 21:41:31 +01:00
VorTechnix 3c3ea2dcce Update .gitignore 2021-05-11 12:59:59 -07:00
Starbeamrainbowlabs 74190e2031
teensy layout fix 2021-03-20 02:22:04 +00:00
Starbeamrainbowlabs d6d11c6b1a
README: Update quick reference 2021-03-20 02:17:56 +00:00
Starbeamrainbowlabs aa3f89c097
Update changelog 2021-03-20 02:11:38 +00:00
Starbeamrainbowlabs 8ba3babf92
Tweak changelog 2021-03-20 02:11:13 +00:00
Starbeamrainbowlabs 7639bd2c2b
worldeditadditions.apply_heightmap_changes: properly comment it
It's a pretty complicated function, so it's probably a good idea to 
document how it works.
2021-03-20 02:09:28 +00:00
Starbeamrainbowlabs 1f273e4b13
comment worldeditadditions.eta 2021-03-20 01:56:14 +00:00
Starbeamrainbowlabs 6af8bba987
selector_helps → axes
It makes sense to me at least that we should keep stuff to do with 
parsing axes together.
2021-03-20 01:53:01 +00:00
Starbeamrainbowlabs 8877e356f0
refactor: refactor utils/strings.lua into multiple files 2021-03-20 01:48:56 +00:00
Starbeamrainbowlabs c6ed5278cc
Merge pull request #48 from VorTechnix/master
scloud, scentre and srel
2021-03-19 23:31:43 +00:00
VorTechnix 866748a5c3 dir function rename 2021-03-19 16:25:26 -07:00
VorTechnix 134d2b0999 Update .gitignore 2021-03-19 13:35:21 -07:00
VorTechnix a027130917
Merge pull request #5 from sbrl/main
Updates + noise
2021-03-18 17:31:34 -07:00
VorTechnix d4edeaeff7 renamed translation function 2021-03-18 09:37:53 -07:00
VorTechnix 60fb4f1b57 Update Chat-Command-Reference.md 2021-03-17 18:55:19 -07:00
VorTechnix 4c4c7809b0 update changelog 2021-03-17 18:51:37 -07:00
VorTechnix ad05b2ac4d chat command update 2021-03-17 18:29:16 -07:00
Starbeamrainbowlabs 9bda3bf05a
README: add installation instructions
for #46.
2021-03-17 22:04:09 +00:00
Starbeamrainbowlabs c10880f9ff
README: add news note 2021-03-17 21:38:36 +00:00
VorTechnix 00b9a1f517 srel stable? 2021-03-17 11:36:12 -07:00
Starbeamrainbowlabs a1911037d2
Fill out noise.make_2d, but it's untested
Next, we need to do the make_3d version, followed by the plumbing to 
worldeditadditions.noise(), followed by the chat command

....there's a lot to do.
2021-03-16 21:39:12 +00:00
VorTechnix 20a879a7af scentre and some sorting 2021-03-15 20:51:23 -07:00
Starbeamrainbowlabs 237c4839c8
Merge branch 'master' of github.com:sbrl/Minetest-WorldEditAdditions 2021-03-16 00:18:41 +00:00
Starbeamrainbowlabs 3c4f8e463b
README: ultimate final say 2021-03-15 23:37:46 +00:00
Starbeamrainbowlabs 683a742fe2
Merge pull request #44 from VorTechnix/master
//scloud and cloud wand refactor
2021-03-13 12:11:27 +00:00
VorTechnix 0b55863d55
scloud.lua second typo fix
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-03-12 19:26:38 -08:00
VorTechnix 18347f93bf wea.selection declared 2021-03-12 18:11:43 -08:00
VorTechnix c39fc1c9e8 Removed unneeded local 2021-03-12 18:09:24 -08:00
VorTechnix 5ffa67b7ac refactor func names, move punchnode function 2021-03-12 18:01:17 -08:00
VorTechnix f79871e5d1
cloudwand.lua rename
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-03-12 17:55:59 -08:00
VorTechnix 39f82c99ca
scloud.lua params change
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-03-12 17:55:10 -08:00
VorTechnix f95d7622c7
scloud.lua cosmetics
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-03-12 17:09:57 -08:00
VorTechnix 4777b93f60
scloud.lua error return fix
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-03-12 17:06:15 -08:00
VorTechnix cc20297b88
scloud.lua typo fix
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-03-12 17:03:37 -08:00
Starbeamrainbowlabs d20764cffd
Add pure Lua perlin implementation, but it's untested. 2021-03-13 00:37:26 +00:00
VorTechnix 3df23e8086 scloud and cloud wand refactor 2021-03-12 15:47:10 -08:00
Starbeamrainbowlabs 9c02ffbd04
README: update quick reference 2021-03-11 21:04:02 +00:00
Starbeamrainbowlabs 008a559854
Merge pull request #42 from VorTechnix/master
//scube, //scol, vectors and vector population, and bulletproofing
2021-03-11 21:01:55 +00:00
VorTechnix 97f8d551cd Merge branch 'master' of https://github.com/VorTechnix/Minetest-WorldEditAdditions 2021-03-11 12:59:07 -08:00
VorTechnix 53d899b3fe commented tmp 2021-03-11 12:59:04 -08:00
VorTechnix f0f6fe3765
Merge pull request #4 from sbrl/master
multi many multi bug fix
2021-03-10 21:34:37 -08:00
VorTechnix ff9abded2e localize wea 2021-03-10 20:56:38 -08:00
VorTechnix bdb51ff944
Fix Typo
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-03-10 18:44:27 -08:00
Starbeamrainbowlabs 7774f8538c
Update changelog
fixes #41
2021-03-11 02:05:11 +00:00
Starbeamrainbowlabs 48619163d5
//multi: gracefully handle empty invocations; ensure args is always set
if it isn't found via the :find() call, then set it to an empty string.
This prevents crashes where the callee expects to be passed a string
2021-03-11 02:04:22 +00:00
VorTechnix cbd07aee4f scube and vector population 2021-03-10 13:21:33 -08:00
VorTechnix 234e0a1325 simplified scol 2021-03-09 11:19:47 -08:00
VorTechnix a671f742e9 scol and srect refactor 2021-03-09 11:05:03 -08:00
VorTechnix 786a9454ff
Merge pull request #3 from sbrl/master
vector.floor: add resilience
2021-03-09 11:02:09 -08:00
Starbeamrainbowlabs 587d430e48
vector.floor: add resilience 2021-03-09 18:45:04 +00:00
VorTechnix 7f6c8e146e
Merge pull request #2 from sbrl/master
Selection Saving Beta
2021-03-01 20:44:25 -08:00
Starbeamrainbowlabs 3cc1e120aa
Changelog: add small note 2021-03-02 00:24:27 +00:00
Starbeamrainbowlabs feb4d6a4bf
//overlay: Don't place nodes above water
Fixes #38
2021-03-02 00:09:46 +00:00
Starbeamrainbowlabs 093a4823bb
Update docs for //sstack, //spush, and //spop 2021-03-01 22:34:06 +00:00
Starbeamrainbowlabs e8d97959b2
Add //spush, //spop, and //sstack 2021-03-01 22:23:36 +00:00
VorTechnix 7f4ebb8b8d
Merge pull request #1 from sbrl/master
Update 2.2
2021-03-01 13:27:35 -08:00
Starbeamrainbowlabs 108c280843
Start laying out stuff for our noise experiment, but it isn't hooked up yet and isn't finished. 2021-03-01 21:26:33 +00:00
Starbeamrainbowlabs e9e7df73b2
Cookbook: Add @VorTechnix's suggestions
Fixes #37.
2021-03-01 21:26:09 +00:00
Starbeamrainbowlabs 7633923911
Update readme & changelog 2021-03-01 21:17:18 +00:00
Starbeamrainbowlabs 8cce699313
srect: minor formatting tidyup 2021-03-01 21:16:23 +00:00
Starbeamrainbowlabs 9f01703744
Chat Command Reference: add sectiono on srect 2021-03-01 21:14:33 +00:00
Starbeamrainbowlabs e1755ce8e1
srect: localify parsing function 2021-03-01 21:08:32 +00:00
Starbeamrainbowlabs 2acc6b3470
Merge pull request #34 from VorTechnix/master
Added //srect and //basename
2021-03-01 20:54:13 +00:00
VorTechnix 12e5be8da6 stable axis1 processing 2021-02-28 11:59:46 -08:00
VorTechnix 727ee41e72 Simplify srect function 2021-02-28 09:59:09 -08:00
VorTechnix 0c4736fbc2
Debugging returns
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-02-28 09:56:39 -08:00
VorTechnix e82c8b1e81
error handling
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2021-02-28 07:25:31 -08:00
VorTechnix b31b005bdd -axyzb patch 2021-02-26 08:23:10 -08:00
VorTechnix cb1d54c665 Added getsign, fixed srect glitch 2021-02-25 20:22:39 -08:00
Starbeamrainbowlabs a9603e29ec
README: mark //scale as experimental 2021-02-26 02:44:09 +00:00
Starbeamrainbowlabs 1034e592bd
Update changelog 2021-02-26 02:36:35 +00:00
Starbeamrainbowlabs eae005dc36
Prepare v1.11 release 2021-02-26 02:35:52 +00:00
Starbeamrainbowlabs 56380f149b
heightmap_size: refactor to use { x, z } instead of [0] / [1] 2021-02-26 02:20:53 +00:00
Starbeamrainbowlabs 756bd49470
//scale: remove debug statement 2021-02-25 22:52:47 +00:00
VorTechnix b62e4f706d added description 2021-02-24 19:42:24 -08:00
VorTechnix f6ed297270 indentation fixes 2021-02-24 19:35:20 -08:00
VorTechnix 1d93122801 basename error handling 2021-02-24 09:19:08 -08:00
VorTechnix 191f1385b1 fixed modulo 2021-02-24 09:08:49 -08:00
VorTechnix 489d856176 Added srect and basename
Also moved saplingaliases and corrected the block text in forest.lua
2021-02-24 08:40:53 -08:00
Starbeamrainbowlabs a0c20a1503
farwand: add too far away message
It works fabulously for the cloud wand, so let's add it to the far wand 
too
2021-02-23 23:10:45 +00:00
Starbeamrainbowlabs 478d1269a1
cloud wand: send chat message when clearing region 2021-02-23 23:06:44 +00:00
Starbeamrainbowlabs 566b370960
Add cloud wand to README & changelog 2021-02-23 23:04:32 +00:00
Starbeamrainbowlabs a6b34f9311
Update chat command reference 2021-02-23 23:01:17 +00:00
Starbeamrainbowlabs 78572e453e
Implement point cloud wand 2021-02-23 22:56:56 +00:00
Starbeamrainbowlabs f2aa87b396
terrain: pick the node to replace with from higher up in the column in question
....unless we hit the ignore node, in which case we default to air.
2021-02-23 01:31:24 +00:00
Starbeamrainbowlabs 4ba59a6ec3
//conv, //erode: treat liquids as air 2021-02-23 00:20:57 +00:00
Starbeamrainbowlabs aef4fe4380
fillcaves: treat liquids as air 2021-02-23 00:19:24 +00:00
Starbeamrainbowlabs ee3effd458
//subdivide: fix passing arguments to the command being executed 2021-02-21 15:19:21 +00:00
Starbeamrainbowlabs d2a1913e90
README: Add link for //scale 2021-02-20 17:15:20 +00:00
Starbeamrainbowlabs 553dfdd658
reference: add note about clarity 2021-02-20 16:59:12 +00:00
Starbeamrainbowlabs 5808afe035
reference: document //scale 2021-02-20 16:57:53 +00:00
Starbeamrainbowlabs 523fa856e0
Add tiny note to contributing 2021-02-18 02:49:46 +00:00
Starbeamrainbowlabs 4368f74e30
Fix directionality in worldedit region update when scaling down 2021-02-18 02:33:26 +00:00
Starbeamrainbowlabs b2b3f5bec5
Update changelog 2021-02-18 02:21:19 +00:00
Starbeamrainbowlabs 3f871e01f5
//scale: fix more bugs, and also update the worldedit region after scaling 2021-02-18 02:18:34 +00:00
Starbeamrainbowlabs a63923fec9
//scale: scaling up works! Can't say the same about scaling down though, but that will come in time. 2021-02-18 01:24:53 +00:00
Starbeamrainbowlabs ed3adde56a
//scale: fix some bugs, and rename direction → anchor internally
It's nice to have some consistency, and find&replace saves soooo much 
time :P
2021-02-18 00:30:24 +00:00
Starbeamrainbowlabs 17a67fc5f9
Merge branch 'master' of github.com:sbrl/Minetest-WorldEditAdditions 2021-02-17 23:46:11 +00:00
Starbeamrainbowlabs 2a268d9ff8
Implement scale_up
Next up: testing!
2021-02-17 23:46:03 +00:00
Starbeamrainbowlabs 756c1c12f2
scale_down: fix a number of runtime errors
Note that we still haven't tested it :P
2021-02-17 23:09:25 +00:00
Starbeamrainbowlabs e19df51916
Merge pull request #29 from bl-ue/fix-typos-020821
Fix typos
2021-02-12 21:47:04 +00:00
bl-ue 1d3c2a0416 Fix typos 2021-02-09 19:53:30 -05:00
Starbeamrainbowlabs 0d5e71eb4f
Merge pull request #28 from bl-ue/patch-1
Fix a typo
2021-02-09 22:34:07 +00:00
Starbeamrainbowlabs 4ea69f910a
chat command reference: finish sentence 2021-02-09 22:29:39 +00:00
bl-ue 679de9d591
Fix a typo 2021-02-08 10:09:17 -05:00
Starbeamrainbowlabs ad9e5a26b1
Start working on //scale, but it isn't finished yet. 2021-02-07 23:39:09 +00:00
Starbeamrainbowlabs 03afd7e75c
//subdivide: comment out debug statements
....we're pretty sure what the issue is, and our server on elessar 
doesn't even emit them
2021-02-07 03:13:02 +00:00
Starbeamrainbowlabs 555058b4ac
//subdivide: tweak update message display 2021-02-07 03:12:09 +00:00
Starbeamrainbowlabs 1179ecb19a
//subdivide: cosmetic change to update messages 2021-02-07 02:59:41 +00:00
Starbeamrainbowlabs 151afadf6c
//many: fix running commands that take no arguments 2021-02-07 02:59:19 +00:00
Starbeamrainbowlabs a360f06138
Fix eta calculations 2021-02-07 02:45:34 +00:00
Starbeamrainbowlabs 2b29334d82
Update changelog 2021-02-07 02:02:02 +00:00
Starbeamrainbowlabs 9d76c5d98a
wea.eta: fix obscure edge case 2021-02-07 01:37:50 +00:00
Starbeamrainbowlabs 2f5c1b759d
//subdivide: fix undefined variable; update reference 2021-02-07 01:35:06 +00:00
Starbeamrainbowlabs 888ee04f9d
//subdivide: fix a number of other issues 2021-02-07 01:28:07 +00:00
Starbeamrainbowlabs edb80d7478
//subdivide: fix debug logging 2021-02-07 01:07:21 +00:00
Starbeamrainbowlabs 122ff381f1
//subdivide: debug logging 2021-02-07 01:02:03 +00:00
Starbeamrainbowlabs 15417354c6
//subdivide: fix undefined local variable 2021-02-06 19:34:46 +00:00
Starbeamrainbowlabs ac954abaea
//subdivide: tweak outut 2021-02-06 14:34:30 +00:00
Starbeamrainbowlabs 9dffb17f3d
update changelog 2021-02-06 00:48:10 +00:00
Starbeamrainbowlabs ebed73fc49
//subdivide: fix emerge_area to only emerge individual chunked areas 2021-02-05 23:44:33 +00:00
Starbeamrainbowlabs 38e5c81d33
//subdivide: tally total times so far as we go
- Don't use wea.sum() on a table full of all the times we've recorded
   so far
 - Limit individual stats list lengths to 25 to avoid memory issues when
   running with a large number of chunks
 - Tally total times / metrics as we go to avoid memory issues
2021-02-03 03:04:33 +00:00
Starbeamrainbowlabs 25e659321a
//subdivide: reimplement count_chunks
this does the maths properly, so we'e going from O(n³) to O(1) :D

//subdivide should get started *so much faster* now :D
2021-02-03 02:25:33 +00:00
Starbeamrainbowlabs 85a715a0ea
wea.emerge_area: remove debug prints 2021-02-03 00:45:54 +00:00
Starbeamrainbowlabs a511d85e29
human_time: correctly handle non-number inputs 2021-02-03 00:44:42 +00:00
Starbeamrainbowlabs 39a7168ac8
add modpack.conf
If we see weirdness, it's probably because fo this file.

NOTE TO SELF: Don't forget that the new modpack.conf contains our 
dependencies list too!
2021-02-01 03:18:41 +00:00
Starbeamrainbowlabs e8584c4ec6
hollow: fix undefined variable 2021-01-31 21:30:13 +00:00
Starbeamrainbowlabs 6896a9bdd4
fixup 2021-01-31 20:14:40 +00:00
Starbeamrainbowlabs 8c47e05e52
//maze, //maze3d: fix docs 2021-01-31 20:12:07 +00:00
Starbeamrainbowlabs 9bd909b25e
add link to another blog post 2021-01-31 20:09:58 +00:00
Starbeamrainbowlabs 263bb4fa8b
chat command reference: fix levels of headings 2021-01-31 20:08:44 +00:00
Starbeamrainbowlabs c627ea224c
Update docs about //hollow 2021-01-31 20:08:09 +00:00
Starbeamrainbowlabs 0f4d95fc01
//hollow: fix parsing logic 2021-01-31 19:59:38 +00:00
Starbeamrainbowlabs 0be205dae7
Start implementing //hollow, but it isn't finished yet 2021-01-31 18:03:07 +00:00
Starbeamrainbowlabs f19a897a9e
Update changelog 2021-01-31 17:45:08 +00:00
Starbeamrainbowlabs 4b1cf074d5
//count: make numbers human-readable
Fixes #14
2021-01-31 17:43:08 +00:00
386 changed files with 24606 additions and 1825 deletions

140
.docs/.eleventy.js Normal file
View File

@ -0,0 +1,140 @@
"use strict";
const os = require("os");
const fs = require("fs");
const path = require("path");
const debug = require("debug");
const htmlentities = require("html-entities");
const phin = require("phin");
const CleanCSS = require("clean-css");
const { minify: minify_html } = require("html-minifier-terser");
const HTMLPicture = require("./lib/HTMLPicture.js");
const FileFetcher = require("./lib/FileFetcher.js");
const file_fetcher = new FileFetcher();
const is_production = typeof process.env.NODE_ENV === "string" && process.env.NODE_ENV === "production";
var nextid = 0;
const image_filename_format = (_id, src, width, format, _options) => {
const extension = path.extname(src);
const name = path.basename(src, extension);
return `${name}-${width}w.${format}`;
};
async function shortcode_image(src, alt) {
return HTMLPicture(
src, alt,
`./_site/img`, `/img`
);
}
async function shortcode_image_url(src) {
const src_parsed = path.parse(src);
const target = path.join(`./_site/img`, src_parsed.base);
if(!fs.existsSync(path.dirname(target)))
await fs.promises.mkdir(target_dir, { recursive: true });
await fs.promises.copyFile(src, target);
return path.join(`/img`, src_parsed.base);
}
async function shortcode_image_urlpass(src) {
let target_dir = `./_site/img`;
if(!fs.existsSync(target_dir))
await fs.promises.mkdir(target_dir, { recursive: true });
let filename = path.basename(src);
// Generally speaking we optimise PNGs *very* well with oxipng/Zopfli,
// and the Image plugin doesn't respect this
await fs.promises.copyFile(src, path.join(target_dir, filename));
return `/img/${filename}`;
}
async function shortcode_gallerybox(content, src, id_this, id_prev, id_next) {
return `<figure class="gallerybox-item" id="${id_this}">
<!-- ${await shortcode_image(src, "", "gallerybox-thumb", "300w")} -->
${await shortcode_image(src, "", "", "1920w")}
<figcaption>${content}</figcaption>
<a class="gallerybox-prev" href="#${id_prev}"></a>
<a class="gallerybox-next" href="#${id_next}"></a>
</figure>`;
}
async function fetch(url) {
return (await phin({
url,
headers: {
"user-agent": `WorldEditAdditionsStaticBuilder/${pkg_obj.version} (Node.js/${process.version}; ${os.platform()} ${os.arch()}) eleventy/${pkg_obj.devDependencies["@11ty/eleventy"].replace(/\^/, "")}`
},
followRedirects: true,
parse: "string"
})).body;
}
function fetch_file(url) {
return file_fetcher.fetch_file(url);
}
function do_minify_css(source, output_path) {
if(!output_path.endsWith(".css") || !is_production) return source;
const result = new CleanCSS({
level: 2
}).minify(source).styles.trim();
console.log(`MINIFY ${output_path}`, source.length, ``, result.length, `(${((1 - (result.length / source.length)) * 100).toFixed(2)}% reduction)`);
return result;
}
async function do_minify_html(source, output_path) {
if(!output_path.endsWith(".html") || !is_production) return source;
const result = await minify_html(source, {
collapseBooleanAttributes: true,
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
continueOnParseError: true,
decodeEntities: true,
keepClosingSlash: true,
minifyCSS: true,
quoteCharacter: `"`,
removeComments: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
sortAttributes: true,
sortClassName: true,
useShortDoctype: true
});
console.log(`MINIFY ${output_path}`, source.length, ``, result.length, `(${((1 - (result.length / source.length)) * 100).toFixed(2)}% reduction)`);
return result;
}
if(is_production) console.log("Production environment detected, minifying content");
module.exports = function(eleventyConfig) {
eleventyConfig.addTransform("cssmin", do_minify_css);
eleventyConfig.addTransform("htmlmin", do_minify_html);
eleventyConfig.addPassthroughCopy("img2brush/img2brush.js");
eleventyConfig.addAsyncShortcode("fetch", fetch);
eleventyConfig.addFilter("fetch_file", fetch_file);
// eleventyConfig.addPassthroughCopy("images");
// eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addShortcode("image", shortcode_image);
eleventyConfig.addJavaScriptFunction("image", shortcode_image);
// eleventyConfig.addNunjucksAsyncShortcode("image_url", shortcode_image_url);
eleventyConfig.addAsyncShortcode("image_url", shortcode_image_url);
eleventyConfig.addAsyncShortcode("image_urlpass", shortcode_image_urlpass);
eleventyConfig.addNunjucksAsyncShortcode("image_urlpass", shortcode_image_urlpass);
eleventyConfig.addPairedShortcode("gallerybox", shortcode_gallerybox);
}

1
.docs/.eleventyignore Normal file
View File

@ -0,0 +1 @@
css/

View File

@ -0,0 +1,6 @@
{
"layout": "content-generic.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": "content-generic.njk",
"title": "Cookbook",
"tags": "navigable",
"date": "2006-01-01"
}

1
.docs/Cookbook.md Symbolic link
View File

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

View File

@ -0,0 +1,47 @@
"use strict";
const fs = require("fs");
const path = require("path");
const columnify = require("columnify");
const htmlentities = require("html-entities");
const a = require("./lib/Ansi.js");
const parse_sections = require("./lib/parse_sections.js");
let { sections, categories } = parse_sections(fs.readFileSync(
path.resolve(
__dirname,
`../Chat-Command-Reference.md`
),
"utf-8"
))
sections = sections.sort((a, b) => a.title.replace(/^\/+/g, "").localeCompare(
b.title.replace(/^\/+/g, "")));
console.log(`REFERENCE SECTION TITLES`)
console.log(columnify(sections.map(s => { return {
category: `${a.hicol}${a.fyellow}${s.category}${a.reset}`,
command: `${a.hicol}${a.fmagenta}${htmlentities.decode(s.title)}${a.reset}`
} })));
// console.log(sections
// .map(s => `${a.fyellow}${a.hicol}${s.category}${a.reset}\t${a.fmagenta}${a.hicol}${s.title}${a.reset}`).join(`\n`));
console.log(`************************`);
console.log(`REFERENCE SECTION COLOURS`);
console.log(columnify(Array.from(categories).map(el => { return {
category: el[0],
colour: el[1]
} })));
module.exports = {
layout: "theme.njk",
title: "Reference",
tags: "navigable",
date: "2001-01-01",
section_intro: sections[0],
sections_help: sections, // Remove the very beginning bit
categories: [...categories.keys()].join("|")
}

220
.docs/Reference.html Normal file
View File

@ -0,0 +1,220 @@
<main>
<section class="panel-generic">
<h1 id="#reference">Reference</h1>
<p>This is the full chat command reference for WorldEditAdditions. It has 2 parts:</p>
<ol>
<li>A contents list of commands and their syntax</li>
<li>A full reference, with detailed explanations for each command</li>
</ol>
<p>There is also a <a href="#filter">filter box</a> for filtering everything to quickly find the one you're after.</p>
</section>
<section id="filter" class="panel-generic">
<div class="form-item bigsearch">
<label for="input-filter">Filter:</label>
<input type="search" id="input-filter" placeholder="Start typing to filter." autofocus />
</div>
<div class="form-item centre checkbox">
<input type="checkbox" id="input-searchall" />
<label for="input-searchall" title="If unchecked, only the title will be searched.">Search content</label>
</div>
</section>
<section class="panel-generic">
<h2 id="contents" class="linked-section-heading">
<a class="section-link" href="#{{ section.slug }}">&#x1f517; <!-- Link Symbol --></a>
<span class="title">Contents</span>
</h2>
<div class="command-ordering-tabs">
<button class="active" data-mode="alphabetical">Alphabetical</button>
<button data-mode="categorical">Categorical</button>
</div>
<input type="hidden" id="category-names" value="{{ categories }}" />
<div class="command-container">
<h3>Alphabetical</h3>
<ul class="command-list">
{% for section in sections_help %}
<li data-filtermode-force="all" data-category="{{ section.category }}" style="--cat-colour: {{ section.category_colour }};"><a href="#{{ section.slug }}">
<code>{{ section.title }}</code>
</a></li>
{% endfor %}
</ul>
</div>
</section>
<script>
function search_text(query, text) {
return text.toLocaleLowerCase().includes(query);
}
function handle_display_mode(event) {
set_display_mode(event.target.dataset.mode);
localStorage.setItem("commandlist-displaymode", event.target.dataset.mode);
}
function sort_command_list(list) {
list.sort((a, b) =>
a.querySelector("a").href.localeCompare(b.querySelector("a").href))
}
function nodelist2array(list) {
const result = [];
for(let i = 0; i < list.length; i++) result.push(list[i]);
return result;
}
function set_display_mode(mode) {
console.info(`SET DISPLAYMODE ${mode}`)
const commands = nodelist2array(document.querySelectorAll(`.command-list li`));
const container = document.querySelector(`.command-container`);
switch(mode) {
case "categorical":
const sections = Object.create(null);
for(const command of [...commands]) {
const cat = command.dataset.category;
if(!(sections[cat] instanceof Array))
sections[cat] = [];
sections[cat].push(command);
}
const section_names = document.querySelector("#category-names").value
.split("|");
const fragment = new DocumentFragment();
for(const section_name of section_names) {
sort_command_list(sections[section_name]);
const header = document.createElement("h3");
header.appendChild(document.createTextNode(section_name));
fragment.appendChild(header);
const list = document.createElement("ul");
list.classList.add("command-list", "coloured");
for(const item of sections[section_name])
list.appendChild(item);
fragment.appendChild(list);
}
container.replaceChildren(fragment);
break;
case "alphabetical":
const alpha_fragment = new DocumentFragment();
const alpha_header = document.createElement("h3");
alpha_header.appendChild(document.createTextNode("Alphabetical"));
alpha_fragment.appendChild(alpha_header);
const alpha_list = document.createElement("ul");
alpha_list.classList.add("command-list");
alpha_list.classList.add("command-alpha_list");
sort_command_list(commands);
for(let i = 0; i < commands.length; i++)
alpha_list.appendChild(commands[i]);
alpha_fragment.appendChild(alpha_list);
container.replaceChildren(alpha_fragment);
break;
}
const el_alpha = document.querySelector(".command-ordering-tabs [data-mode=alphabetical]");
const el_cats = document.querySelector(".command-ordering-tabs [data-mode=categorical]");
el_alpha.classList.toggle("active");
el_cats.classList.toggle("active");
}
function do_filter() {
let el_search = document.querySelector("#input-filter");
let el_searchall = document.querySelector("#input-searchall");
localStorage.setItem("commandlist-searchall", el_searchall.checked);
/* Filterable items
- Sections
- Commands in the command list
*/
let els_filterable = document.querySelectorAll("section.filterable, .command-list > li");
let query = el_search.value.toLocaleLowerCase();
let mode = el_searchall.checked ? "all" : "header";
console.log(`SEARCH | mode`, mode, `query`, query);
for(let i = 0; i < els_filterable.length; i++) {
let el_next = els_filterable[i];
let mode_this = mode;
if(typeof el_next.dataset.filtermodeForce == "string")
mode_this = el_next.dataset.filtermodeForce;
let show = true;
if(query.length > 0) {
switch(mode_this) {
case "all":
show = search_text(query,
el_next.textContent + ` ` + el_next.dataset.category
);
break;
case "header":
show = search_text(query,
el_next.querySelector(".linked-section-heading").textContent
);
break;
}
}
el_next.classList.remove("visible", "hidden");
el_next.classList.add(show ? "visible" : "hidden");
}
let commandlist_is_categorical = document.querySelector("button.active[data-mode=categorical]") !== null;
if(commandlist_is_categorical) {
let container = document.querySelector(".command-container");
for(let i = 0; i < container.children.length; i++) {
if(container.children[i].nodeName.toLowerCase() === "ul") {
let class_name = "visible";
if(container.children[i].querySelector("li.visible") === null)
class_name = "hidden";
if(i > 0) {
container.children[i-1].classList.remove("visible", "hidden");
container.children[i-1].classList.add(class_name);
}
}
}
}
}
window.addEventListener("load", (_event) => {
let el_search = document.querySelector("#input-filter");
let el_searchall = document.querySelector("#input-searchall");
let els_cats = document.querySelectorAll(".command-ordering-tabs button");
el_search.addEventListener("input", do_filter);
el_search.addEventListener("search", do_filter);
el_searchall.addEventListener("change", do_filter);
for(let i = 0; i < els_cats.length; i++) {
els_cats[i].addEventListener("click", handle_display_mode);
els_cats[i].addEventListener("touchend", handle_display_mode);
}
if(localStorage.getItem("commandlist-searchall") !== null)
el_searchall.checked = localStorage.getItem("commandlist-searchall") === "true";
if(localStorage.getItem("commandlist-displaymode") !== null)
set_display_mode(localStorage.getItem("commandlist-displaymode"))
});
</script>
{% for section in sections_help %}
<section class="panel-generic filterable" style="--cat-colour: {{ section.category_colour_dark }};">
<h2 id="{{ section.slug }}" class="linked-section-heading">
<a class="section-link" href="#{{ section.slug }}">&#x1f517; <!-- Link Symbol --></a>
<span class="title">{{ section.title }}</span>
<span class="category">{{ section.category }}</span>
</h2>
{{ section.content }}
</section>
{% endfor %}
</main>

120
.docs/Tutorial.md Normal file
View File

@ -0,0 +1,120 @@
---
layout: content-generic.njk
title: Tutorial
tags: navigable
date: 2004-01-01
---
# WorldEditAdditions Beginner's Tutorial
Welcome to the WorldEditAdditions beginners tutorial! There are a number of conventions used in the [chat command reference](/Reference) that may not be immediately obvious - this guide serves to explain in detail.
It is assumed that:
- You are already familiar the basics of [Minetest](https://www.minetest.net/) (try the [tutorial game](https://content.minetest.net/packages/Wuzzy/tutorial/) if you're unsure)
- You have both WorldEdit and WorldEditAdditions installed (see the [Download](/#download) section)
Minetest supports the execution of _Chat Commands_ to manipulate the Minetest world. While in a Minetest world, simply type `/help` (the first forward slash `/` will automatically cause the chat window to appear) and hit <kbd>enter</kbd> to display a list of chat commands that are currently registered grouped by mod for example.
WorldEdit commands are, by convention, prefixed with an additional forward slash `/`. Here are some examples of WorldEdit chat commands:
```
//1
//2
//set dirt
```
Explaining core WorldEdit commands is out of scope of this tutorial, but you can find a complete list of them here: <https://github.com/Uberi/Minetest-WorldEdit/blob/master/ChatCommands.md>.
The purpose of _WorldEditAdditions_ is to extend _WorldEdit_ by adding additional commands. Example commands that have been implemented that are not present in core _WorldEdit_ include (but certainly aren't limited to):
- [`//maze`](/Reference/#maze): Create instant mazes
- [`//forest`](/Reference/#forest): Plant forests
- [`//torus`](http://localhost:8080/Reference/#torus): Generate [torus](https://en.wikipedia.org/wiki/Torus) shapes
- [`//scale`](/Reference/#scale): Scale things up and down - even both at the same time!
See a full list with complete explanations in the [chat command reference](/Reference).
## Regions
WorldEdit allows you to define a _region_ by specifying 2 points in the world - we number these points 1 and 2. By using the WorldEdit wand (or WorldEditAdditions Far Wand), one can left click to set the position of point 1, and right click to set point 2:
{% image "images/tutorial_pos1_2.jpeg" "A screenshot showing WorldEdit points 1 and 2 in a desert with a cactus" %}
Point 1 is on the cactus, and point 2 is on the ground in the bottom left.
Most WorldEdit and WorldEditAdditions commands require either 1 or 2 points to be set in order to work.
- If 1 point is required, it's the origin point used by the command
- If 2 points are required, the defined region specifies the area in which the command is operate
## Command syntax
When explaining the syntax (ref [a](https://en.wikipedia.org/wiki/Syntax_(programming_languages)), [b](https://www.bbc.co.uk/bitesize/guides/z22wwmn/revision/6)) of a command, a number of different conventions are used to concisely explain said syntax. Understanding enables you to quickly understand the output of `/help /maze` for example, or the list of commands in the [reference](/Reference).
- `<thing>`: A placeholder for a value that you can change. Do *not* include the `<` angle brackets `>` when replacing it with your actual value.
- `a | b`: 1 thing or another, but not both.
- `[optional_thing]`: Something that's optional. Specifying it enables greater control over the behaviour of the command, but it can be left out for convenience.
- `<thing|other_thing>`: Pick 1 item from the list and replace the entire group, removing the `<` angle brackets `>` as with `<thing>`. For example `<snowballs|river>` could become either `snowballs` or `river`, but not both at the same time.
- `<thing=default_value>`: Most commonly seen in `[` square brackets `]` indicating an optional thing. Indicates the default value of something that you can replace (or omit).
- `...`: Indicates that the previous items can be repeated.
Let's illustrate this with a practical example. Consider the following:
```
//example <height> <apple|orange> | <height> <width> <pear|maple> [<extra_value>]
```
The following different invocations of the above would be valid:
```
//example 10 apple
//example 45 30 maple
//example 30 12 pear something_else
```
Now let's apply this to a more practical example:
```
//erode [<snowballs|river> [<key_1> [<value_1>]] [<key_2> [<value_2>]] ...]
```
The `<snowballs|river>` explains that either a value of `snowballs` or `river` is acceptable. Then, a key - value list of options can be specified - allowing an arbitrary number of options.
From this, we can infer the following usage:
```
//erode snowballs speed 1 count 50000
```
## Anything else?
- Make sure we have covered everything
## Advanced Concepts
A number of additional concepts that are not required to use WorldEditAdditions are explained here, as they can be helpful for understanding some of the more advanced concepts and commands provided by WorldEditAdditions.
### Meta commands
WorldEditAdditions provides a number of *meta commands*. Such commands don't do anything on their own, but call other commands in various different ways. Examples of meta commands include:
- [`//subdivide`](/Reference#subdivide): split a region into chunks, and execute the command once for each chunk
- [`//many`](/Reference#many): Execute a command multiple times
- [`//multi`](/Reference#multi): Execute multiple commands in sequence
Of course, this isn't an exhaustive list - check the [reference](/Reference) for a full list.
### Memory usage
Memory (or RAM - Random Access Memory) is used by all the processes running on a system to hold data that they are currently working with. This is especially important for WorldEdit and WorldEditAdditions, since the larger the region you define the more memory that will be required to run commands on it.
Depending on your system, Minetest and your system can slow to a crawl or even crash if you execute a command on a region that's too big.
To work around this, the [`//subdivide`](/Reference#subdivide) command was implemented. It splits the defined region into chunks, and calls the specified command over and over again for each chunk.
It's not suitable for all commands (since it requires that said command takes 2 points) though, but because it splits the defined region into multiple chunks, it can be executed on *enormous* regions that can't fit into memory all at the same time.
## Conclusion
This short tutorial has explained a few key concepts that are useful for understanding WorldEditAdditions, from executing chat commands to the syntax used in the [reference](/Reference) to concisely describe commands.
If there's a concept that you don't understand after reading this and the [reference](/Reference), please [open an issue](https://github.com/sbrl/Minetest-WorldEditAdditions/issues/new) with a detailed explanation of what it is that you're finding difficult to understand.

View File

@ -0,0 +1,23 @@
const fs = require("fs");
const path = require("path");
const htmlentities = require("html-entities");
function read_contributors() {
return fs.readFileSync(path.resolve(__dirname, "../../CONTRIBUTORS.tsv"), "utf-8")
.split("\n")
.slice(1)
.filter(line => line.length > 0)
.map(line => line.split(/\s+/))
.map(items => { return {
handle: htmlentities.encode(items[0]),
name: htmlentities.encode(items[1]),
profile_url: `https://github.com/${encodeURIComponent(items[0])}`,
avatar_url: `https://avatars.githubusercontent.com/${encodeURIComponent(items[0])}`
} });
}
const contributors = read_contributors();
console.log(`CONTRIBUTORS`, contributors);
module.exports = contributors;

View File

@ -0,0 +1,7 @@
---
layout: theme.njk
---
<main class="panel-generic">
{{ content | safe }}
</main>

63
.docs/_includes/theme.njk Normal file
View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ title }} • WorldEditAdditions</title>
<link rel="stylesheet" href="/theme.css" />
<link rel="icon" href="{% image_urlpass '../worldeditadditions-64.png' %}" type="image/png" sizes="64x64" />
<link rel="icon" href="{% image_urlpass '../worldeditadditions.png' %}" type="image/png" sizes="540x540" />
<meta name="theme-color" content="#61b4f4" />
<!-- OpenGraph -->
<meta property="og:title" content="WorldEditAdditions" />
<meta property="og:type" content="website" />
<!-- We wanted pepperminty.wiki, but it's too expensive :-( -->
<meta property="og:url" content="https://worldeditadditions.mooncarrot.space/" />
<meta property="og:image" content="https://worldeditadditions.mooncarrot.space{% image_url 'images/banner-main.jpeg' %}" />
<meta property="og:description" content="Extra tools and commands to extend WorldEdit for Minetest. If you can dream of it, it probably belongs here!" />
<!-- Twitter Cards -->
<meta property="twitter:card" content="summary" />
<meta property="twitter:site" content="@SBRLabs" />
<meta property="twitter:title" content="WorldEditAdditions" />
<meta property="twitter:description" content="Extra tools and commands to extend WorldEdit for Minetest. If you can dream of it, it probably belongs here!" />
<meta property="twitter:image" content="https://worldeditadditions.mooncarrot.space{% image_urlpass '../worldeditadditions.png' %}" />
</head>
<body>
<nav class="shadow-bottom">
<h1><a href="/" class="invisilink">
<img src="{% image_urlpass '../worldeditadditions.png' %}" alt="" class="icon logo" />
WorldEditAdditions
</a></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 image"><img src="{% image_urlpass 'images/github.svg' %}" alt="GitHub" title="GitHub" /></a></li>
</ul>
</nav>
{{ content | safe }}
<footer class="shadow-top">
<p>WorldEditAdditions is built with ❤️ by these awesome people:</p>
<ul class="contributor-list">
{% for contributor in contributors %}
<li><a href="{{ contributor.profile_url }}">
<img class="icon large" src="{{ contributor.avatar_url | fetch_file }}" alt="{{ contributor.name }}" />
<span>{{ contributor.name }}</span>
</a></li>
{% endfor %}
</ul>
<p>Tech: <a href="https://www.11ty.dev/">Eleventy</a> (this website), <a href="https://www.heropatterns.com/">Hero Patterns</a> (background patterns), <a href="https://github.com/shssoichiro/oxipng">Oxipng</a> (PNG image compression), <a href="https://www.minetest.net/">Minetest</a> (of course)</p>
<p>Licensed under the <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>

13
.docs/css.njk Normal file
View File

@ -0,0 +1,13 @@
---
permalink: theme.css
---
{% include "css/patterns.css" %}
{% include "css/theme.css" %}
{% include "css/gallerybox.css" %}
{% include "css/smallscreens.css" %}
{% include "css/prism-custom.css" %}
{# {% fetch "https://unpkg.com/prismjs/themes/prism-okaidia.css" %} #}
{# {% fetch "https://raw.githubusercontent.com/PrismJS/prism-themes/master/themes/prism-shades-of-purple.css" %} #}
{# {% fetch "https://raw.githubusercontent.com/PrismJS/prism-themes/master/themes/prism-material-light.css" %} #}

139
.docs/css/gallerybox.css Normal file
View File

@ -0,0 +1,139 @@
/*
A pure css gallery, made with a bunch of wonderful hacks! Will be upgraded to
be (slightly) less hacky once :target-within lands in browsers.
Exported to codepen: https://codepen.io/sbrl/details/YzZJYxg
*/
:root {
--gallerybox-bg: hsla(0, 0%, 95%, 0.75);
}
@media (prefers-color-scheme: dark) {
:root {
--gallerybox-bg: hsla(0, 0%, 30%, 0.75);
}
}
@media (orientation: landscape) {
.gallerybox-gallery {
max-width: 95vw;
}
}
.gallerybox {
display: flex;
justify-content: center;
/*
The <picture /> element causes a small amount of extra padding at the
bottom of the element, so we use this to balance out the look at the top
ideally we'd shift the <picture> out of the way, but we can't without also
shifting the <img /> inside
*/
padding-top: 0.2em;
}
.gallerybox-gallery {
--gallerybox-nextprev-padding: 5vw;
--gallerybox-nextprev-move: 0.2em;
--gallerybox-nextprev-hover: 0.1em;
max-width: 80vmax;
display: grid;
grid-template-columns: auto;
grid-template-rows: auto;
grid-template-areas: "main";
}
/* .gallerybox picture {
position: relative;
top: -1em;
}
.gallerybox picture > img {
position: relative;
top: 1em;
} */
.gallerybox-item {
grid-area: main;
z-index: 2;
}
.gallerybox-item > figcaption {
background: var(--gallerybox-bg);
position: absolute;
bottom: 0.25em; left: 0; right: 0;
padding: 0.75em 1em;
text-align: center;
}
.gallerybox-gallery > .gallerybox-item:target {
display: block;
z-index: 100;
}
/* .gallerybox-gallery > .gallerybox-item:not(:target) {
display: none;
z-index: 2;
}
.gallerybox-item:not(:target) ~ .gallerybox-item:last-child {
display: block;
z-index: 2;
} */
/*
.gallerybox-gallery:target-within > .gallerybox-item:target {
display: block;
}
.gallerybox-gallery:target-within > .gallerybox-item:not(:target) {
display: none;
} */
.gallerybox-item {
position: relative;
}
.gallerybox-item img {
max-width: 100%;
}
:where(.gallerybox-prev, .gallerybox-next) {
display: flex;
align-items: center;
height: 100%;
position: absolute; top: 0;
vertical-align: middle;
font-weight: bold;
font-size: 4em;
color: hsla(0, 0%, 100%, 0.8) !important;
text-decoration: none;
transform: none;
transition: transform 0.25s;
}
.gallerybox-item > .gallerybox-prev {
padding-left: var(--gallerybox-nextprev-padding);
left: 0;
}
.gallerybox-item > .gallerybox-next {
padding-right: var(--gallerybox-nextprev-padding);
right: 0;
}
:where(.gallerybox-prev, .gallerybox-next):hover {
color: hsla(0, 0%, 100%, 1) !important;
}
:is(.gallerybox-prev, .gallerybox-next):active {
color: hsla(0, 0%, 100%, 1) !important;
}
.gallerybox-next:hover { transform: translateX(calc(var(--gallerybox-nextprev-hover) * -1)); }
.gallerybox-prev:hover { transform: translateX(var(--gallerybox-nextprev-hover)); }
.gallerybox-prev:active { transform: translateX(calc(var(--gallerybox-nextprev-move) * -1)); }
.gallerybox-next:active { transform: translateX(var(--gallerybox-nextprev-move)); }

6
.docs/css/patterns.css Normal file
View File

@ -0,0 +1,6 @@
:root {
/* Ref https://www.heropatterns.com/ */
--pattern-bricks: url("data:image/svg+xml,%3Csvg width='42' height='44' viewBox='0 0 42 44' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='Page-1' fill='none' fill-rule='evenodd'%3E%3Cg id='brick-wall' fill='%236ca8c7' fill-opacity='0.14'%3E%3Cpath d='M0 0h42v44H0V0zm1 1h40v20H1V1zM0 23h20v20H0V23zm22 0h20v20H22V23z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
--pattern-hex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg id='hexagons' fill='%236ca8c7' fill-opacity='0.1' fill-rule='nonzero'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
--pattern-jigsaw-green: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='192' height='192' viewBox='0 0 192 192'%3E%3Cpath fill='%23b7e3ad' fill-opacity='0.4' d='M192 15v2a11 11 0 0 0-11 11c0 1.94 1.16 4.75 2.53 6.11l2.36 2.36a6.93 6.93 0 0 1 1.22 7.56l-.43.84a8.08 8.08 0 0 1-6.66 4.13H145v35.02a6.1 6.1 0 0 0 3.03 4.87l.84.43c1.58.79 4 .4 5.24-.85l2.36-2.36a12.04 12.04 0 0 1 7.51-3.11 13 13 0 1 1 .02 26 12 12 0 0 1-7.53-3.11l-2.36-2.36a4.93 4.93 0 0 0-5.24-.85l-.84.43a6.1 6.1 0 0 0-3.03 4.87V143h35.02a8.08 8.08 0 0 1 6.66 4.13l.43.84a6.91 6.91 0 0 1-1.22 7.56l-2.36 2.36A10.06 10.06 0 0 0 181 164a11 11 0 0 0 11 11v2a13 13 0 0 1-13-13 12 12 0 0 1 3.11-7.53l2.36-2.36a4.93 4.93 0 0 0 .85-5.24l-.43-.84a6.1 6.1 0 0 0-4.87-3.03H145v35.02a8.08 8.08 0 0 1-4.13 6.66l-.84.43a6.91 6.91 0 0 1-7.56-1.22l-2.36-2.36A10.06 10.06 0 0 0 124 181a11 11 0 0 0-11 11h-2a13 13 0 0 1 13-13c2.47 0 5.79 1.37 7.53 3.11l2.36 2.36a4.94 4.94 0 0 0 5.24.85l.84-.43a6.1 6.1 0 0 0 3.03-4.87V145h-35.02a8.08 8.08 0 0 1-6.66-4.13l-.43-.84a6.91 6.91 0 0 1 1.22-7.56l2.36-2.36A10.06 10.06 0 0 0 107 124a11 11 0 0 0-22 0c0 1.94 1.16 4.75 2.53 6.11l2.36 2.36a6.93 6.93 0 0 1 1.22 7.56l-.43.84a8.08 8.08 0 0 1-6.66 4.13H49v35.02a6.1 6.1 0 0 0 3.03 4.87l.84.43c1.58.79 4 .4 5.24-.85l2.36-2.36a12.04 12.04 0 0 1 7.51-3.11A13 13 0 0 1 81 192h-2a11 11 0 0 0-11-11c-1.94 0-4.75 1.16-6.11 2.53l-2.36 2.36a6.93 6.93 0 0 1-7.56 1.22l-.84-.43a8.08 8.08 0 0 1-4.13-6.66V145H11.98a6.1 6.1 0 0 0-4.87 3.03l-.43.84c-.79 1.58-.4 4 .85 5.24l2.36 2.36a12.04 12.04 0 0 1 3.11 7.51A13 13 0 0 1 0 177v-2a11 11 0 0 0 11-11c0-1.94-1.16-4.75-2.53-6.11l-2.36-2.36a6.93 6.93 0 0 1-1.22-7.56l.43-.84a8.08 8.08 0 0 1 6.66-4.13H47v-35.02a6.1 6.1 0 0 0-3.03-4.87l-.84-.43c-1.59-.8-4-.4-5.24.85l-2.36 2.36A12 12 0 0 1 28 109a13 13 0 1 1 0-26c2.47 0 5.79 1.37 7.53 3.11l2.36 2.36a4.94 4.94 0 0 0 5.24.85l.84-.43A6.1 6.1 0 0 0 47 84.02V49H11.98a8.08 8.08 0 0 1-6.66-4.13l-.43-.84a6.91 6.91 0 0 1 1.22-7.56l2.36-2.36A10.06 10.06 0 0 0 11 28 11 11 0 0 0 0 17v-2a13 13 0 0 1 13 13c0 2.47-1.37 5.79-3.11 7.53l-2.36 2.36a4.94 4.94 0 0 0-.85 5.24l.43.84A6.1 6.1 0 0 0 11.98 47H47V11.98a8.08 8.08 0 0 1 4.13-6.66l.84-.43a6.91 6.91 0 0 1 7.56 1.22l2.36 2.36A10.06 10.06 0 0 0 68 11 11 11 0 0 0 79 0h2a13 13 0 0 1-13 13 12 12 0 0 1-7.53-3.11l-2.36-2.36a4.93 4.93 0 0 0-5.24-.85l-.84.43A6.1 6.1 0 0 0 49 11.98V47h35.02a8.08 8.08 0 0 1 6.66 4.13l.43.84a6.91 6.91 0 0 1-1.22 7.56l-2.36 2.36A10.06 10.06 0 0 0 85 68a11 11 0 0 0 22 0c0-1.94-1.16-4.75-2.53-6.11l-2.36-2.36a6.93 6.93 0 0 1-1.22-7.56l.43-.84a8.08 8.08 0 0 1 6.66-4.13H143V11.98a6.1 6.1 0 0 0-3.03-4.87l-.84-.43c-1.59-.8-4-.4-5.24.85l-2.36 2.36A12 12 0 0 1 124 13a13 13 0 0 1-13-13h2a11 11 0 0 0 11 11c1.94 0 4.75-1.16 6.11-2.53l2.36-2.36a6.93 6.93 0 0 1 7.56-1.22l.84.43a8.08 8.08 0 0 1 4.13 6.66V47h35.02a6.1 6.1 0 0 0 4.87-3.03l.43-.84c.8-1.59.4-4-.85-5.24l-2.36-2.36A12 12 0 0 1 179 28a13 13 0 0 1 13-13zM84.02 143a6.1 6.1 0 0 0 4.87-3.03l.43-.84c.8-1.59.4-4-.85-5.24l-2.36-2.36A12 12 0 0 1 83 124a13 13 0 1 1 26 0c0 2.47-1.37 5.79-3.11 7.53l-2.36 2.36a4.94 4.94 0 0 0-.85 5.24l.43.84a6.1 6.1 0 0 0 4.87 3.03H143v-35.02a8.08 8.08 0 0 1 4.13-6.66l.84-.43a6.91 6.91 0 0 1 7.56 1.22l2.36 2.36A10.06 10.06 0 0 0 164 107a11 11 0 0 0 0-22c-1.94 0-4.75 1.16-6.11 2.53l-2.36 2.36a6.93 6.93 0 0 1-7.56 1.22l-.84-.43a8.08 8.08 0 0 1-4.13-6.66V49h-35.02a6.1 6.1 0 0 0-4.87 3.03l-.43.84c-.79 1.58-.4 4 .85 5.24l2.36 2.36a12.04 12.04 0 0 1 3.11 7.51A13 13 0 1 1 83 68a12 12 0 0 1 3.11-7.53l2.36-2.36a4.93 4.93 0 0 0 .85-5.24l-.43-.84A6.1 6.1 0 0 0 84.02 49H49v35.02a8.08 8.08 0 0 1-4.13 6.66l-.84.43a6.91 6.91 0 0 1-7.56-1.22l-2.36-2.36A10.06 10.06 0 0 0 28 85a11 11 0 0 0 0 22c1.94 0 4.75-1.16 6.11-2.53l2.36-2.36a6.93 6.93 0 0 1 7.56-1.22l.84.43a8.08 8.08 0 0 1 4.13 6.66V143h35.02z'%3E%3C/path%3E%3C/svg%3E");
}

159
.docs/css/prism-custom.css Normal file
View File

@ -0,0 +1,159 @@
/* Ref https://github.com/jGleitz/markdown-it-prism/issues/1; we don't get have
line numbers because we don't have 1 span per line :-/*/
pre[class*='language-'] {
counter-reset: line-numbers;
border: 0;
}
span[class*='language-'] {
counter-increment: line-numbers;
}
span[class*='language-']::before {
content: counter(line-numbers);
}
/* PrismJS 1.16.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript&plugins=line-highlight+line-numbers+autolinker+data-uri-highlight+toolbar+previewers+autoloader+command-line+normalize-whitespace+show-language */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 1em;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function,
.token.class-name {
/* color: #DD4A68; */
color: hsl(347, 87%, 44%);
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

View File

@ -0,0 +1,34 @@
@media (max-width: 1200px) {
nav > ul a {
padding: 1.45em 0.5em;
}
}
@media (max-width: 930px) {
nav {
display: flex;
flex-direction: column;
align-items: center;
}
nav > h1 {
width: 100%;
}
.bigbox {
padding: 0 5vmin;
}
}
@media (max-width: 640px) {
nav > ul {
padding-top: 0.5em;
justify-content: center;
flex-wrap: wrap;
}
.bigbox h1 {
font-size: 1.5em;
}
}

473
.docs/css/theme.css Normal file
View File

@ -0,0 +1,473 @@
/* 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: hsl(206, 87%, 67%);
/* --bg-bright: #57b43f; */
--bg-bright: #7ac767;
--bg-alt: #3F57B4;
--bg-transcluscent-slight: rgba(255, 255, 255, 0.1);
--bg-transcluscent: rgba(255, 255, 255, 0.85);
--bg-transcluscent-alt: hsla(226, 59%, 38%, 0.8);
--bg-transcluscent-alt-vdark: hsla(226, 59%, 8%, 0.8);
--bg-transcluscent-alt-slight: hsla(196, 91%, 62%, 0.23);
/* --text-main: #3F57B4; */
--text-main: hsl(227, 70%, 35%);
--text-bright: #efefef;
--text-alt: #38871e;
--shadow: hsla(0, 0%, 25%, 0.25);
--shadow-dark: hsla(0, 0%, 25%, 0.5);
--highlight: hsl(353, 100%, 36%);
--bg-image: url('{% image_urlpass "images/clouds.png" %}');
}
@media (prefers-color-scheme: dark) {
:root {
--bg-main: #020B18;
--bg-bright: hsl(108, 46%, 34%);
--bg-alt: hsl(228, 68%, 68%);
--bg-transcluscent: hsla(224, 20%, 16%, 0.85);
--bg-transcluscent-alt: hsla(226, 79%, 70%, 0.8);
--text-main: hsl(227, 80%, 95%);
--bg-image: url('{% image_urlpass "images/clouds-night.png" %}');
}
a { color: #7c7cff; }
a:active { color: #ee0000; }
a:not(.nav):not(.bigbutton):visited { color: hsl(296, 84%, 75%); }
}
/* rem is relative to the html element, and em is relative to the current element. */
html { font-size: 100%; scroll-behavior: smooth; }
body
{
margin: 0;
font-family: sans-serif; /* Serif is awful :( */
background: var(--bg-image) center / cover fixed,
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;
}
}
h1, h2, h3, h4, h5, h6 {
text-align: center;
word-wrap: break-word;
}
.linked-section-heading {
display: flex;
}
.linked-section-heading > a.section-link {
opacity: 0.75;
text-decoration: none;
transition: 0.25s opacity;
}
.linked-section-heading > a.section-link:hover {
opacity: 1;
}
.linked-section-heading > span.title {
flex: 1;
word-wrap: anywhere;
}
.linked-section-heading > span.category {
font-size: 0.75em;
border-radius: 1em;
background: var(--cat-colour);
padding: 0 0.5em;
line-height: 1.5;
align-self: flex-start;
}
h3 {
margin-top: 2em;
padding-bottom: 0.2em;
border-bottom: 0.1em solid var(--cat-colour);
}
h3, h3 > code {
font-size: 1.1em;
text-align: left;
}
h3 > code {
background: transparent;
}
nav {
background: var(--bg-bright);
display: flex;
align-items: baseline;
font-size: 1.1em;
margin: 0;
}
nav h1 {
background: var(--text-bright);
margin: 0;
padding: 0.2em 0.5em 0.2em 0.2em;
font-size: 1.2em;
color: var(--bg-alt);
}
nav ul {
flex: 1;
list-style-type: none;
margin: 0; padding: 0;
display: flex;
justify-content: space-evenly;
align-items: center;
}
nav > ul a {
background: var(--bg-transcluscent-slight);
display: inline-block;
padding: 1.45em 2em;
text-decoration: none;
font-weight: bold;
color: var(--text-main);
}
nav li[aria-current=page] a {
color: var(--bg-bright);
background: var(--text-main);
}
nav a.image {
padding: 0.75em 1em 0.5em 1em;
}
nav img { max-height: 2em; }
/* 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):not(.bigbutton):visited { color: hsl(240, 77%, 60%); }
pre {
page-break-inside: avoid;
break-inside: avoid;
padding: 0.6em;
border: 0.2em solid var(--bg-transcluscent-alt);
border-radius: 0.25em;
background: var(--bg-transcluscent-alt);
box-shadow: inset 0 0 0.5em 0.1em var(--shadow-dark);
line-height: 1.75em;
color: var(--text-bright);
}
pre, code {
text-align: left;
font-size: 1rem;
font-family: "Source Code Pro", "Ubuntu Mono", monospace;
white-space: pre-wrap;
-moz-tab-size: 4;
tab-size: 4;
}
pre > code { background: transparent; padding: 0; }
code {
background: var(--bg-transcluscent-alt-slight);
border-radius: 0.25em;
padding: 0.15em;
}
/* pre.language-weacmd {
background: var(--bg-transcluscent-alt-vdark);
} */
label {
font-weight: bold;
cursor: pointer;
padding: 0.25em 0.45em;
}
/* 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;
}
.form-item {
display: flex;
margin: 0.5em 0;
}
.form-item.checkbox:not(.centre) > label { flex: 1; }
.form-item:not(.checkbox):not(.centre) > input { flex: 1; }
.form-item.centre { justify-content: center; }
.bigsearch {
flex-direction: row;
}
.bigsearch > input[type=search] {
width: 100%;
box-sizing: border-box;
}
footer {
margin: 3em 0 0 0;
padding: 1em;
text-align: center;
background: var(--pattern-jigsaw-green),
var(--bg-bright);
/* color: var(--text-bright); */
}
.text-left { text-align: left; }
.text-centre { text-align: center; }
.text-right { text-align: right; }
.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; }
.icon.logo {
max-width: 3em;
max-height: 3em;
}
.icon.logo-large {
max-width: 8em;
max-height: 8em;
}
.shadow-top { box-shadow: 0 -0.25em 0.5em var(--shadow); }
.shadow-bottom { box-shadow: 0 0.25em 0.5em var(--shadow); }
.shadow-vertical{ box-shadow: 0 0 0.5em 0.25em var(--shadow); }
.shadow-text { text-shadow: 0.15em 0.15em 0.15em var(--shadow); }
.hidden { display: none; }
.bigbox {
display: flex;
flex-direction: column;
align-items: center; justify-content: center;
text-align: center; /* If any text wraps in a <p>, then this makes sure it's still centred */
background: content-box linear-gradient(var(--bg-transcluscent), var(--bg-transcluscent)),
var(--bg) center / cover;
height: max(30em, 80vh);
padding: 0 5em 0 5em;
box-sizing: border-box;
}
.bigbox h1 {
margin: 0;
font-size: 3em;
/* color: var(--text-alt); */
color: var(--bg-alt);
}
.features-large {
margin: 3em 0;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
}
.features-large > :where(figure, .features-item) {
background: var(--bg-transcluscent);
background-image: var(--pattern-bricks);
margin: 1em 0.1em;
padding: 1em;
max-width: 15em;
box-shadow: 0.25em 0.25em 0.5em var(--shadow);
}
.features-item.wide {
flex: 1;
max-width: initial;
margin: 0.5em 2em;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
/* .features-item.wide > :last-child {
flex: 1;
display: flex;
justify-content: flex-end;
flex-direction: column;
align-items: center;
} */
.panel-generic {
background: var(--bg-transcluscent);
background-image: var(--pattern-bricks);
margin: 2em;
padding: 1em;
box-shadow: 0.25em 0.25em 0.5em var(--shadow);
}
.bigbutton-list {
list-style-type: none;
margin: 0;
padding: 1em 0;
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.bigbutton {
display: inline-block;
margin: 0.25em 0;
padding: 0.35em 0.45em;
border: 0;
border-radius: 0.25em;
background: var(--bg-alt);
color: var(--text-bright);
font-size: 1.25em;
text-decoration: none;
text-align: center;
box-shadow: 0 0 0.5em var(--shadow);
cursor: pointer;
transition: box-shadow 0.25s, transform 0.25s;
}
.bigbutton:hover {
box-shadow: 0 0.25em 0.65em var(--shadow);
transform: translateY(-0.25em);
}
.bigbutton:active {
box-shadow: 0 0 0.25em var(--shadow);
transform: translateY(0.1em);
}
.bigbutton.disabled {
filter: saturate(25%);
opacity: 0.75;
cursor: default;
}
.gallerybox {
background: var(--pattern-hex), var(--bg-transcluscent);
}
.command-ordering-tabs {
display: flex;
gap: 1em;
margin-bottom: 2em;
}
.command-ordering-tabs button {
flex: 1;
font-size: 1.1em;
padding: 0.5em;
}
.command-ordering-tabs button.active { font-weight: bold; }
.command-list {
margin: 0;
padding: 0;
list-style-type: none;
word-wrap: anywhere;
}
.command-list > li > a {
text-decoration: none;
}
.command-list.coloured code { background: var(--cat-colour); }
.command-list code {
display: block;
padding: 0.5em;
box-sizing: border-box;
margin: 0.5em 0;
}
.filterable {
border: 0.2em solid var(--cat-colour);
}
.contributor-list {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
flex-wrap: wrap;
}
.contributor-list li {
padding: 0.5em;
}
.contributor-list a {
display: flex;
flex-direction: column;
align-items: center;
}
@keyframes move-diagonal {
from {
background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
}
to {
background-position: -52px -52px, -52px -52px, -51px -51px, -51px -51px;
}
}
#dropzone {
border: 0.3em dashed #aaaaaa;
transition: border 0.2s;
justify-content: flex-start;
}
#dropzone.dropzone-active {
border: 0.3em dashed hsl(203, 79%, 55%);
/* Ref https://www.magicpattern.design/tools/css-backgrounds */
background-image: linear-gradient(var(--bg-bright) 2px, transparent 2px), linear-gradient(90deg, var(--bg-bright) 2px, transparent 2px), linear-gradient(var(--bg-bright) 1px, transparent 1px), linear-gradient(90deg, var(--bg-bright) 1px, var(--bg-transcluscent) 1px);
background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
animation: move-diagonal 5s linear infinite;
}
#brushimg-preview { flex: 1; }

40
.docs/grammars/axes.bnf Normal file
View File

@ -0,0 +1,40 @@
{%
# Lists of axes
In various commands such as `//copy+`, `//move+`, and others lists of axes are used. These are all underpinned by a single grammar and a single parser (located in `worldeditadditions/utils/parse/axes.lua`). While the parser itself requires pre-split tokens (see `split_shell` for that), the grammar which it parses is documented here.
Examples:
```
front 3 left 10 y 77 x 30 back 99
```
%}
<axes> ::= <axis_part> *
<axes_part> ::= <axis_name> <number>
| <axis_name> <number> <reverse>
<reverse> ::= <number>
| <reverse_name>
<reverse_name> ::= sym | symmetrical | mirror | mir | rev | reverse | true
<axis_name> ::= <axis_name_absolute>
| <axis_name_relative>
<axis_name_absolute> ::= <axis_letters_absolute>
| "-" <axis_letters_absolute>
<axis_name_relative> ::= front | back | left | right | up | down | "?"
<axis_letters_absolute> ::= x | y | z | h | v
<number> ::= <digit> *
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
.docs/images/clouds.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
.docs/images/contentdb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 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: 725 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

6
.docs/images/github.svg Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="256px" height="250px" viewBox="0 0 256 250" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
<g>
<path d="M128.00106,0 C57.3172926,0 0,57.3066942 0,128.00106 C0,184.555281 36.6761997,232.535542 87.534937,249.460899 C93.9320223,250.645779 96.280588,246.684165 96.280588,243.303333 C96.280588,240.251045 96.1618878,230.167899 96.106777,219.472176 C60.4967585,227.215235 52.9826207,204.369712 52.9826207,204.369712 C47.1599584,189.574598 38.770408,185.640538 38.770408,185.640538 C27.1568785,177.696113 39.6458206,177.859325 39.6458206,177.859325 C52.4993419,178.762293 59.267365,191.04987 59.267365,191.04987 C70.6837675,210.618423 89.2115753,204.961093 96.5158685,201.690482 C97.6647155,193.417512 100.981959,187.77078 104.642583,184.574357 C76.211799,181.33766 46.324819,170.362144 46.324819,121.315702 C46.324819,107.340889 51.3250588,95.9223682 59.5132437,86.9583937 C58.1842268,83.7344152 53.8029229,70.715562 60.7532354,53.0843636 C60.7532354,53.0843636 71.5019501,49.6441813 95.9626412,66.2049595 C106.172967,63.368876 117.123047,61.9465949 128.00106,61.8978432 C138.879073,61.9465949 149.837632,63.368876 160.067033,66.2049595 C184.49805,49.6441813 195.231926,53.0843636 195.231926,53.0843636 C202.199197,70.715562 197.815773,83.7344152 196.486756,86.9583937 C204.694018,95.9223682 209.660343,107.340889 209.660343,121.315702 C209.660343,170.478725 179.716133,181.303747 151.213281,184.472614 C155.80443,188.444828 159.895342,196.234518 159.895342,208.176593 C159.895342,225.303317 159.746968,239.087361 159.746968,243.303333 C159.746968,246.709601 162.05102,250.70089 168.53925,249.443941 C219.370432,232.499507 256,184.536204 256,128.00106 C256,57.3066942 198.691187,0 128.00106,0 Z M47.9405593,182.340212 C47.6586465,182.976105 46.6581745,183.166873 45.7467277,182.730227 C44.8183235,182.312656 44.2968914,181.445722 44.5978808,180.80771 C44.8734344,180.152739 45.876026,179.97045 46.8023103,180.409216 C47.7328342,180.826786 48.2627451,181.702199 47.9405593,182.340212 Z M54.2367892,187.958254 C53.6263318,188.524199 52.4329723,188.261363 51.6232682,187.366874 C50.7860088,186.474504 50.6291553,185.281144 51.2480912,184.70672 C51.8776254,184.140775 53.0349512,184.405731 53.8743302,185.298101 C54.7115892,186.201069 54.8748019,187.38595 54.2367892,187.958254 Z M58.5562413,195.146347 C57.7719732,195.691096 56.4895886,195.180261 55.6968417,194.042013 C54.9125733,192.903764 54.9125733,191.538713 55.713799,190.991845 C56.5086651,190.444977 57.7719732,190.936735 58.5753181,192.066505 C59.3574669,193.22383 59.3574669,194.58888 58.5562413,195.146347 Z M65.8613592,203.471174 C65.1597571,204.244846 63.6654083,204.03712 62.5716717,202.981538 C61.4524999,201.94927 61.1409122,200.484596 61.8446341,199.710926 C62.5547146,198.935137 64.0575422,199.15346 65.1597571,200.200564 C66.2704506,201.230712 66.6095936,202.705984 65.8613592,203.471174 Z M75.3025151,206.281542 C74.9930474,207.284134 73.553809,207.739857 72.1039724,207.313809 C70.6562556,206.875043 69.7087748,205.700761 70.0012857,204.687571 C70.302275,203.678621 71.7478721,203.20382 73.2083069,203.659543 C74.6539041,204.09619 75.6035048,205.261994 75.3025151,206.281542 Z M86.046947,207.473627 C86.0829806,208.529209 84.8535871,209.404622 83.3316829,209.4237 C81.8013,209.457614 80.563428,208.603398 80.5464708,207.564772 C80.5464708,206.498591 81.7483088,205.631657 83.2786917,205.606221 C84.8005962,205.576546 86.046947,206.424403 86.046947,207.473627 Z M96.6021471,207.069023 C96.7844366,208.099171 95.7267341,209.156872 94.215428,209.438785 C92.7295577,209.710099 91.3539086,209.074206 91.1652603,208.052538 C90.9808515,206.996955 92.0576306,205.939253 93.5413813,205.66582 C95.054807,205.402984 96.4092596,206.021919 96.6021471,207.069023 Z" fill="#161614"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

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: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 KiB

View File

@ -0,0 +1,112 @@
window.addEventListener("load", () => {
let dropzone = document.querySelector("#dropzone");
dropzone.addEventListener("dragenter", handle_drag_enter);
dropzone.addEventListener("dragleave", handle_drag_leave);
dropzone.addEventListener("dragover", handle_drag_over);
dropzone.addEventListener("drop", handle_drop);
document.querySelector("#brushimg-tsv").addEventListener("click", select_output);
let button_copy = document.querySelector("#brushimg-copy")
button_copy.addEventListener("click", () => {
select_output();
button_copy.innerHTML = document.execCommand("copy") ? "Copied!" : "Failed to copy :-(";
})
});
function get_source_channel_offset() {
const select = document.querySelector("#img2brush-channel");
console.info(`get_source_channel_offset: channel is ${select.value}`)
switch(select.value) {
case "alpha":
return 3;
case "red":
return 0;
case "green":
return 1;
case "blue":
return 2;
default:
throw new Error(`Error : Unknown channel name ${select.value}.`);
}
}
function select_output() {
let output = document.querySelector("#brushimg-tsv");
let selection = window.getSelection();
if (selection.rangeCount > 0)
selection.removeAllRanges();
let range = document.createRange();
range.selectNode(output);
selection.addRange(range);
}
function handle_drag_enter(event) {
event.target.classList.add("dropzone-active");
}
function handle_drag_leave(event) {
event.target.classList.remove("dropzone-active");
}
function handle_drag_over(event) {
event.preventDefault();
}
function handle_drop(event) {
event.stopPropagation();
event.preventDefault();
event.target.classList.remove("dropzone-active");
let image_file = null;
image_file = event.dataTransfer.files[0];
let reader = new FileReader();
reader.addEventListener("load", function(_event) {
let image = new Image();
image.src = reader.result;
image.addEventListener("load", () => handle_new_image(image));
document.querySelector("#brushimg-preview").src = image.src;
});
reader.readAsDataURL(image_file);
return false;
}
function image2pixels(image) {
let canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d");
canvas.width = image.width;
canvas.height = image.height;
ctx.drawImage(image, 0, 0);
return ctx.getImageData(0, 0, image.width, image.height);
}
function handle_new_image(image) {
let tsv = pixels2tsv(image2pixels(image));
document.querySelector("#brushimg-stats").value = `${image.width} x ${image.height} | ${image.width * image.height} pixels`;
document.querySelector("#brushimg-tsv").value = tsv;
}
function pixels2tsv(pixels) {
const offset = get_source_channel_offset();
console.info(`pixels2tsv: offset is ${offset}`);
let result = "";
for(let y = 0; y < pixels.height; y++) {
let row = [];
for(let x = 0; x < pixels.width; x++) {
// No need to rescale here - this is done automagically by WorldEditAdditions.
// r/b/g/alpha
row.push(pixels.data[((y*pixels.width + x) * 4) + offset] / 255);
}
result += row.join(`\t`) + `\n`;
}
return result;
}

View File

@ -0,0 +1,44 @@
---
layout: theme.njk
title: Image to brush converter
---
<section class="panel-generic">
<h1>Image to sculpting brush converter</h1>
<p>Convert any image to a sculpting brush here!</p>
<p>
<strong>Use this channel to convert:</strong>
<select name="img2brush-channel" id="img2brush-channel">
<option value="alpha" selected>Alpha (opacity)</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
</select>
</p>
<p>Only the selected channel is used to determine the weight of the brush - <strong>all other channels are ignored</strong>! Change the channel option <strong>before</strong> you drag + drop the image onto this page.</p>
</section>
<section id="dropzone" class="bigbox panel-generic">
<h2>Input</h2>
<p>Drop your image here.</p>
<img id="brushimg-preview" alt="" />
<output id="brushimg-stats"></output>
</section>
<section class="panel-generic">
<h2>Output</h2>
<p>Paste the output below into a text file in <code>worldeditadditions/lib/sculpt/brushes</code> with the file extension <code>.brush.tsv</code> and restart your Minetest server for the brush to be recognised.</p>
<p class="text-centre">
<button id="brushimg-copy" class="bigbutton">Copy</button>
</p>
<pre><output id="brushimg-tsv"><em>(your output will appear here as soon as you drop an image above)</em></output></pre>
</section>
<script src="./img2brush.js"></script>

125
.docs/index.html Normal file
View File

@ -0,0 +1,125 @@
---
layout: theme.njk
title: Welcome
tags: navigable
date: 2000-01-01
---
<section class="bigbox shadow-bottom" style="--bg: url({% image_url "images/banner-main.jpeg" %})">
<img src="{% image_urlpass '../worldeditadditions.png' %}" alt="" class="icon logo-large" />
<h1>WorldEditAdditions</h1>
<p>
<a href="https://content.minetest.net/packages/Starbeamrainbowlabs/worldeditadditions/"><img src="https://img.shields.io/badge/dynamic/json?color=%23375a7f&amp;label=ContentDB&amp;query=downloads&amp;suffix=+downloads&amp;url=https%3A//content.minetest.net/api/packages/Starbeamrainbowlabs/worldeditadditions/" alt="WorldEditAdditions on ContentDB" /></a>
<a href="https://forum.minetest.net/viewtopic.php?f=11&t=24635"><img src="https://img.shields.io/badge/%F0%9F%92%AC-Forums-%2366D034" alt="WorldEditAdditions on the Minetest Forums" /></a>
<a href="https://github.com/sbrl/Minetest-WorldEditAdditions/releases/latest"><img src="https://img.shields.io/github/v/release/sbrl/Minetest-WorldEditAdditions?color=green&amp;label=latest%20release" alt="Latest release on GitHub" /></a>
<a href="/Changelog"><img src="https://img.shields.io/badge/%F0%9F%93%B0-Changelog-informational" alt="View the changelog" /></a>
</p>
<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>
<p>
<a href="#download" class="bigbutton">Get Started</a>
</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="gallerybox shadow-vertical">
<section class="gallerybox-gallery">
{% gallerybox "images/gallery-a.jpeg" "image-first" "image-last" "image-b" %}
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.
{% endgallerybox %}
{% gallerybox "images/gallery-b.jpeg" "image-b" "image-first" "image-c" %}
The inside of a 3d maze made with <code>//maze3d</code>. Lighting was placed manually to improve screenshot quality.
{% endgallerybox %}
{% gallerybox "images/gallery-c.jpeg" "image-c" "image-b" "image-d" %}
A cliff made with <code>//layers</code> and <code>//erode</code>. A <code>//forest</code> has been applied on top with multiple sapling / tree types.
{% endgallerybox %}
{% gallerybox "images/gallery-d.jpeg" "image-d" "image-c" "image-e" %}
A small mountain made with <code>//layers</code> and <code>//erode</code>, using the new optional <code>//layers</code> slope constraints in WorldEditAdditions v1.13.
{% endgallerybox %}
{% gallerybox "images/gallery-e.jpeg" "image-e" "image-d" "image-f" %}
A small mesa canyons terrain scene made with <code>//erode</code>, the new optional <code>//layers</code> slope contraints, and <code>//noiseapply2d</code> - the latter 2 of which are new in WorldEditAdditions v1.13. Minimal manual tuning was required.
{% endgallerybox %}
{% gallerybox "images/gallery-f.jpeg" "image-last" "image-e" "image-first" %}
A stack of slices of the terrain, made with <code>//many</code> (WorldEditAdditions v1.9+) and <code>//multi</code>. By <a href="https://github.com/VorTechnix">@VorTechnix</a>.
{% endgallerybox %}
</section>
</section>
<section>
<h2 id="download" class="shadow-text">Download</h2>
<div class="features-large">
<div class="features-item wide text-centre">
<h3>ContentDB</h3>
<p><a href="https://content.minetest.net/packages/Starbeamrainbowlabs/worldeditadditions/"><img class="icon-medium" src="{% image_urlpass 'images/contentdb.png' %}" alt="WorldEditAdditions on ContentDB" /></a></p>
<p>Download from ContentDB, or from the <em>Content</em> tab in Minetest.</p>
<p><a class="bigbutton" href="https://content.minetest.net/packages/Starbeamrainbowlabs/worldeditadditions/">WorldEditAdditions on ContentDB</a></p>
</div>
<div class="features-item wide text-centre">
<h3>Git</h3>
<p>WorldEditAdditions is dependent on <a href="https://content.minetest.net/packages/sfan5/worldedit/">WorldEdit</a>. Clone using Git:</p>
<pre><code>cd path/to/worldmods;
git clone https://github.com/Uberi/Minetest-WorldEdit.git worldedit;
git clone https://github.com/sbrl/Minetest-WorldEditAdditions.git worldeditadditions;
cd worldeditadditions;
git checkout "$(git describe --tags --abbrev=0)";</code></pre>
<p><a class="bigbutton" href="https://github.com/sbrl/Minetest-WorldEditAdditions">Source code on GitHub</a></p>
</div>
</div>
</section>
<section>
<h2 class="shadow-text">Getting Started</h2>
<div class="panel-generic">
<p>If you're familiar with WorldEdit already, then WorldEditAdditions will follow the existing expectations you're used to. For players new to WorldEdit / WorldEditAdditions, we have a tutorial that will get you up to speed in no time!</p>
<ul class="bigbutton-list">
<li><a class="bigbutton" href="/Reference">Reference</a></li>
<li><a class="bigbutton" href="/Cookbook">Cookbook</a></li>
<li><a class="bigbutton" href="/Tutorial">Tutorial</a></li>
</ul>
</div>
</section>

88
.docs/lib/Ansi.js Normal file
View File

@ -0,0 +1,88 @@
"use strict";
/**
* Generates various VT100 ANSI escape sequences.
* Ported from C#.
* @licence MPL-2.0 <https://www.mozilla.org/en-US/MPL/2.0/>
* @source https://gist.github.com/a4edd3204a03f4eedb79785751efb0f3#file-ansi-cs
* @author Starbeamrainbowlabs
* GitHub: @sbrl | Twitter: @SBRLabs | Reddit: u/Starbeamrainbowlabs
***** Changelog *****
* 27th March 2019:
* - Initial public release
* 9th March 2020:
* - Add Italics (\u001b[3m])
* - Export a new instance of it by default (makes it so that there's 1 global instance)
* 5th September 2020:
* - Add support for NO_COLOR environment variable <https://no-color.org/>
*/
class Ansi {
constructor() {
/**
* Whether we should *actually* emit ANSI escape codes or not.
* Useful when we want to output to a log file, for example
* @type {Boolean}
*/
this.enabled = true;
this.escape_codes();
}
escape_codes() {
if(typeof process !== "undefined" && typeof process.env.NO_COLOR == "string") {
this.enabled = false;
return;
}
// Solution on how to output ANSI escape codes in C# from here:
// https://www.jerriepelser.com/blog/using-ansi-color-codes-in-net-console-apps
this.reset = this.enabled ? "\u001b[0m" : "";
this.hicol = this.enabled ? "\u001b[1m" : "";
this.locol = this.enabled ? "\u001b[2m" : "";
this.italics = this.enabled ? "\u001b[3m" : "";
this.underline = this.enabled ? "\u001b[4m" : "";
this.inverse = this.enabled ? "\u001b[7m" : "";
this.fblack = this.enabled ? "\u001b[30m" : "";
this.fred = this.enabled ? "\u001b[31m" : "";
this.fgreen = this.enabled ? "\u001b[32m" : "";
this.fyellow = this.enabled ? "\u001b[33m" : "";
this.fblue = this.enabled ? "\u001b[34m" : "";
this.fmagenta = this.enabled ? "\u001b[35m" : "";
this.fcyan = this.enabled ? "\u001b[36m" : "";
this.fwhite = this.enabled ? "\u001b[37m" : "";
this.bblack = this.enabled ? "\u001b[40m" : "";
this.bred = this.enabled ? "\u001b[41m" : "";
this.bgreen = this.enabled ? "\u001b[42m" : "";
this.byellow = this.enabled ? "\u001b[43m" : "";
this.bblue = this.enabled ? "\u001b[44m" : "";
this.bmagenta = this.enabled ? "\u001b[45m" : "";
this.bcyan = this.enabled ? "\u001b[46m" : "";
this.bwhite = this.enabled ? "\u001b[47m" : "";
}
// Thanks to http://ascii-table.com/ansi-escape-sequences.php for the following ANSI escape sequences
up(lines = 1) {
return this.enabled ? `\u001b[${lines}A` : "";
}
down(lines = 1) {
return this.enabled ? `\u001b[${lines}B` : "";
}
right(lines = 1) {
return this.enabled ? `\u001b[${lines}C` : "";
}
left(lines = 1) {
return this.enabled ? `\u001b[${lines}D` : "";
}
jump_to(x, y) {
return this.enabled ? `\u001b[${y};${x}H` : "";
}
cursor_pos_save() {
return this.enabled ? `\u001b[s` : "";
}
cursor_pos_restore() {
return this.enabled ? `\u001b[u` : "";
}
}
module.exports = new Ansi();

65
.docs/lib/FileFetcher.js Normal file
View File

@ -0,0 +1,65 @@
"use strict";
const path = require("path");
const fs = require("fs");
const os = require("os");
const phin = require("phin");
const a = require("./Ansi.js");
const pretty_ms = require("pretty-ms");
class FileFetcher {
#cache = [];
#pkg_obj = null;
constructor() {
}
fetch_file(url) {
let target_client = path.join(`/img`, path.basename(url));
if(this.#cache.includes(url)) return target_client;
this.#cache.push(url);
this.download_file(url); // Returns a promise! We fire-and-forget it though 'cause this function *must* be synchronous :-/
return target_client;
}
async download_file(url) {
const time_start = new Date();
if(this.#pkg_obj === null) {
this.#pkg_obj = JSON.parse(await fs.promises.readFile(
path.join(path.dirname(__dirname), "package.json"), "utf8"
));
}
let target_download = path.join(`_site/img`, path.basename(url));
const response = await phin({
url,
headers: {
"user-agent": `WorldEditAdditionsStaticBuilder/${this.#pkg_obj.version} (Node.js/${process.version}; ${os.platform()} ${os.arch()}) eleventy/${this.#pkg_obj.dependencies["@11ty/eleventy"].replace(/\^/, "")}`
},
followRedirects: true,
parse: 'none' // Returns a Buffer
// If we stream and pipe to a file, the build never ends :-/
});
await fs.promises.writeFile(target_download, response.body);
console.log([
`${a.fred}${a.hicol}FETCH_FILE${a.reset}`,
`${a.fyellow}${pretty_ms(new Date() - time_start)}${a.reset}`,
`${a.fgreen}${url}${a.reset}`
].join("\t"));
}
}
module.exports = FileFetcher;

154
.docs/lib/HTMLPicture.js Normal file
View File

@ -0,0 +1,154 @@
"use strict";
const os = require(`os`);
const fs = require("fs");
const path = require("path");
const pretty_ms = require("pretty-ms");
const debug = require("debug")("image");
const imagickal = require("imagickal");
const htmlentities = require("html-entities");
const a = require("./Ansi.js");
function calculate_size(width, height, size_spec) {
if(size_spec.indexOf("%") > -1) {
// It's a percentage
const multiplier = parseInt(size_spec.replace(/%/, ""), 10) / 100;
return {
width: Math.ceil(width * multiplier),
height: Math.ceil(height * multiplier)
};
}
else {
// It's an absolute image width
const new_width = parseInt(size_spec, 10);
return {
width: new_width,
height: Math.ceil(new_width/width * height)
};
}
}
// Main task list - we make sure it completes before exiting.
var queue = null;
async function make_queue() {
// 1: Setup task queue
const PQueue = (await import("p-queue")).default;
let concurrency = os.cpus().length;
if(process.env["MAX_CONCURRENT"])
concurrency = parseInt(process.env["MAX_CONCURRENT"], 10);
debug(`Image conversion queue concurrency: `, concurrency);
queue = new PQueue({ concurrency });
queue.on("idle", () => console.log(`IMAGE ${a.fcyan}all conversions complete${a.reset}`));
process.on("exit", async () => {
debug(`Waiting for image conversions to finish...`);
await queue.onEmpty();
debug(`All image conversions complete.`);
});
}
async function srcset(source_image, target_dir, urlpath, format = "__AUTO__", sizes = [ "25%", "50%", "100%" ], quality = 95, strip = true) {
if(queue === null) await make_queue();
const source_parsed = path.parse(source_image);
// ext contains the dot . already
const target_format = format == "__AUTO__" ? source_parsed.ext.replace(/\./g, "") : format;
const source_size = await imagickal.dimensions(source_image);
debug(`SOURCE_SIZE`, source_size, `TARGET_FORMAT`, target_format);
let setitems = await Promise.all(sizes.map(async (size) => {
let target_filename = `${source_parsed.name}_${size}.${target_format}`
.replace(/%/, "pcent");
let target_current = path.join(
target_dir,
target_filename
);
queue.add(async () => {
const start = new Date();
await imagickal.transform(source_image, target_current, {
resize: { width: size },
quality,
strip
});
console.log(`${a.fmagenta}${a.hicol}IMAGE${a.reset}\t${a.fcyan}${queue.size}/${queue.pending} tasks${a.reset}\t${a.fyellow}${pretty_ms(new Date() - start)}${a.reset}\t${a.fgreen}${target_current}${a.reset}`);
});
// const size_target = await imagickal.dimensions(target_current);
const predict = calculate_size(source_size.width, source_size.height, size);
// debug(`size spec:`, size, `size predicted: ${predict.width}x${predict.height} actual: ${size_target.width}x${size_target.height}`);
return `${path.resolve(urlpath, target_filename)} ${predict.width}w`;
}));
return setitems.join(", ");
}
/**
* Generates a string of HTML for a <picture> element, converting images to the specified formats in the process.
* @param {string} source_image The filepath to the source image.
* @param {string} alt The alt (alternative) text. Automatically run though htmlentities.
* @param {string} target_dir The target directory to save converted images to.
* @param {string} urlpath The path to the aforementionoed target directory as a URL. Image paths in the HTML will be prefixed with this value.
* @param {string} [formats="__AUTO__"] A list of formats to convert the source image to. Defaults to automatically determining the most optimal formats based on the input format. [must be lowercase]
* @param {Array} [sizes=["25%","50%", "100%" ]] The sizes, as imagemagick size specs, to convert the source image to.
* @param {Number} [quality=95] The quality value to use when converting images.
* @param {Boolean} [strip=true] Whether to strip all metadata from images when converting them [saves some space]
* @return {Promise<string>} A Promise that returns a generated string of HTML.
*/
async function picture(source_image, alt, target_dir, urlpath, formats = "__AUTO__", sizes = [ "25%", "50%", "100%" ], quality = 95, strip = true) {
const source_parsed = path.parse(source_image);
const source_format = source_parsed.ext.toLowerCase().replace(".", "");
if(formats == "__AUTO__") {
switch(source_format) {
case "png":
case "gif": // * shudder *
case "bmp":
formats = [ "png" ];
break;
default:
// jxl = JPEG XL <https://jpegxl.info/> - not currently supported by the old version of imagemagick shipped via apt :-/
// Imagemagick v7+ does support it, but isn't shipped yet :-(
formats = [ "jpeg", "webp", "avif", /*"jxl"*/ ];
break;
}
}
const target_original = path.join(target_dir, source_parsed.base);
await fs.promises.copyFile(source_image, target_original);
const sources = await Promise.all(formats.map(async (format) => {
debug(`${format} ${source_image}`);
return {
mime: `image/${format}`,
srcset: await srcset(
source_image,
target_dir, urlpath,
format, sizes,
quality, strip
)
};
}));
let result = `<picture>\n\t`;
result += sources.map(source => `<source srcset="${source.srcset}" type="${source.mime}" />`).join(`\n\t`);
result += `\n\t<img loading="lazy" decoding="async" src="${urlpath}/${source_parsed.base}" alt="${htmlentities.encode(alt)}" />\n`;
result += `</picture>\n`
return result;
}
var picture_memoize = null;
async function setup_memoize() {
const pMemoize = (await import("p-memoize")).default;
picture_memoize = pMemoize(picture);
}
module.exports = async function(...args) {
if(picture_memoize === null) await setup_memoize();
return await picture_memoize(...args);
};

View File

@ -0,0 +1,91 @@
"use strict";
const crypto = require("crypto");
const htmlentities = require("html-entities");
const markdown = require("markdown-it")({
xhtmlOut: true
});
const chroma = require("chroma-js");
const markdown_prism = require("markdown-it-prism");
markdown.use(markdown_prism, {
init: (Prism) => {
Prism.languages.weacmd = {
"string": /\<[^>]+?\>/,
"function": /^(?:\/\/\S+)\b/m,
"number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?%?/i,
"operator": /[<>:=\[\]|{}]/,
"keyword": /\b(?:[-+]?[zyx])\b/
}
}
});
function extract_title(line) {
return line.match(/#+\s+(.+)\s*/)[1].replace(/^`*|`*$/g, "")
}
function make_section(acc, cat_current, cats) {
let title = extract_title(acc[0]);
return {
category: cat_current,
category_colour: cats.get(cat_current),
category_colour_dark: chroma(cats.get(cat_current))
.set("hsl.s", 0.8)
.set("hsl.l", "*0.6")
.css("hsl"),
title: htmlentities.encode(title),
slug: title.toLowerCase().replace(/[^a-z0-9-_\s]+/gi, "")
.replace(/\s+/g, "-")
.replace(/-.*$/, ""),
content: markdown.render(acc.slice(1).join("\n"))
.replace(/<h4(\/?)>/g, "<h3$1>")
.replace(/<h5(\/?)>/g, "<h4$1>")
};
}
module.exports = function parse_sections(source) {
const cats = new Map();
source.match(/^##\s+.*$/gm)
.map(extract_title)
.map((item, i, all) => cats.set(
item,
chroma(`hsl(${i/all.length*(360-360/all.length)}, 60%, 90%)`).css("hsl")
));
const lines = source.split(/\r?\n/gi);
const result = [];
let acc = [];
let cat_current = null;
for(let line of lines) {
if(line.startsWith(`#`)) {
let heading_level = line.match(/^#+/)[0].length;
// 1: Deal with the previous section
if(acc.length > 0) {
let heading_level_prev = acc[0].match(/^#+/)[0].length;
if(heading_level_prev === 3 && acc.length > 0 && heading_level <= 3) {
result.push(make_section(acc, cat_current, cats));
}
}
// 2: Deal with the new line
if(heading_level === 2)
cat_current = extract_title(line);
if(heading_level > 3)
acc.push(line)
else
acc = [ line ];
}
else
acc.push(line);
}
if(acc.length > 0)
result.push(make_section(acc, cat_current, cats));
return { sections: result, categories: cats };
}

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

File diff suppressed because it is too large Load Diff

37
.docs/package.json Normal file
View File

@ -0,0 +1,37 @@
{
"name": "worldeditadditions",
"version": "1.14.5",
"description": "Documentation website for WorldEditAdditions",
"main": "index.js",
"private": true,
"scripts": {
"test": "echo \"No tests have been implemented yet\"",
"start": "npx @11ty/eleventy --serve",
"build": "npx @11ty/eleventy"
},
"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",
"dependencies": {
"@11ty/eleventy": "^2.0.1",
"chroma-js": "^2.4.2",
"clean-css": "^5.3.2",
"columnify": "^1.6.0",
"debug": "^4.3.4",
"html-entities": "^2.4.0",
"html-minifier-terser": "^7.0.0-beta.0",
"imagickal": "^5.0.1",
"markdown-it-prism": "^2.3.0",
"p-memoize": "^7.1.1",
"p-queue": "^7.3.4",
"phin": "^3.7.0",
"pretty-ms": "^7.0.1"
}
}

26
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
What's the bug? Be clear and concise in our explanation. Don't forget to include any context, error messages, logs, and screenshots required to understand the issue if applicable.
**Reproduction steps:**
Steps to reproduce the behaviour:
1. Go to '...'
2. Click on '....'
3. Enter this command to '....'
4. See error
**System information (please complete the following information):**
- **Operating system and version:** [e.g. iOS]
- **Minetest version:** [e.g. 5.8.0]
- **WorldEdit version:**
- **WorldEditAdditions version:**
Please add any other additional specific system information here too if you think it would help.

View File

@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
## Problem
A clear and concise description of what the problem you want to solve is. e.g. I'm always frustrated when [...]
## Solution
Describe clearly the solution you'd like.
## Alternatives
A clear and concise description of any alternative solutions or features you've considered, and how they relate to your proposed feature.
## Additional context
Add any other context or screenshots about the feature request here.
Don't forget to remove replace descriptions, but keep the headers.

52
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: "CI Tests"
on: [push]
jobs:
Syntax-Check:
runs-on: ubuntu-latest
steps:
# Checkout the git repo
- name: Checkout
uses: actions/checkout@v2
- name: Install apt dependencies
run: sudo apt-get --quiet install lua5.1
- name: Environment info
run: uname -a; lua -v
- name: Perform Check
run: find . -type f -name '*.lua' -not -path '*luarocks*' -not -path '*.git/*' -print0 | xargs -0 -n1 -P "$(nproc)" luac -p;
Busted:
runs-on: ubuntu-latest
steps:
# Checkout the git repo
- name: Checkout
uses: actions/checkout@v2
- name: Install apt dependencies
run: sudo apt-get --quiet install lua5.1 luarocks
- name: Environment info
run: uname -a; lua -v
- name: Set up tests
run: ./tests.sh run
- name: Run Tests
run: ./tests.sh run
LuaCheck:
runs-on: ubuntu-latest
steps:
# Checkout the git repo
- name: Checkout
uses: actions/checkout@v2
- name: Install apt dependencies
run: sudo apt-get --quiet install lua5.1 lua-check
- name: Environment info
run: uname -a; lua -v
- name: Run luacheck
run: luacheck .

199
.gitignore vendored
View File

@ -1,3 +1,26 @@
_site/
.luarocks/
# Created by https://www.toptal.com/developers/gitignore/api/git
# Edit at https://www.toptal.com/developers/gitignore?templates=git
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
# End of https://www.toptal.com/developers/gitignore/api/git
# Compiled Lua sources
luac.out
@ -39,3 +62,179 @@ luac.out
*.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
# VorTechnix stuff
.vdev/

39
.luacheckrc Normal file
View File

@ -0,0 +1,39 @@
quiet = 1
codes = true
exclude_files = {
".luarocks/*",
"worldeditadditions_core/utils/bit.lua"
}
files["worldeditadditions_core/register/check.lua"] = { read_globals = { "table" } }
ignore = {
"631", "61[124]",
"542",
"412",
"321/bit",
"21[123]"
}
-- Read-write globals (i.e. they can be defined)
globals = {
"worldedit",
"worldeditadditions",
"worldeditadditions_commands",
"worldeditadditions_core"
}
-- Read-only globals
read_globals = {
"minetest",
"vector",
"assert",
"bit",
"it",
"describe",
"bonemeal",
"dofile",
"PerlinNoise",
"Settings"
}
std = "max"

View File

@ -0,0 +1,35 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.abs", function()
it("should work with a positive vector", function()
local a = Vector3.new(16, 64, 16)
assert.are.same(
Vector3.new(16, 64, 16),
a:abs()
)
end)
it("should abs another positive vector", function()
local a = Vector3.new(9, 16, 25)
assert.are.same(
Vector3.new(9, 16, 25),
a:abs()
)
end)
it("should abs a negative vector", function()
local a = Vector3.new(-9, -16, -25)
assert.are.same(
Vector3.new(9, 16, 25),
a:abs()
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(9, -16, 25)
local result = a:abs()
assert.are.same(
Vector3.new(9, 16, 25),
result
)
assert.are_not.equal(result, a)
end)
end)

View File

@ -0,0 +1,80 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.add", function()
it("should add 2 positive vectors", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(1, 1, 1)
assert.are.same(
Vector3.new(4, 5, 6),
a:add(b)
)
end)
it("should support the add operator", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(1, 1, 1)
assert.are.same(
Vector3.new(4, 5, 6),
a + b
)
end)
it("should work with floats", function()
local a = Vector3.new(3.5, 4.5, 5.5)
local b = Vector3.new(1.1, 1.1, 1.1)
assert.are.same(
Vector3.new(4.6, 5.6, 6.6),
a + b
)
end)
it("should work with scalar a", function()
local a = 2
local b = Vector3.new(6, 7, 8)
assert.are.same(
Vector3.new(8, 9, 10),
a + b
)
end)
it("should work with scalar b", function()
local a = Vector3.new(6, 7, 8)
local b = 2
assert.are.same(
Vector3.new(8, 9, 10),
a + b
)
end)
it("should handle negative b", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(-1, -1, -1)
assert.are.same(
Vector3.new(2, 3, 4),
a + b
)
end)
it("should handle negative a", function()
local a = Vector3.new(-3, -4, -5)
local b = Vector3.new(1, 1, 1)
assert.are.same(
Vector3.new(-2, -3, -4),
a + b
)
end)
it("should handle negative a and b", function()
local a = Vector3.new(-3, -4, -5)
local b = Vector3.new(-1, -1, -1)
assert.are.same(
Vector3.new(-4, -5, -6),
a + b
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(1, 1, 1)
local result = a + b
assert.are.same(
Vector3.new(4, 5, 6),
result
)
assert.are_not.equal(result, a)
assert.are_not.equal(result, b)
end)
end)

View File

@ -0,0 +1,25 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.area", function()
it("should work with a positive vector", function()
local a = Vector3.new(3, 3, 3)
assert.are.equal(
27,
a:area()
)
end)
it("should work with a negative vector", function()
local a = Vector3.new(-4, -4, -4)
assert.are.equal(
-64,
a:area()
)
end)
it("should work with a mixed vector", function()
local a = Vector3.new(-3, 3, -3)
assert.are.equal(
27,
a:area()
)
end)
end)

View File

@ -0,0 +1,35 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.ceil", function()
it("should ceil a positive vector", function()
local a = Vector3.new(3.1, 4.2, 5.8)
assert.are.same(
Vector3.new(4, 5, 6),
a:ceil()
)
end)
it("should ceil a negative vector", function()
local a = Vector3.new(-3.1, -4.2, -5.3)
assert.are.same(
Vector3.new(-3, -4, -5),
a:ceil()
)
end)
it("should work with integers", function()
local a = Vector3.new(3, 4, 5)
assert.are.same(
a:ceil(),
Vector3.new(3, 4, 5)
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(3.1, 4.7, 5.99999)
local result = a:ceil()
assert.are.same(
Vector3.new(4, 5, 6),
result
)
assert.are_not.equal(result, a)
end)
end)

View File

@ -0,0 +1,100 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.clamp", function()
it("should work by not changing values if it's already clamped", function()
local a = Vector3.new(5, 6, 7)
local pos1 = Vector3.new(0, 0, 0)
local pos2 = Vector3.new(10, 10, 10)
local result = Vector3.clamp(a, pos1, pos2)
assert.are.same(
Vector3.new(5, 6, 7),
result
)
result.z = 999
assert.are.same(Vector3.new(5, 6, 7), a)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(10, 10, 10), pos2)
end)
it("should work with positive vectors", function()
local a = Vector3.new(30, 3, 3)
local pos1 = Vector3.new(0, 0, 0)
local pos2 = Vector3.new(10, 10, 10)
assert.are.same(
Vector3.new(10, 3, 3),
Vector3.clamp(a, pos1, pos2)
)
end)
it("should work with multiple positive vectors", function()
local a = Vector3.new(30, 99, 88)
local pos1 = Vector3.new(4, 4, 4)
local pos2 = Vector3.new(13, 13, 13)
assert.are.same(
Vector3.new(13, 13, 13),
Vector3.clamp(a, pos1, pos2)
)
end)
it("should work with multiple positive vectors with an irregular defined region", function()
local a = Vector3.new(30, 99, 88)
local pos1 = Vector3.new(1, 5, 3)
local pos2 = Vector3.new(10, 15, 8)
assert.are.same(
Vector3.new(10, 15, 8),
Vector3.clamp(a, pos1, pos2)
)
end)
it("should work with multiple negative vectors", function()
local a = Vector3.new(-30, -99, -88)
local pos1 = Vector3.new(4, 4, 4)
local pos2 = Vector3.new(13, 13, 13)
assert.are.same(
Vector3.new(4, 4, 4),
Vector3.clamp(a, pos1, pos2)
)
end)
it("should work with multiple negative vectors with an irregular defined region", function()
local a = Vector3.new(-30, -99, -88)
local pos1 = Vector3.new(1, 5, 3)
local pos2 = Vector3.new(10, 15, 8)
assert.are.same(
Vector3.new(1, 5, 3),
Vector3.clamp(a, pos1, pos2)
)
end)
it("should work with multiple negative vectors with an irregular defined region with mixed signs", function()
local a = Vector3.new(-30, -99, -88)
local pos1 = Vector3.new(-1, 5, 3)
local pos2 = Vector3.new(10, 15, 8)
assert.are.same(
Vector3.new(-1, 5, 3),
Vector3.clamp(a, pos1, pos2)
)
end)
it("should return new Vector3 instances", function()
local a = Vector3.new(30, 3, 3)
local pos1 = Vector3.new(0, 0, 0)
local pos2 = Vector3.new(10, 10, 10)
local result = Vector3.clamp(a, pos1, pos2)
assert.are.same(Vector3.new(10, 3, 3), result)
result.y = 999
assert.are.same(Vector3.new(30, 3, 3), a)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(10, 10, 10), pos2)
end)
end)

View File

@ -0,0 +1,20 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.clone", function()
it("should return a new Vector3 instance", function()
local a = Vector3.new(3, 4, 5)
local result = a:clone()
result.x = 4
assert.are.same(Vector3.new(3, 4, 5), a)
assert.are.same(Vector3.new(4, 4, 5), result)
end)
it("should return a new Vector3 instance for a different vector", function()
local a = Vector3.new(-99, 66, 88)
local result = a:clone()
result.y = -44
assert.are.same(Vector3.new(-99, 66, 88), a)
assert.are.same(Vector3.new(-99, -44, 88), result)
end)
end)

View File

@ -0,0 +1,28 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.__concat", function()
it("should work when concatenating a Vector3 + Vector3", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(6, 7, 8)
assert.are.is_true(
type(tostring(a .. b)) == "string"
)
end)
it("should work when concatenating a string + Vector3", function()
local a = "yay"
local b = Vector3.new(6, 7, 8)
assert.are.is_true(
type(tostring(a .. b)) == "string"
)
end)
it("should work when concatenating a Vector3 + string", function()
local a = Vector3.new(3, 4, 5)
local b = "yay"
assert.are.is_true(
type(tostring(a .. b)) == "string"
)
end)
end)

View File

@ -0,0 +1,80 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.divide", function()
it("should divide 2 positive vectors", function()
local a = Vector3.new(30, 40, 50)
local b = Vector3.new(2, 2, 2)
assert.are.same(
Vector3.new(15, 20, 25),
a:divide(b)
)
end)
it("should work with the div alias", function()
local a = Vector3.new(30, 40, 50)
local b = Vector3.new(2, 2, 2)
assert.are.same(
Vector3.new(15, 20, 25),
a:div(b)
)
end)
it("should work with scalar a", function()
local a = 100
local b = Vector3.new(4, 5, 2)
assert.are.same(
Vector3.new(25, 20, 50),
a / b
)
end)
it("should work with scalar b", function()
local a = Vector3.new(6, 8, 10)
local b = 2
assert.are.same(
Vector3.new(3, 4, 5),
a / b
)
end)
it("should support the divide operator", function()
local a = Vector3.new(10, 12, 14)
local b = Vector3.new(2, 3, 2)
assert.are.same(
Vector3.new(5, 4, 7),
a / b
)
end)
it("should handle negative b", function()
local a = Vector3.new(30, 40, 50)
local b = Vector3.new(-2, -2, -2)
assert.are.same(
Vector3.new(-15, -20, -25),
a / b
)
end)
it("should handle negative a", function()
local a = Vector3.new(-30, -40, -50)
local b = Vector3.new(2, 4, 2)
assert.are.same(
Vector3.new(-15, -10, -25),
a / b
)
end)
it("should handle negative a and b", function()
local a = Vector3.new(-30, -40, -50)
local b = Vector3.new(-2, -2, -2)
assert.are.same(
Vector3.new(15, 20, 25),
a / b
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(9, 12, 15)
local b = Vector3.new(3, 3, 3)
local result = a / b
assert.are.same(
Vector3.new(3, 4, 5),
result
)
assert.are_not.equal(result, a)
assert.are_not.equal(result, b)
end)
end)

View File

@ -0,0 +1,36 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.dot", function()
it("should work with a positive vector", function()
local a = Vector3.new(3, 3, 3)
local b = Vector3.new(4, 5, 6)
assert.are.equal(
45,
a:dot(b)
)
end)
it("should work with a negative vector", function()
local a = Vector3.new(-4, -4, -4)
local b = Vector3.new(4, 5, 6)
assert.are.equal(
-60,
a:dot(b)
)
end)
it("should work with a mixed vector", function()
local a = Vector3.new(-3, 3, -3)
local b = Vector3.new(7, 8, 9)
assert.are.equal(
-24,
a:dot(b)
)
end)
it("should work with the dot_product alias", function()
local a = Vector3.new(-3, 3, -3)
local b = Vector3.new(7, 8, 9)
assert.are.equal(
-24,
a:dot_product(b)
)
end)
end)

View File

@ -0,0 +1,40 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.equals", function()
it("should return true when identical", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(3, 4, 5)
assert.are.same(
true,
a:equals(b)
)
end)
it("should return false when not identical", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(6, 7, 8)
assert.are.same(
false,
a:equals(b)
)
end)
it("should return false when not identical x", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(4, 4, 5)
assert.are.same(
false,
a:equals(b)
)
end)
it("should return false when not identical y", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(3, 5, 5)
assert.are.same(
false,
a:equals(b)
)
end)
end)

View File

@ -0,0 +1,48 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.expand_region", function()
it("should work with positive vectors", function()
local a = Vector3.new(16, 64, 16)
local b = Vector3.new(1, 4, 6)
local target = Vector3.new(99, 99, 99)
local result_a, result_b = target:expand_region(a, b)
assert.are.same(Vector3.new(1, 4, 6), result_a)
assert.are.same(Vector3.new(99, 99, 99), result_b)
end)
it("should work with mixed components", function()
local a = Vector3.new(16, 1, 16)
local b = Vector3.new(1, 4, 60)
local target = Vector3.new(-99, -99, -99)
local result_a, result_b = target:expand_region(a, b)
assert.are.same(Vector3.new(-99, -99, -99), result_a)
assert.are.same(Vector3.new(16, 4, 60), result_b)
end)
it("should work with negative vectors", function()
local a = Vector3.new(-9, -16, -25)
local b = Vector3.new(-3, -6, -2)
local target = Vector3.new(-99, -99, -99)
local result_a, result_b = target:expand_region(a, b)
assert.are.same(Vector3.new(-99, -99, -99), result_a)
assert.are.same(Vector3.new(-3, -6, -2), result_b)
end)
it("should return new Vector3 instances", function()
local a = Vector3.new(16, 1, 16)
local b = Vector3.new(1, 4, 60)
local target = Vector3.new(99, 99, 99)
local result_a, result_b = target:expand_region(a, b)
assert.are.same(Vector3.new(1, 1, 16), result_a)
assert.are.same(Vector3.new(99, 99, 99), result_b)
result_a.y = 999
result_b.y = 999
assert.are.same(Vector3.new(16, 1, 16), a)
assert.are.same(Vector3.new(1, 4, 60), b)
assert.are.same(Vector3.new(1, 999, 16), result_a)
assert.are.same(Vector3.new(99, 999, 99), result_b)
end)
end)

View File

@ -0,0 +1,35 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.floor", function()
it("should floor a positive vector", function()
local a = Vector3.new(3.1, 4.75, 5.9)
assert.are.same(
Vector3.new(3, 4, 5),
a:floor()
)
end)
it("should floor a negative vector", function()
local a = Vector3.new(-3.1, -4.2, -5.3)
assert.are.same(
Vector3.new(-4, -5, -6),
a:floor()
)
end)
it("should work with integers", function()
local a = Vector3.new(3, 4, 5)
assert.are.same(
Vector3.new(3, 4, 5),
a:floor()
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(3.1, 4.7, 5.99999)
local result = a:floor()
assert.are.same(
Vector3.new(3, 4, 5),
result
)
assert.are_not.equal(result, a)
end)
end)

View File

@ -0,0 +1,44 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.is_contained", function()
it("should return true when inside", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(30, 40, 50)
local target = Vector3.new(6, 6, 6)
assert.are.same(
true,
target:is_contained(a, b)
)
end)
it("should return false when outside x", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(30, 40, 50)
local target = Vector3.new(60, 6, 6)
assert.are.same(
false,
target:is_contained(a, b)
)
end)
it("should return false when outside y", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(30, 40, 50)
local target = Vector3.new(6, 60, 6)
assert.are.same(
false,
target:is_contained(a, b)
)
end)
it("should return false when outside z", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(30, 40, 50)
local target = Vector3.new(6, 6, 60)
assert.are.same(
false,
target:is_contained(a, b)
)
end)
end)

View File

@ -0,0 +1,30 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
-- To find these numbers, in Javascript:
-- function t(x) { return Math.sqrt((x*x)*3); }
-- for(let i = 0; i < 1000000000; i++) { let r = t(i); if(Math.floor(r) === r) console.log(`i ${i}, r ${r}`); }
describe("Vector3.length", function()
it("should work with a positive vector", function()
local a = Vector3.new(80198051, 80198051, 80198051)
assert.are.equal(
138907099,
a:length()
)
end)
it("should work with a negative vector", function()
local a = Vector3.new(-189750626, -189750626, -189750626)
assert.are.equal(
328657725,
a:length()
)
end)
it("should work with a mixed vector", function()
local a = Vector3.new(-371635731, 371635731, -371635731)
assert.are.equal(
643691968,
a:length()
)
end)
end)

View File

@ -0,0 +1,25 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.length_squared", function()
it("should work with a positive vector", function()
local a = Vector3.new(3, 3, 3)
assert.are.equal(
27,
a:length_squared()
)
end)
it("should work with a negative vector", function()
local a = Vector3.new(-4, -4, -4)
assert.are.equal(
48,
a:length_squared()
)
end)
it("should work with a mixed vector", function()
local a = Vector3.new(-3, 3, -3)
assert.are.equal(
27,
a:length_squared()
)
end)
end)

View File

@ -0,0 +1,56 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.limit_to", function()
it("should limit_to a positive vector", function()
local a = Vector3.new(801980510, 801980510, 801980510)
assert.are.same(
Vector3.new(80198051, 80198051, 80198051),
a:limit_to(138907099)
)
end)
it("should limit_to a negative vector", function()
local a = Vector3.new(-1897506260, -1897506260, -1897506260)
assert.are.same(
Vector3.new(-189750626, -189750626, -189750626),
a:limit_to(328657725)
)
end)
it("should work if the length is borderline", function()
local a = Vector3.new(80198051, 80198051, 80198051)
assert.are.same(
Vector3.new(80198051, 80198051, 80198051),
a:limit_to(138907099)
)
end)
it("should not change anything if the length is smaller", function()
local a = Vector3.new(3, 4, 5)
assert.are.same(
Vector3.new(3, 4, 5),
a:limit_to(100)
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(801980510, 801980510, 801980510)
local result = a:limit_to(138907099)
assert.are.same(
Vector3.new(80198051, 80198051, 80198051),
result
)
a.x = 4
assert.are.same(Vector3.new(4, 801980510, 801980510), a)
assert.are.same(Vector3.new(80198051, 80198051, 80198051), result)
end)
it("should return a new Vector3 instance if the length is smaller", function()
local a = Vector3.new(3, 4, 5)
local result = a:limit_to(101)
assert.are.same(
Vector3.new(3, 4, 5),
result
)
a.x = 40
assert.are.same(Vector3.new(40, 4, 5), a)
assert.are.same(Vector3.new(3, 4, 5), result)
end)
end)

View File

@ -0,0 +1,62 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.max", function()
it("should work with positive vectors", function()
local a = Vector3.new(16, 64, 16)
local b = Vector3.new(1, 4, 6)
assert.are.same(
Vector3.new(16, 64, 16),
Vector3.max(a, b)
)
end)
it("should work with mixed components", function()
local a = Vector3.new(16, 1, 16)
local b = Vector3.new(1, 4, 60)
assert.are.same(
Vector3.new(16, 4, 60),
Vector3.max(a, b)
)
end)
it("should work with scalar numbers", function()
local a = Vector3.new(16, 1, 16)
local b = 2
assert.are.same(
Vector3.new(16, 2, 16),
Vector3.max(a, b)
)
end)
it("should work with scalar numbers both ways around", function()
local a = Vector3.new(16, 1, 16)
local b = 2
assert.are.same(
Vector3.new(16, 2, 16),
Vector3.max(b, a)
)
end)
it("should work with negative vectors", function()
local a = Vector3.new(-9, -16, -25)
local b = Vector3.new(-3, -6, -2)
assert.are.same(
Vector3.new(-3, -6, -2),
Vector3.max(a, b)
)
end)
it("should return new Vector3 instances", function()
local a = Vector3.new(16, 1, 16)
local b = Vector3.new(1, 4, 60)
local result = Vector3.max(a, b)
assert.are.same(Vector3.new(16, 4, 60), result)
result.y = 999
assert.are.same(Vector3.new(16, 1, 16), a)
assert.are.same(Vector3.new(1, 4, 60), b)
assert.are.same(Vector3.new(16, 999, 60), result)
end)
end)

View File

@ -0,0 +1,39 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.max_component", function()
it("should work with a positive vector x", function()
local a = Vector3.new(30, 4, 5)
assert.are.equal(
30,
a:max_component()
)
end)
it("should work with a positive vector y", function()
local a = Vector3.new(3, 10, 5)
assert.are.equal(
10,
a:max_component()
)
end)
it("should work with a positive vector z", function()
local a = Vector3.new(3, 1, 50.5)
assert.are.equal(
50.5,
a:max_component()
)
end)
it("should work with a negative vector", function()
local a = Vector3.new(-4, -5, -1)
assert.are.equal(
-1,
a:max_component()
)
end)
it("should work with a mixed vector", function()
local a = Vector3.new(-30, 3, -3)
assert.are.equal(
3,
a:max_component()
)
end)
end)

View File

@ -0,0 +1,47 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.mean", function()
it("should work with a positive vector", function()
local a = Vector3.new(2, 2, 2)
local b = Vector3.new(4, 4, 4)
assert.are.same(
Vector3.new(3, 3, 3),
a:mean(b)
)
end)
it("should work with a positive vector the other way around", function()
local a = Vector3.new(2, 2, 2)
local b = Vector3.new(4, 4, 4)
assert.are.same(
Vector3.new(3, 3, 3),
b:mean(a)
)
end)
it("should mean another positive vector", function()
local a = Vector3.new(6, 6, 6)
local b = Vector3.new(10, 10, 10)
assert.are.same(
Vector3.new(8, 8, 8),
a:mean(b)
)
end)
it("should mean a negative vector", function()
local a = Vector3.new(-2, -2, -2)
local b = Vector3.new(0, 0, 0)
assert.are.same(
Vector3.new(-1, -1, -1),
a:mean(b)
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(6, 6, 6)
local b = Vector3.new(10, 10, 10)
assert.are.same(
Vector3.new(8, 8, 8),
a:mean(b)
)
assert.are.same(Vector3.new(6, 6, 6), a)
assert.are.same(Vector3.new(10, 10, 10), b)
end)
end)

View File

@ -0,0 +1,62 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.min", function()
it("should work with positive vectors", function()
local a = Vector3.new(16, 64, 16)
local b = Vector3.new(1, 4, 6)
assert.are.same(
Vector3.new(1, 4, 6),
Vector3.min(a, b)
)
end)
it("should work with mixed components", function()
local a = Vector3.new(16, 1, 16)
local b = Vector3.new(1, 4, 60)
assert.are.same(
Vector3.new(1, 1, 16),
Vector3.min(a, b)
)
end)
it("should work with scalar numbers", function()
local a = Vector3.new(16, 1, 16)
local b = 2
assert.are.same(
Vector3.new(2, 1, 2),
Vector3.min(a, b)
)
end)
it("should work with scalar numbers both ways around", function()
local a = Vector3.new(16, 1, 16)
local b = 2
assert.are.same(
Vector3.new(2, 1, 2),
Vector3.min(b, a)
)
end)
it("should work with negative vectors", function()
local a = Vector3.new(-9, -16, -25)
local b = Vector3.new(-3, -6, -2)
assert.are.same(
Vector3.new(-9, -16, -25),
Vector3.min(a, b)
)
end)
it("should return new Vector3 instances", function()
local a = Vector3.new(16, 1, 16)
local b = Vector3.new(1, 4, 60)
local result = Vector3.min(a, b)
assert.are.same(Vector3.new(1, 1, 16), result)
result.y = 999
assert.are.same(Vector3.new(16, 1, 16), a)
assert.are.same(Vector3.new(1, 4, 60), b)
assert.are.same(Vector3.new(1, 999, 16), result)
end)
end)

View File

@ -0,0 +1,39 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.min_component", function()
it("should work with a positive vector x", function()
local a = Vector3.new(3, 4, 5)
assert.are.equal(
3,
a:min_component()
)
end)
it("should work with a positive vector y", function()
local a = Vector3.new(3, 1, 5)
assert.are.equal(
1,
a:min_component()
)
end)
it("should work with a positive vector z", function()
local a = Vector3.new(3, 1, 0.5)
assert.are.equal(
0.5,
a:min_component()
)
end)
it("should work with a negative vector", function()
local a = Vector3.new(-4, -5, -46)
assert.are.equal(
-46,
a:min_component()
)
end)
it("should work with a mixed vector", function()
local a = Vector3.new(-30, 3, -3)
assert.are.equal(
-30,
a:min_component()
)
end)
end)

View File

@ -0,0 +1,17 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
-- To find these numbers, in Javascript:
-- function t(x) { return Math.sqrt((x*x)*3); }
-- for(let i = 0; i < 1000000000; i++) { let r = t(i); if(Math.floor(r) === r) console.log(`i ${i}, r ${r}`); }
describe("Vector3.move_towards", function()
it("should work with a positive vector", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(10, 10, 10)
assert.are.same(
Vector3.new(5.0022714374157439821, 5.7162326606420661435, 6.4301938838683883048),
a:move_towards(b, 3)
)
end)
end)

View File

@ -0,0 +1,80 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.multiply", function()
it("should multiply 2 positive vectors", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(2, 2, 2)
assert.are.same(
Vector3.new(6, 8, 10),
a:multiply(b)
)
end)
it("should work with the mul alias", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(2, 2, 2)
assert.are.same(
Vector3.new(6, 8, 10),
a:mul(b)
)
end)
it("should work with scalar a", function()
local a = 2
local b = Vector3.new(6, 7, 8)
assert.are.same(
Vector3.new(12, 14, 16),
a * b
)
end)
it("should work with scalar b", function()
local a = Vector3.new(6, 7, 8)
local b = 2
assert.are.same(
Vector3.new(12, 14, 16),
a * b
)
end)
it("should support the multiply operator", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(2, 2, 2)
assert.are.same(
Vector3.new(6, 8, 10),
a * b
)
end)
it("should handle negative b", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(-1, -1, -1)
assert.are.same(
Vector3.new(-3, -4, -5),
a * b
)
end)
it("should handle negative a", function()
local a = Vector3.new(-3, -4, -5)
local b = Vector3.new(2, 2, 2)
assert.are.same(
Vector3.new(-6, -8, -10),
a * b
)
end)
it("should handle negative a and b", function()
local a = Vector3.new(-3, -4, -5)
local b = Vector3.new(-2, -2, -2)
assert.are.same(
Vector3.new(6, 8, 10),
a * b
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(3, 3, 3)
local result = a * b
assert.are.same(
Vector3.new(9, 12, 15),
result
)
assert.are_not.equal(result, a)
assert.are_not.equal(result, b)
end)
end)

View File

@ -0,0 +1,31 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.add", function()
it("should create a new Vector3", function()
assert.are.same(
{ x = 3, y = 4, z = 5 },
Vector3.new(3, 4, 5)
)
end)
it("should default to (0, 0, 0)", function()
assert.are.same(
{ x = 0, y = 0, z = 0 },
Vector3.new()
)
end)
it("should not throw an error on invalid x", function()
assert.has_no.errors(function()
Vector3.new("cheese", 4, 5)
end)
end)
it("should not throw an error on invalid y", function()
assert.has_no.errors(function()
Vector3.new(4, "cheese", 5)
end)
end)
it("should not throw an error on invalid z", function()
assert.has_no.errors(function()
Vector3.new(66, 2, "cheese")
end)
end)
end)

View File

@ -0,0 +1,132 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.rotate3d", function()
it("should work with an origin of (0,0,0) X axis", function()
local origin = Vector3.new(0, 0, 0)
local point = Vector3.new(0, 1, 0)
local rotate = Vector3.new(
math.rad(180), -- x axis = yz plane
math.rad(0), -- y axis = xz plane
math.rad(0)-- z axis = xy plane
)
assert.are.same(
Vector3.new(0, -1, 0),
Vector3.rotate3d(origin, point, rotate):round_dp(4)
)
end)
it("should work with an origin of (0,0,0) Y axis", function()
local origin = Vector3.new(0, 0, 0)
local point = Vector3.new(1, 0, 0)
local rotate = Vector3.new(
math.rad(0), -- x axis = yz plane
math.rad(180), -- y axis = xz plane
math.rad(0)-- z axis = xy plane
)
assert.are.same(
Vector3.new(-1, 0, 0),
Vector3.rotate3d(origin, point, rotate):round_dp(4)
)
end)
it("should work with an origin of (0,0,0) Z axis", function()
local origin = Vector3.new(0, 0, 0)
local point = Vector3.new(1, 0, 0)
local rotate = Vector3.new(
math.rad(0), -- x axis = yz plane
math.rad(0), -- y axis = xz plane
math.rad(180)-- z axis = xy plane
)
assert.are.same(
Vector3.new(-1, 0, 0),
Vector3.rotate3d(origin, point, rotate):round_dp(4)
)
end)
it("should work with a non-zero origin X axis", function()
local origin = Vector3.new(1, 1, 1)
local point = Vector3.new(0, 2, 0)
local rotate = Vector3.new(
math.rad(180), -- x axis = yz plane
math.rad(0), -- y axis = xz plane
math.rad(0)-- z axis = xy plane
)
assert.are.same(
Vector3.new(0, 0, 2),
Vector3.rotate3d(origin, point, rotate):round_dp(4)
)
end)
it("should work with a non-zero origin Y axis", function()
local origin = Vector3.new(1, 1, 1)
local point = Vector3.new(0, 2, 0)
local rotate = Vector3.new(
math.rad(0), -- x axis = yz plane
math.rad(180), -- y axis = xz plane
math.rad(0)-- z axis = xy plane
)
assert.are.same(
Vector3.new(2, 2, 2),
Vector3.rotate3d(origin, point, rotate):round_dp(4)
)
end)
it("should work with a non-zero origin Z axis", function()
local origin = Vector3.new(1, 1, 1)
local point = Vector3.new(0, 2, 0)
local rotate = Vector3.new(
math.rad(0), -- x axis = yz plane
math.rad(0), -- y axis = xz plane
math.rad(180)-- z axis = xy plane
)
assert.are.same(
Vector3.new(2, 0, 0),
Vector3.rotate3d(origin, point, rotate):round_dp(4)
)
end)
it("should work with a non-zero origin Z axis -90 degrees", function()
local origin = Vector3.new(1, 1, 1)
local point = Vector3.new(0, 2, 0)
local rotate = Vector3.new(
math.rad(0), -- x axis = yz plane
math.rad(0), -- y axis = xz plane
math.rad(-90)-- z axis = xy plane
)
assert.are.same(
Vector3.new(2, 2, 0),
Vector3.rotate3d(origin, point, rotate):round_dp(4)
)
end)
it("should work with multiple axes X Y", function()
local origin = Vector3.new(0, 0, 0)
local point = Vector3.new(0, 2, 0)
local rotate = Vector3.new(
math.rad(90), -- x axis = yz plane
math.rad(90), -- y axis = xz plane
math.rad(0)-- z axis = xy plane
)
assert.are.same(
Vector3.new(2, 0, 0),
Vector3.rotate3d(origin, point, rotate):round_dp(4)
)
end)
it("should return new Vector3 instances", function()
local origin = Vector3.new(0, 0, 0)
local point = Vector3.new(1, 0, 0)
local rotate = Vector3.new(
math.rad(0), -- x axis = yz plane
math.rad(180), -- y axis = xz plane
math.rad(0)-- z axis = xy plane
)
local result = Vector3.rotate3d(origin, point, rotate):round(4)
assert.are.same(Vector3.new(-1, 0, 0), result)
result.y = 999
assert.are.same(Vector3.new(0, 0, 0), origin)
assert.are.same(Vector3.new(1, 0, 0), point)
assert.are.same(Vector3.new(-1, 999, 0), result)
end)
end)

View File

@ -0,0 +1,35 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.round", function()
it("should round a positive vector", function()
local a = Vector3.new(3.1, 4.75, 5.9)
assert.are.same(
Vector3.new(3, 5, 6),
a:round()
)
end)
it("should round a negative vector", function()
local a = Vector3.new(-3.1, -4.2, -5.3)
assert.are.same(
Vector3.new(-3, -4, -5),
a:round()
)
end)
it("should work with integers", function()
local a = Vector3.new(3, 4, 5)
assert.are.same(
Vector3.new(3, 4, 5),
a:round()
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(3.1, 4.7, 5.99999)
local result = a:round()
assert.are.same(
Vector3.new(3, 5, 6),
result
)
assert.are_not.equal(result, a)
end)
end)

View File

@ -0,0 +1,52 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.set_to", function()
it("should set_to a positive vector", function()
local a = Vector3.new(801980510, 801980510, 801980510)
assert.are.same(
Vector3.new(80198051, 80198051, 80198051),
a:set_to(138907099)
)
end)
it("should set_to a negative vector", function()
local a = Vector3.new(-1897506260, -1897506260, -1897506260)
assert.are.same(
Vector3.new(-189750626, -189750626, -189750626),
a:set_to(328657725)
)
end)
it("should work if the length is borderline", function()
local a = Vector3.new(80198051, 80198051, 80198051)
assert.are.same(
Vector3.new(80198051, 80198051, 80198051),
a:set_to(138907099)
)
end)
it("should work if the length is smaller", function()
local a = Vector3.new(80198051, 80198051, 80198051)
assert.are.same(
Vector3.new(109552575, 109552575, 109552575),
a:set_to(189750626):floor() -- Hack to ignore flating-point errors. In theory we should really use epsilon here instead
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(801980510, 801980510, 801980510)
local result = a:set_to(138907099)
assert.are.same(
Vector3.new(80198051, 80198051, 80198051),
result
)
assert.are_not.equal(result, a)
end)
it("should return a new Vector3 instance if the length is smaller", function()
local a = Vector3.new(80198051, 80198051, 80198051)
local result = a:set_to(189750626):floor()
assert.are.same(
Vector3.new(109552575, 109552575, 109552575),
result
)
assert.are_not.equal(result, a)
end)
end)

View File

@ -0,0 +1,35 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.snap_to", function()
it("should snap_to a positive vector", function()
local a = Vector3.new(3.1, 4.75, 5.9)
assert.are.same(
Vector3.new(0, 0, 10),
a:snap_to(10)
)
end)
it("should snap_to a negative vector", function()
local a = Vector3.new(-2.5, -4.2, -5.3)
assert.are.same(
Vector3.new(0, -6, -6),
a:snap_to(6)
)
end)
it("should work with integers", function()
local a = Vector3.new(3, 4, 5)
assert.are.same(
Vector3.new(3, 3, 6),
a:snap_to(3)
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(3.1, 4.7, 5.99999)
local result = a:snap_to(3)
assert.are.same(
Vector3.new(3, 6, 6),
result
)
assert.are_not.equal(result, a)
end)
end)

View File

@ -0,0 +1,44 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.sort", function()
it("should work with positive vectors", function()
local a = Vector3.new(16, 64, 16)
local b = Vector3.new(1, 4, 6)
local result_a, result_b = Vector3.sort(a, b)
assert.are.same(Vector3.new(1, 4, 6), result_a)
assert.are.same(Vector3.new(16, 64, 16), result_b)
end)
it("should work with mixed components", function()
local a = Vector3.new(16, 1, 16)
local b = Vector3.new(1, 4, 60)
local result_a, result_b = Vector3.sort(a, b)
assert.are.same(Vector3.new(1, 1, 16), result_a)
assert.are.same(Vector3.new(16, 4, 60), result_b)
end)
it("should work with negative vectors", function()
local a = Vector3.new(-9, -16, -25)
local b = Vector3.new(-3, -6, -2)
local result_a, result_b = Vector3.sort(a, b)
assert.are.same(Vector3.new(-9, -16, -25), result_a)
assert.are.same(Vector3.new(-3, -6, -2), result_b)
end)
it("should return new Vector3 instances", function()
local a = Vector3.new(16, 1, 16)
local b = Vector3.new(1, 4, 60)
local result_a, result_b = Vector3.sort(a, b)
assert.are.same(Vector3.new(1, 1, 16), result_a)
assert.are.same(Vector3.new(16, 4, 60), result_b)
result_a.y = 999
result_b.y = 999
assert.are.same(Vector3.new(16, 1, 16), a)
assert.are.same(Vector3.new(1, 4, 60), b)
assert.are.same(Vector3.new(1, 999, 16), result_a)
assert.are.same(Vector3.new(16, 999, 60), result_b)
end)
end)

View File

@ -0,0 +1,28 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.sqrt", function()
it("should sqrt a positive vector", function()
local a = Vector3.new(16, 64, 16)
assert.are.same(
Vector3.new(4, 8, 4),
a:sqrt()
)
end)
it("should sqrt another positive vector", function()
local a = Vector3.new(9, 16, 25)
assert.are.same(
Vector3.new(3, 4, 5),
a:sqrt()
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(9, 16, 25)
local result = a:sqrt()
assert.are.same(
Vector3.new(3, 4, 5),
result
)
assert.are_not.equal(result, a)
end)
end)

View File

@ -0,0 +1,80 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.subtract", function()
it("should subtract 2 positive vectors", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(1, 1, 1)
assert.are.same(
Vector3.new(2, 3, 4),
a:subtract(b)
)
end)
it("should work with the sub alias", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(1, 1, 1)
assert.are.same(
Vector3.new(2, 3, 4),
a:sub(b)
)
end)
it("should work with scalar a", function()
local a = 2
local b = Vector3.new(6, 7, 8)
assert.are.same(
Vector3.new(4, 5, 6),
a - b
)
end)
it("should work with scalar b", function()
local a = Vector3.new(6, 7, 8)
local b = 2
assert.are.same(
Vector3.new(4, 5, 6),
a - b
)
end)
it("should support the subtract operator", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(1, 1, 1)
assert.are.same(
Vector3.new(2, 3, 4),
a - b
)
end)
it("should handle negative b", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(-1, -1, -1)
assert.are.same(
Vector3.new(4, 5, 6),
a - b
)
end)
it("should handle negative a", function()
local a = Vector3.new(-3, -4, -5)
local b = Vector3.new(1, 1, 1)
assert.are.same(
Vector3.new(-4, -5, -6),
a - b
)
end)
it("should handle negative a and b", function()
local a = Vector3.new(-3, -4, -5)
local b = Vector3.new(-1, -1, -1)
assert.are.same(
Vector3.new(-2, -3, -4),
a - b
)
end)
it("should return a new Vector3 instance", function()
local a = Vector3.new(3, 4, 5)
local b = Vector3.new(1, 1, 1)
local result = a - b
assert.are.same(
Vector3.new(2, 3, 4),
result
)
assert.are_not.equal(result, a)
assert.are_not.equal(result, b)
end)
end)

View File

@ -0,0 +1,39 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.__tostring", function()
it("should stringify a Vector3", function()
local a = Vector3.new(3, 4, 5)
assert.are.same(
"(3, 4, 5)",
a:__tostring()
)
end)
it("should implicitly stringify a Vector3", function()
local a = Vector3.new(3, 4, 5)
assert.are.same(
"(3, 4, 5)",
tostring(a)
)
end)
it("should implicitly stringify another Vector3", function()
local a = Vector3.new(55, 77, 22)
assert.are.same(
"(55, 77, 22)",
tostring(a)
)
end)
it("should handle negative numbers", function()
local a = Vector3.new(-1, -2, -3)
assert.are.same(
"(-1, -2, -3)",
tostring(a)
)
end)
it("should handle a mix of positive and negative numbers", function()
local a = Vector3.new(-7, 2, -99)
assert.are.same(
"(-7, 2, -99)",
tostring(a)
)
end)
end)

View File

@ -0,0 +1,37 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
-- To find these numbers, in Javascript:
-- function t(x) { return Math.sqrt((x*x)*3); }
-- for(let i = 0; i < 1000000000; i++) { let r = t(i); if(Math.floor(r) === r) console.log(`i ${i}, r ${r}`); }
describe("Vector3.unit", function()
it("should work with a positive vector", function()
local a = Vector3.new(10, 10, 10)
assert.are.same(
Vector3.new(57735, 57735, 57735),
a:unit():multiply(100000):floor()
)
end)
it("should work with a the normalise alias", function()
local a = Vector3.new(10, 10, 10)
assert.are.same(
Vector3.new(57735, 57735, 57735),
a:normalise():multiply(100000):floor()
)
end)
it("should work with a negative vector", function()
local a = Vector3.new(10, 10, 10)
assert.are.same(
Vector3.new(57735, 57735, 57735),
a:unit():multiply(100000):floor()
)
end)
it("should work with a mixed vector", function()
local a = Vector3.new(-371635731, 371635731, -371635731)
assert.are.same(
Vector3.new(-57736, 57735, -57736),
a:unit():multiply(100000):floor()
)
end)
end)

View File

@ -0,0 +1,44 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
describe("Vector3.volume", function()
it("should work", function()
local a = Vector3.new(4, 4, 4)
local b = Vector3.new(8, 8, 8)
assert.are.equal(
64,
Vector3.volume(a, b)
)
end)
it("should work the other way around", function()
local a = Vector3.new(4, 4, 4)
local b = Vector3.new(8, 8, 8)
assert.are.equal(
64,
Vector3.volume(b, a)
)
end)
it("should work with negative values", function()
local a = Vector3.new(-4, -4, -4)
local b = Vector3.new(-8, -8, -8)
assert.are.equal(
64,
Vector3.volume(a, b)
)
end)
it("should work with different values", function()
local a = Vector3.new(5, 6, 7)
local b = Vector3.new(10, 10, 10)
assert.are.equal(
60,
Vector3.volume(a, b)
)
end)
it("should work with mixed values", function()
local a = Vector3.new(10, 5, 8)
local b = Vector3.new(5, 10, 2)
assert.are.equal(
150,
Vector3.volume(a, b)
)
end)
end)

View File

@ -0,0 +1,158 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
local facing_dirs = dofile("./.tests/parse/axes/include_facing_dirs.lua")
local parse = require("worldeditadditions_core.utils.parse.axes_parser")
local parse_axes = parse.keytable
describe("parse_axes", function()
-- Basic tests
it("should work on single horizontal axes", function()
local minv, maxv = parse_axes({
"x", "3",
"-z", "10",
}, facing_dirs.x_pos)
assert.is.truthy(minv)
assert.are.same(Vector3.new(0, 0, -10), minv)
assert.are.same(Vector3.new(3, 0, 0), maxv)
end)
it("should handle axis clumps and orphan (universal) values", function()
local minv, maxv = parse_axes({
"xz", "-3",
"10",
}, facing_dirs.x_pos)
assert.is.truthy(minv)
assert.are.same(Vector3.new(-3, 0, -3), minv)
assert.are.same(Vector3.new(10, 10, 10), maxv)
end)
it("should work on directions and their abriviations", function()
local minv, maxv = parse_axes({
"l", "3", -- +z
"-r", "-3", -- +z
"b", "-10", -- -x
}, facing_dirs.x_pos)
assert.is.truthy(minv)
assert.are.same(Vector3.new(0, 0, -3), minv)
assert.are.same(Vector3.new(10, 0, 3), maxv)
end)
it("should work with compass directions and their abriviations", function()
local minv, maxv = parse_axes({
"n", "3", -- +z
"south", "3", -- -z
"-west", "10", -- +x
}, facing_dirs.x_pos)
assert.is.truthy(minv)
assert.are.same(Vector3.new(0, 0, -3), minv)
assert.are.same(Vector3.new(10, 0, 3), maxv)
end)
it("should work with ?", function()
local minv, maxv = parse_axes({
"?", "3", -- -z
}, facing_dirs.z_neg)
assert.is.truthy(minv)
assert.are.same(Vector3.new(0, 0, -3), minv)
assert.are.same(Vector3.new(0, 0, 0), maxv)
end)
it("should work with complex relative / absolute combinations", function()
local minv, maxv = parse_axes({
"f", "3", -- +x
"left", "10", -- +z
"y", "77",
"x", "30",
"back", "99",
}, facing_dirs.x_pos)
assert.is.truthy(minv)
assert.are.same(Vector3.new(-99, 0, 0), minv)
assert.are.same(Vector3.new(33, 77, 10), maxv)
end)
it("should work with complex relative / absolute combinations with negative facing_dirs", function()
local minv, maxv = parse_axes({
"f", "3", -- -z
"l", "10", -- +x
"y", "77",
"x", "30",
"b", "99", -- +z
}, facing_dirs.z_neg)
assert.is.truthy(minv)
assert.are.same(Vector3.new(0, 0, -3), minv)
assert.are.same(Vector3.new(40, 77, 99), maxv)
end)
it("should return 2 0,0,0 vectors if no input", function()
local minv, maxv = parse_axes({
-- No input
}, facing_dirs.z_neg)
assert.is.truthy(minv)
assert.are.same(Vector3.new(0, 0, 0), minv)
assert.are.same(Vector3.new(0, 0, 0), maxv)
end)
-- Options tests
it("should mirror the max values of the two vectors if mirroring keyword is present", function()
local minv, maxv = parse_axes({
"x", "3",
"f", "-5", -- +x
"z", "-10",
"mir",
}, facing_dirs.x_pos)
assert.is.truthy(minv)
assert.are.same(Vector3.new(-5, 0, -10), minv)
assert.are.same(Vector3.new(5, 0, 10), maxv)
end)
it("should return a single vector if 'sum' input is truthy", function()
local minv, maxv = parse_axes({
"x", "3",
"z", "-10",
}, facing_dirs.x_pos,"sum")
assert.is.truthy(minv)
assert.are.same(Vector3.new(3, 0, -10), minv)
assert.are.same(nil, maxv)
end)
it("should dissable mirroring if 'sum' input is truthy", function()
local minv, maxv = parse_axes({
"x", "3",
"f", "-5", -- +x
"z", "-10",
"sym",
}, facing_dirs.x_pos,"sum")
assert.is.truthy(minv)
assert.are.same(Vector3.new(-2, 0, -10), minv)
assert.are.same(nil, maxv)
end)
-- Error tests
it("should return error if bad axis/dir", function()
local minv, maxv = parse_axes({
"f", "3", -- +x
"lift", "10", -- Invalid axis
"y", "77",
"x", "30",
"back", "99", -- -x
}, facing_dirs.x_pos)
assert.are.same(false, minv)
assert.are.same("string", type(maxv))
end)
it("should return error if bad value", function()
local minv, maxv = parse_axes({
"f", "3", -- +x
"left", "10", -- +z
"y", "!Q", -- Invalid value
"x", "30",
"back", "99",
}, facing_dirs.x_pos)
assert.are.same(false, minv)
assert.are.same("string", type(maxv))
end)
end)

View File

@ -0,0 +1,142 @@
local z_pos = {
right = {
axis = "x",
sign = 1
},
x = 0.30876246094704,
y = -0.22614130377769,
up = {
axis = "y",
sign = 1
},
left = {
axis = "x",
sign = -1
},
back = {
axis = "z",
sign = -1
},
front = {
axis = "z",
sign = 1
},
down = {
axis = "y",
sign = -1
},
z = 0.92386466264725,
facing = {
axis = "z",
sign = 1
}
}
local x_pos = {
right = {
axis = "z",
sign = -1
},
x = 0.9800808429718,
y = -0.095324546098709,
up = {
axis = "y",
sign = 1
},
left = {
axis = "z",
sign = 1
},
back = {
axis = "x",
sign = -1
},
front = {
axis = "x",
sign = 1
},
down = {
axis = "y",
sign = -1
},
z = -0.17422623932362,
facing = {
axis = "x",
sign = 1
}
}
local z_neg = {
right = {
axis = "x",
sign = -1
},
x = -0.29956161975861,
y = -0.16453117132187,
up = {
axis = "y",
sign = 1,
},
left = {
axis = "x",
sign = 1,
},
back = {
axis = "z",
sign = 1
},
front = {
axis = "z",
sign = -1
},
down = {
axis = "y",
sign = -1
},
z = -0.93978309631348,
facing = {
axis = "z",
sign = -1
}
}
local x_neg = {
right = {
axis = "z",
sign = 1
},
x = -0.96041119098663,
y = -0.20227454602718,
up = {
axis = "y",
sign = 1
},
left = {
axis = "z",
sign = -1
},
back = {
axis = "x",
sign = 1
},
front = {
axis = "x",
sign = -1
},
down = {
axis = "y",
sign = -1
},
z = 0.19156044721603,
facing = {
axis = "x",
sign = -1
}
}
return {
x_pos = x_pos,
z_pos = z_pos,
x_neg = x_neg,
z_neg = z_neg
}

View File

@ -0,0 +1,104 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
local axes = require("worldeditadditions_core.utils.parse.axes")
local parse_abs_axis_name = axes.parse_abs_axis_name
describe("parse_abs_axis_name", function()
it("should work with positive x", function()
local success, result = parse_abs_axis_name("x")
assert.is_true(success)
assert.are.same(
Vector3.new(1, 0, 0),
result
)
end)
it("should work with negative x", function()
local success, result = parse_abs_axis_name("-x")
assert.is_true(success)
assert.are.same(
Vector3.new(-1, 0, 0),
result
)
end)
it("should work with positive y", function()
local success, result = parse_abs_axis_name("y")
assert.is_true(success)
assert.are.same(
Vector3.new(0, 1, 0),
result
)
end)
it("should work with negative y", function()
local success, result = parse_abs_axis_name("-y")
assert.is_true(success)
assert.are.same(
Vector3.new(0, -1, 0),
result
)
end)
it("should work with positive z", function()
local success, result = parse_abs_axis_name("z")
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, 1),
result
)
end)
it("should work with negative z", function()
local success, result = parse_abs_axis_name("-z")
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, -1),
result
)
end)
it("should work with multiple axes -x y", function()
local success, result = parse_abs_axis_name("-xy")
assert.is_true(success)
assert.are.same(
Vector3.new(-1, 1, 0),
result
)
end)
it("should work with multiple axes z-y", function()
local success, result = parse_abs_axis_name("z-y")
assert.is_true(success)
assert.are.same(
Vector3.new(0, -1, 1),
result
)
end)
it("returns an error with invalid input", function()
local success, result = parse_abs_axis_name("cheese")
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with no input", function()
local success, result = parse_abs_axis_name()
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with input of the wrong type", function()
local success, result = parse_abs_axis_name(5)
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with input of the wrong type again", function()
local success, result = parse_abs_axis_name({ "yay", "tests are very useful" })
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
end)

View File

@ -0,0 +1,250 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
local facing_dirs = dofile("./.tests/parse/axes/include_facing_dirs.lua")
local axes = require("worldeditadditions_core.utils.parse.axes")
local parse_axes = axes.parse_axes
--[[ Original idea for how this function was supposed to work from @VorTechnix
-- It's changed a bit to make it more testable
parse_axes("6",name) == return Vector3.new(6,6,6), Vector3.new(-6,-6,-6)
parse_axes("h 4",name) == return Vector3.new(4,0,4), Vector3.new(-4,0,-4)
parse_axes("v 4",name) == return Vector3.new(0,4,0), Vector3.new(0,-4,0)
parse_axes("-x 4 z 3 5",name) == return Vector3.new(0,0,3), Vector3.new(-4,0,-5)
parse_axes("x -10 y 14 true",name) == return Vector3.new(0,14,0), Vector3.new(-10,-14,0)
parse_axes("x -10 y 14 r",name) == return Vector3.new(0,14,0), Vector3.new(-10,-14,0)
parse_axes("x -10 y 14 rev",name) == return Vector3.new(0,14,0), Vector3.new(-10,-14,0)
-- Assuming player is facing +Z (north)
parse_axes("front 4 y 2 r",name) == return Vector3.new(0,2,4), Vector3.new(0,-2,0)
parse_axes("right 4 y 2 r",name) == return Vector3.new(0,2,0), Vector3.new(-4,-2,0)
]]--
describe("parse_axes", function()
it("should work with complex relative / absolute combinations", function()
local success, pos1, pos2 = parse_axes({
"front", "3", -- +x
"left", "10", -- +z
"y", "77",
"x", "30",
"back", "99"
}, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-99, 0, 0), pos1)
assert.are.same(Vector3.new(33, 77, 10), pos2)
end)
it("should work with complex relative / absolute combinations with other facing_dirs", function()
local success, pos1, pos2 = parse_axes({
"front", "3", -- +x
"left", "10", -- +z
"y", "77",
"x", "30",
"back", "99"
}, facing_dirs.z_neg)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, -3), pos1)
assert.are.same(Vector3.new(40, 77, 99), pos2)
end)
it("should work with ?", function()
local success, pos1, pos2 = parse_axes({
"?", "3"
}, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(3, 0, 0), pos2)
end)
it("should work with positive y / positive value", function()
local success, pos1, pos2 = parse_axes({ "y", "17" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(0, 17, 0), pos2)
end)
it("should work with positive y / negative value", function()
local success, pos1, pos2 = parse_axes({ "y", "-6" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, -6, 0), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with negative y / positive value", function()
local success, pos1, pos2 = parse_axes({ "-y", "17" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, -17, 0), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with negative y / negative value", function()
local success, pos1, pos2 = parse_axes({ "-y", "-6" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(0, 6, 0), pos2)
end)
it("should work with positive x / positive value", function()
local success, pos1, pos2 = parse_axes({ "x", "1" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(1, 0, 0), pos2)
end)
it("should work with positive x / big positive value", function()
local success, pos1, pos2 = parse_axes({ "x", "99" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(99, 0, 0), pos2)
end)
it("should work with positive x / negative value", function()
local success, pos1, pos2 = parse_axes({ "x", "-1" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-1, 0, 0), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with positive z / positive value", function()
local success, pos1, pos2 = parse_axes({ "z", "1" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(0, 0, 1), pos2)
end)
it("should work with positive z / negative value", function()
local success, pos1, pos2 = parse_axes({ "z", "-1" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, -1), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with multiple positive axes / positive values", function()
local success, pos1, pos2 = parse_axes({ "x", "14", "z", "3" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(14, 0, 3), pos2)
end)
it("should work with multiple positive axes / negative values", function()
local success, pos1, pos2 = parse_axes({ "x", "-16", "z", "-9" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-16, 0, -9), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with negative x / positive value", function()
local success, pos1, pos2 = parse_axes({ "-x", "1" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-1, 0, 0), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with negative x / big positive value", function()
local success, pos1, pos2 = parse_axes({ "-x", "99" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-99, 0, 0), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with negative x / negative value", function()
local success, pos1, pos2 = parse_axes({ "-x", "-3" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(3, 0, 0), pos2)
end)
it("should work with negative z / positive value", function()
local success, pos1, pos2 = parse_axes({ "-z", "6" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, -6), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with negative z / negative value", function()
local success, pos1, pos2 = parse_axes({ "-z", "-4" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(0, 0, 4), pos2)
end)
it("should work with multiple negative axes / positive values", function()
local success, pos1, pos2 = parse_axes({ "-x", "14", "z", "-3" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-14, 0, -3), pos1)
assert.are.same(Vector3.new(0, 0, 0), pos2)
end)
it("should work with multiple negative axes / negative values", function()
local success, pos1, pos2 = parse_axes({ "-x", "-16", "-z", "-9" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, 0), pos1)
assert.are.same(Vector3.new(16, 0, 9), pos2)
end)
it("should work with complex multiple positive / negative combinations", function()
local success, pos1, pos2 = parse_axes({ "x", "-16", "-x", "10", "-z", "-9", "y", "88" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-26, 0, 0), pos1)
assert.are.same(Vector3.new(0, 88, 9), pos2)
end)
it("should work with mirroring too", function()
local success, pos1, pos2 = parse_axes({ "x", "6", "sym" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-6, 0, 0), pos1)
assert.are.same(Vector3.new(6, 0, 0), pos2)
end)
it("should work with relative mirroring", function()
local success, pos1, pos2 = parse_axes({ "front", "2", "mirror" }, facing_dirs.x_pos)
assert.is_true(success)
assert.are.same(Vector3.new(-2, 0, 0), pos1)
assert.are.same(Vector3.new(2, 0, 0), pos2)
end)
it("should work with relative mirroring in a different direction", function()
local success, pos1, pos2 = parse_axes({ "back", "7", "rev" }, facing_dirs.z_pos)
assert.is_true(success)
assert.are.same(Vector3.new(0, 0, -7), pos1)
assert.are.same(Vector3.new(0, 0, 7), pos2)
end)
it("returns an error with invalid token list", function()
local success, result = parse_axes("cheese", facing_dirs.z_neg)
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with invalid facing_dir", function()
local success, result = parse_axes({ "-x", "1" }, "rocket")
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with no input", function()
local success, result = parse_axes()
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with token list of the wrong type", function()
local success, result = parse_axes(5, facing_dirs.x_pos)
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with token list of the wrong type again", function()
local success, result = parse_axes(false, facing_dirs.x_pos)
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with token of the wrong type in token list", function()
local success, result = parse_axes({ "-x", "99", false }, facing_dirs.x_pos)
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
end)

View File

@ -0,0 +1,315 @@
local Vector3 = require("worldeditadditions_core.utils.vector3")
local facing_dirs = dofile("./.tests/parse/axes/include_facing_dirs.lua")
local axes = require("worldeditadditions_core.utils.parse.axes")
local parse_relative_axis_name = axes.parse_relative_axis_name
describe("parse_relative_axis_name", function()
it("should work with up", function()
local success, result = parse_relative_axis_name(
"up",
facing_dirs.x_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 1, 0),
result
)
end)
it("should work with down", function()
local success, result = parse_relative_axis_name(
"down",
facing_dirs.x_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, -1, 0),
result
)
end)
-- ██ ██ ██████ ██████ ███████
-- ██ ██ ██ ██ ██ ██ ██
-- ███ ██████ ██ ██ ███████
-- ██ ██ ██ ██ ██ ██
-- ██ ██ ███████ ██ ██████ ███████
it("should work with positive x → front", function()
local success, result = parse_relative_axis_name(
"front",
facing_dirs.x_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(1, 0, 0),
result
)
end)
it("should work with positive x → ?", function()
local success, result = parse_relative_axis_name(
"?",
facing_dirs.x_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(1, 0, 0),
result
)
end)
it("should work with positive x → back", function()
local success, result = parse_relative_axis_name(
"back",
facing_dirs.x_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(-1, 0, 0),
result
)
end)
it("should work with positive x → left", function()
local success, result = parse_relative_axis_name(
"left",
facing_dirs.x_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, 1),
result
)
end)
it("should work with positive x → right", function()
local success, result = parse_relative_axis_name(
"right",
facing_dirs.x_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, -1),
result
)
end)
-- ██ ██ ███ ██ ███████ ██████
-- ██ ██ ████ ██ ██ ██
-- ███ ██ ██ ██ █████ ██ ███
-- ██ ██ ██ ██ ██ ██ ██ ██
-- ██ ██ ███████ ██ ████ ███████ ██████
it("should work with negative x → front", function()
local success, result = parse_relative_axis_name(
"front",
facing_dirs.x_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(-1, 0, 0),
result
)
end)
it("should work with negative x → ?", function()
local success, result = parse_relative_axis_name(
"?",
facing_dirs.x_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(-1, 0, 0),
result
)
end)
it("should work with negative x → back", function()
local success, result = parse_relative_axis_name(
"back",
facing_dirs.x_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(1, 0, 0),
result
)
end)
it("should work with negative x → left", function()
local success, result = parse_relative_axis_name(
"left",
facing_dirs.x_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, -1),
result
)
end)
it("should work with negative x → right", function()
local success, result = parse_relative_axis_name(
"right",
facing_dirs.x_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, 1),
result
)
end)
-- ███████ ██████ ██████ ███████
-- ███ ██ ██ ██ ██ ██
-- ███ ██████ ██ ██ ███████
-- ███ ██ ██ ██ ██
-- ███████ ███████ ██ ██████ ███████
it("should work with positive z → front", function()
local success, result = parse_relative_axis_name(
"front",
facing_dirs.z_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, 1),
result
)
end)
it("should work with positive z → ?", function()
local success, result = parse_relative_axis_name(
"?",
facing_dirs.z_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, 1),
result
)
end)
it("should work with positive z → back", function()
local success, result = parse_relative_axis_name(
"back",
facing_dirs.z_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, -1),
result
)
end)
it("should work with positive z → left", function()
local success, result = parse_relative_axis_name(
"left",
facing_dirs.z_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(-1, 0, 0),
result
)
end)
it("should work with positive z → right", function()
local success, result = parse_relative_axis_name(
"right",
facing_dirs.z_pos
)
assert.is_true(success)
assert.are.same(
Vector3.new(1, 0, 0),
result
)
end)
-- ███████ ███ ██ ███████ ██████
-- ███ ████ ██ ██ ██
-- ███ ██ ██ ██ █████ ██ ███
-- ███ ██ ██ ██ ██ ██ ██
-- ███████ ███████ ██ ████ ███████ ██████
it("should work with negative z → front", function()
local success, result = parse_relative_axis_name(
"front",
facing_dirs.z_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, -1),
result
)
end)
it("should work with negative z → ?", function()
local success, result = parse_relative_axis_name(
"?",
facing_dirs.z_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, -1),
result
)
end)
it("should work with negative z → back", function()
local success, result = parse_relative_axis_name(
"back",
facing_dirs.z_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(0, 0, 1),
result
)
end)
it("should work with negative z → left", function()
local success, result = parse_relative_axis_name(
"left",
facing_dirs.z_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(1, 0, 0),
result
)
end)
it("should work with negative z → right", function()
local success, result = parse_relative_axis_name(
"right",
facing_dirs.z_neg
)
assert.is_true(success)
assert.are.same(
Vector3.new(-1, 0, 0),
result
)
end)
it("returns an error with invalid input", function()
local success, result = parse_relative_axis_name("cheese")
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with no input", function()
local success, result = parse_relative_axis_name()
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with input of the wrong type", function()
local success, result = parse_relative_axis_name(5)
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
it("returns an error with input of the wrong type again", function()
local success, result = parse_relative_axis_name({ "yay", "tests are very useful" })
assert.is_false(success)
assert.are.same(
"string",
type(result)
)
end)
end)

View File

@ -0,0 +1,36 @@
local parse_chance = require("worldeditadditions_core.utils.parse.chance")
describe("parse.chance", function()
it("should work in 1-in-n mode by default", function()
local source = "50%"
assert.are.equal(
2,
parse_chance(source)
)
end)
it("should work with a different value in 1-in-n mode", function()
local source = "25%"
assert.are.equal(
4,
parse_chance(source)
)
end)
it("should work in weight mode", function()
local source = "50%"
assert.are.equal(
2,
parse_chance(source, "weight")
)
end)
it("should work in weight mode with different number", function()
local source = "90%"
assert.are.equal(
10,
parse_chance(source, "weight")
)
end)
end)

122
.tests/parse/map.test.lua Normal file
View File

@ -0,0 +1,122 @@
_G.worldeditadditions_core = {
split = require("worldeditadditions_core.utils.strings.split"),
table = {
contains = require("worldeditadditions_core.utils.table.table_contains")
}
}
local parse_map = require("worldeditadditions_core.utils.parse.map")
describe("parse.map", function()
it("should work with a single param", function()
local success, result = parse_map("apples yay")
assert.are.equal(true, success)
assert.are.same(
{ apples = "yay" },
result
)
end)
it("should work with 2 params", function()
local success, result = parse_map("apples yay oranges yummy")
assert.are.equal(true, success)
assert.are.same(
{ apples = "yay", oranges = "yummy" },
result
)
end)
it("should work with an int value", function()
local success, result = parse_map("apples 2")
assert.are.equal(true, success)
assert.are.same(
{ apples = 2 },
result
)
end)
it("should work with a float value", function()
local success, result = parse_map("apples 2.71")
assert.are.equal(true, success)
assert.are.same(
{ apples = 2.71 },
result
)
end)
it("should work with 2 int values", function()
local success, result = parse_map("apples 2 banana 23")
assert.are.equal(true, success)
assert.are.same(
{ apples = 2, banana = 23 },
result
)
end)
it("should work with mixed values", function()
local success, result = parse_map("apples 2 banana yummy")
assert.are.equal(true, success)
assert.are.same(
{ apples = 2, banana = "yummy" },
result
)
end)
it("should work with a value that starts as a number and ends as a string", function()
local success, result = parse_map("apples 20t banana yummy")
assert.are.equal(true, success)
assert.are.same(
{ apples = "20t", banana = "yummy" },
result
)
end)
it("should work with a value that starts as a string and ends as a number", function()
local success, result = parse_map("apples t20 banana yummy")
assert.are.equal(true, success)
assert.are.same(
{ apples = "t20", banana = "yummy" },
result
)
end)
it("should work with multiple spaces", function()
local success, result = parse_map("apples 2 banana \t yummy")
assert.are.equal(true, success)
assert.are.same(
{ apples = 2, banana = "yummy" },
result
)
end)
it("should ignore a hanging item at the end", function()
local success, result = parse_map("apples 2 banana")
assert.are.equal(true, success)
assert.are.same(
{ apples = 2 },
result
)
end)
it("should work with hanging items declared as keywords at the end", function()
local success, result = parse_map("apples 2 banana", { "banana" })
assert.are.equal(true, success)
assert.are.same(
{ apples = 2, banana = true },
result
)
end)
it("should work with hanging items declared as keywords in the middle", function()
local success, result = parse_map("apples 2 banana pear paris", { "banana" })
assert.are.equal(true, success)
assert.are.same(
{ apples = 2, banana = true, pear = "paris" },
result
)
end)
it("should work with some but not other hanging items declared as keywords", function()
local success, result = parse_map("apples 2 banana pear paris arrange", { "banana" })
assert.are.equal(true, success)
assert.are.same(
{ apples = 2, banana = true, pear = "paris" },
result
)
end)
it("should work with hanging items declared as keywords at the beginning", function()
local success, result = parse_map("banana apples 2 pear paris", { "banana" })
assert.are.equal(true, success)
assert.are.same(
{ apples = 2, banana = true, pear = "paris" },
result
)
end)
end)

View File

@ -0,0 +1,24 @@
local parse_seed = require("worldeditadditions_core.utils.parse.seed")
describe("parse.seed", function()
it("should work", function()
local source = "a test string"
local result = parse_seed(source)
assert.are.equal(
"number",
type(result)
)
end)
it("should work with a long string", function()
local source = "If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction. If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction. If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction. If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction. If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction. If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction. If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction. If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction. If it looks like a duck and quacks like a duck but it needs batteries, you probably have the wrong abstraction."
local result = parse_seed(source)
assert.are.equal(
"number",
type(result)
)
end)
end)

View File

@ -0,0 +1,32 @@
local makeset = require("worldeditadditions_core.utils.table.makeset")
describe("table.makeset", function()
it("should work with a single item", function()
local result = makeset({ "apples" })
assert.are.same(
{ apples = true },
result
)
end)
it("should work with 2 items", function()
local result = makeset({ "apples", "orange" })
assert.are.same(
{ apples = true, orange = true },
result
)
end)
it("should work with duplicate items", function()
local result = makeset({ "apples", "apples" })
assert.are.same(
{ apples = true },
result
)
end)
it("should work with duplicate items and non-duplicate items", function()
local result = makeset({ "apples", "oranges", "apples" })
assert.are.same(
{ apples = true, oranges = true },
result
)
end)
end)

View File

@ -0,0 +1,48 @@
local apply = require("worldeditadditions_core.utils.table.table_apply")
describe("table.makeset", function()
it("should work", function()
local source = { apples = 4 }
local target = { oranges = 3 }
apply(source, target)
assert.are.same(
{ apples = 4, oranges = 3 },
target
)
end)
it("should overwrite values in target", function()
local source = { apples = 4 }
local target = { apples = 3 }
apply(source, target)
assert.are.same(
{ apples = 4 },
target
)
end)
it("should work with strings", function()
local source = { apples = "4" }
local target = { oranges = "3" }
apply(source, target)
assert.are.same(
{ apples = "4", oranges = "3" },
target
)
end)
it("should overwrite values in target with strings", function()
local source = { apples = "4" }
local target = { apples = "3" }
apply(source, target)
assert.are.same(
{ apples = "4" },
target
)
end)
end)

View File

@ -0,0 +1,40 @@
local contains = require("worldeditadditions_core.utils.table.table_contains")
describe("table.makeset", function()
it("should work with a string", function()
assert.are.same(
true,
contains({ "apples" }, "apples")
)
end)
it("should work with a number", function()
assert.are.same(
true,
contains({ 4 }, 4)
)
end)
it("should return false if a number doesn't exist", function()
assert.are.same(
false,
contains({ 5 }, 4)
)
end)
it("should work with a string and multiple items in the table", function()
assert.are.same(
true,
contains({ "yay", "apples", "cat" }, "apples")
)
end)
it("should return false if it doesn't exist", function()
assert.are.same(
false,
contains({ "yay" }, "orange")
)
end)
it("should return false if it doesn't exist wiith multiple items", function()
assert.are.same(
false,
contains({ "yay", "apples", "cat" }, "orange")
)
end)
end)

View File

@ -0,0 +1,178 @@
local split_shell = require("worldeditadditions_core.utils.strings.split_shell")
describe("split_shell", function()
it("should handle a single case x3", function()
assert.are.same(
{ "yay", "yay", "yay" },
split_shell("yay yay yay")
)
end)
it("should handle double quotes simple", function()
assert.are.same(
{ "dirt", "snow block" },
split_shell("dirt \"snow block\"")
)
end)
it("should handle an escaped double quote inside double quotes", function()
assert.are.same(
{ "yay", "yay\" yay", "yay" },
split_shell("yay \"yay\\\" yay\" yay")
)
end)
it("should handle single quotes", function()
assert.are.same(
{ "yay", "yay", "yay" },
split_shell("yay 'yay' yay")
)
end)
it("should handle single quotes again", function()
assert.are.same(
{ "yay", "inside quotes", "another" },
split_shell("yay 'inside quotes' another")
)
end)
it("should handle single quotes inside double quotes", function()
assert.are.same(
{ "yay", "yay 'inside quotes' yay", "yay" },
split_shell("yay \"yay 'inside quotes' yay\" yay")
)
end)
it("should handle single quotes and an escaped double quote inside double quotes", function()
assert.are.same(
{ "yay", "yay 'inside quotes' yay\"", "yay" },
split_shell("yay \"yay 'inside quotes' yay\\\"\" yay")
)
end)
it("should handle a complex case", function()
assert.are.same(
{ "y\"ay", "yay 'in\"side quotes' yay", "y\"ay" },
split_shell("y\"ay \"yay 'in\\\"side quotes' yay\" y\\\"ay")
)
end)
it("should handle a subtly different complex case", function()
assert.are.same(
{ "y\"ay", "yay", "in\"side quotes", "yay", "y\"ay" },
split_shell("y\"ay yay 'in\\\"side quotes' yay y\\\"ay")
)
end)
it("should handle redundant double quotes", function()
assert.are.same(
{ "cake" },
split_shell("\"cake\"")
)
end)
it("should handle redundant double quotes multi", function()
assert.are.same(
{ "cake", "cake", "cake" },
split_shell("\"cake\" \"cake\" \"cake\"")
)
end)
it("should handle redundant single quotes", function()
assert.are.same(
{ "cake" },
split_shell("'cake'")
)
end)
it("should handle redundant single quotes multi", function()
assert.are.same(
{ "cake", "cake", "cake" },
split_shell("'cake' 'cake' 'cake'")
)
end)
it("should handle redundant double and single quotes", function()
assert.are.same(
{ "cake", "cake", "cake" },
split_shell("'cake' \"cake\" 'cake'")
)
end)
it("should handle redundant double and single quotes opposite", function()
assert.are.same(
{ "cake", "cake", "cake" },
split_shell("\"cake\" 'cake' \"cake\"")
)
end)
it("should handle a random backslash single quotes", function()
assert.are.same(
{ "cake", "ca\\ke" },
split_shell("\"cake\" 'ca\\ke'")
)
end)
it("should handle a random backslash double quotes", function()
assert.are.same(
{ "cake", "ca\\ke" },
split_shell("\"cake\" \"ca\\ke\"")
)
end)
it("should handle a backslash after double quotes", function()
assert.are.same(
{ "\\cake", "cake" },
split_shell("\"\\cake\" \"cake\"")
)
end)
it("should handle a double backslash before double quotes", function()
assert.are.same(
{ "\\\"cake\"", "cake" },
split_shell("\\\\\"cake\" \"cake\"")
)
end)
it("should handle a single backslash before double quotes", function()
assert.are.same(
{ "\"cake\"", "cake" },
split_shell("\\\"cake\" \"cake\"")
)
end)
it("should handle a double backslash before single quotes", function()
assert.are.same(
{ "\\'cake'", "cake" },
split_shell("\\\\'cake' 'cake'")
)
end)
it("should handle a single backslash before single quotes", function()
assert.are.same(
{ "\"cake\"", "cake" },
split_shell("\\\"cake\" \"cake\"")
)
end)
it("should handle redundant double and single quotes again", function()
assert.are.same(
{ "cake", "cake", "cake", "is", "a", "li\\e" },
split_shell("\"cake\" 'cake' \"cake\" is a \"li\\e\"")
)
end)
-- Unclosed quotes are currently considered to last until the end of the string.
it("should handle an unclosed double quote", function()
assert.are.same(
{ "the", "cake is a lie" },
split_shell("the \"cake is a lie")
)
end)
it("should handle an unclosed single quote", function()
assert.are.same(
{ "the", "cake is a lie" },
split_shell("the 'cake is a lie")
)
end)
it("should handle an unclosed single quote at the end", function()
assert.are.same(
{ "the", "cake is a lie'" },
split_shell("the \"cake is a lie'")
)
end)
it("should handle an unclosed single and double quote", function()
assert.are.same(
{ "the", "cake is \"a lie" },
split_shell("the 'cake is \"a lie")
)
end)
end)

View File

@ -0,0 +1,40 @@
local polyfill = require("worldeditadditions_core.utils.strings.polyfill")
describe("str_ends", function()
it("should return true for a single character", function()
assert.are.equal(
true,
polyfill.str_ends("test", "t")
)
end)
it("should return true for a multiple characters", function()
assert.are.equal(
true,
polyfill.str_ends("test", "st")
)
end)
it("should return true for identical strings", function()
assert.are.equal(
true,
polyfill.str_ends("test", "test")
)
end)
it("should return false for a single character ", function()
assert.are.equal(
false,
polyfill.str_ends("test", "y")
)
end)
it("should return false for a character present elsewherer", function()
assert.are.equal(
false,
polyfill.str_ends("test", "e")
)
end)
it("should return false for another substring", function()
assert.are.equal(
false,
polyfill.str_ends("test", "tes")
)
end)
end)

View File

@ -0,0 +1,40 @@
local polyfill = require("worldeditadditions_core.utils.strings.polyfill")
describe("str_padend", function()
it("should pad a string", function()
assert.are.equal(
polyfill.str_padend("test", 5, " "),
"test "
)
end)
it("should pad a different string", function()
assert.are.equal(
polyfill.str_padend("yay", 4, " "),
"yay "
)
end)
it("should pad a string with multiple characters", function()
assert.are.equal(
polyfill.str_padend("test", 10, " "),
"test "
)
end)
it("should not pad a long string", function()
assert.are.equal(
polyfill.str_padend("testtest", 5, " "),
"testtest"
)
end)
it("should pad with other characters", function()
assert.are.equal(
polyfill.str_padend("1", 2, "0"),
"10"
)
end)
it("should pad with multiple other characters", function()
assert.are.equal(
polyfill.str_padend("1", 5, "0"),
"10000"
)
end)
end)

View File

@ -0,0 +1,40 @@
local polyfill = require("worldeditadditions_core.utils.strings.polyfill")
describe("str_padstart", function()
it("should pad a string", function()
assert.are.equal(
polyfill.str_padstart("test", 5, " "),
" test"
)
end)
it("should pad a different string", function()
assert.are.equal(
polyfill.str_padstart("yay", 4, " "),
" yay"
)
end)
it("should pad a string with multiple characters", function()
assert.are.equal(
polyfill.str_padstart("test", 10, " "),
" test"
)
end)
it("should not pad a long string", function()
assert.are.equal(
polyfill.str_padstart("testtest", 5, " "),
"testtest"
)
end)
it("should pad with other characters", function()
assert.are.equal(
polyfill.str_padstart("1", 2, "0"),
"01"
)
end)
it("should pad with multiple other characters", function()
assert.are.equal(
polyfill.str_padstart("1", 5, "0"),
"00001"
)
end)
end)

Some files were not shown because too many files have changed in this diff Show More