From b4d07e9d75463d95ba900a30600b0525ebb9698d Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Mon, 26 Jul 2021 16:29:01 -0700 Subject: [PATCH] Update CONTRIBUTING.md with template --- CONTRIBUTING.md | 35 +++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 37 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 427c273..b02dc46 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,6 +16,41 @@ Additionally, every command should be implemented in its own file. This helps ke Don't forget to update `init.lua` to `dofile()` the new file(s) you create in each submod :-) +## Chat command template + +```lua +-- ███ ██ █████ ███ ███ ███████ +-- ████ ██ ██ ██ ████ ████ ██ +-- ██ ██ ██ ███████ ██ ████ ██ █████ +-- ██ ██ ██ ██ ██ ██ ██ ██ ██ +-- ██ ████ ██ ██ ██ ██ ███████ +local wea = worldeditadditions +worldedit.register_command("{name}", { + params = " [ ...] | [ []]", + description = "A **brief** description of what this command does", + privs = { worldedit = true }, + require_pos = 0, -- Optional | (0|1|2) + parse = function(params_text) + -- Do stuff with params_text + return true, param1, param2 + end, + nodes_needed = function(name) --Optional + return worldedit.volume(worldedit.pos1[name], worldedit.pos2[name]) + end, + func = function(name, param1, param2) + -- Start a timer + local start_time = wea.get_ms_time() + -- Do stuff + + -- Finish timer + local time_taken = wea.get_ms_time() - start_time + + minetest.log("This is a logged message!") + return true, "Completed command in " .. wea.format.human_time(time_taken) + end +}) +``` + ## Guidelines When actually implementing stuff, here are a few guidelines that I recommend to summarise everything: diff --git a/README.md b/README.md index 58a7adc..37f4fdf 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,8 @@ Contributions are welcome! Please state in your pull request(s) that you release Please also make sure that the logic for every new command has it's own file. For example, the logic for `//floodfill` goes in `worldeditadditions/floodfill.lua`, the logic for `//overlay` goes in `worldeditadditions/overlay.lua`, etc. +For more information check out [CONTRIBUTING.md](CONTRIBUTING.md). + I, Starbeamrainbowlabs (@sbrl), have the ultimate final say.