contributing guide: update example command

This commit is contained in:
Starbeamrainbowlabs 2023-07-04 22:44:28 +01:00
parent 5d18f6d0db
commit 365b491aa1
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -37,7 +37,8 @@ When actually implementing stuff, here are a few guidelines that I recommend to
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██ ████ ██ ██ ██ ██ ███████
local wea = worldeditadditions
local wea_c = worldeditadditions_core
local weac = worldeditadditions_core
local Vector3 = weac.Vector3
worldeditadditions_core.register_command("{name}", {
params = "<argument> <argument=default> <option1|option2|...> [<optional_argument> <optional_argument2> ...] | [<optional_argument> [<optional_argument2>]]",
description = "A **brief** description of what this command does",
@ -48,18 +49,18 @@ worldeditadditions_core.register_command("{name}", {
return true, param1, param2
end,
nodes_needed = function(name) --Optional
return worldedit.volume(worldedit.pos1[name], worldedit.pos2[name])
return Vector3.volume(weac.pos.get1(name), weac.pos.get2(name))
end,
func = function(name, param1, param2)
-- Start a timer
local start_time = wea_c.get_ms_time()
local start_time = weac.get_ms_time()
-- Do stuff
-- Finish timer
local time_taken = wea_c.get_ms_time() - start_time
local time_taken = weac.get_ms_time() - start_time
minetest.log("This is a logged message!")
return true, "Completed command in " .. wea_c.format.human_time(time_taken)
return true, "Completed command in " .. weac.format.human_time(time_taken)
end
})
```