Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Brief notes:
- This code is under WTFPL license
- English isn't my first language
- I won't update this thing
- I'm not pround of my ugly script ]]
- -- Stores the command argumments
- local args = {...}
- -- Check if there are arguments...
- if args[1] and args[2] and args[3] and args[4] and args[5] == nil then
- -- Raise an error if argurments are empty
- error("Usage: pyramid <x> <y> <z> <BaseSize> <TileName> [hollowness: true/false]\n E.g.: pyramid 100 54 33 20 minecraft:stone true)")
- end
- -- Set the pyramid base size (in blocks)
- local size = args[4]
- -- Set the origin position
- local xa, y, za = args[1], args[2], args[3]
- -- Get the opposite position by adding the base size
- local xb, zb = (xa-1) + size, (za-1) + size
- -- The height limit
- local hlimit = math.ceil((size/2))
- -- "While 'current pyramid height' is less than 'pyramid total height'"
- for h = 0, hlimit - 1 do
- -- Fill the layer with blocks
- exec(string.format("fill %s %s %s %s %s %s %s",xa+h,y+h,za+h,xb-h,y+h,zb-h,args[5]))
- -- If user wants a hollow pyramid
- if args[6] == "true" and h < hlimit - 1 then
- -- Fill the layer except the border with air
- exec(string.format("fill %s %s %s %s %s %s minecraft:air",xa+h+1,y+h,za+h+1,xb-h-1,y+h,zb-h-1))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement