Last active
December 7, 2016 14:00
-
-
Save Jordach/36266a2b5a1a5f87c584a0ad5ffb2eb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mcore = {} | |
-- meshoptions helper function | |
-- setting meshtypes to: | |
-- cross is x | |
-- plus is + | |
-- croplike is # | |
-- excroplike is # but the tips are more like a > | |
-- asterisk is like * but with three faces | |
-- horizonal is a bool operator - true makes it randomly positioned on x and y | |
-- height changes where the base of the plant is randomly pushed into the ground | |
-- size makes the plant 1.4 times bigger | |
function mcore.options(meshtype, horizontal, height, size) | |
local pshape, bit1, bit2, bit3 = 0, 0, 0, 0 | |
if meshtype == "cross" then | |
pshape = 0 | |
elseif meshtype == "plus" then | |
pshape = 1 | |
elseif meshtype == "asterisk" then | |
pshape = 2 | |
elseif meshtype == "croplike" then | |
pshape = 3 | |
elseif meshtype == "excroplike" then | |
pshape = 4 | |
end | |
if horizontal then | |
bit1 = 8 | |
end | |
if size then | |
bit2 = 16 | |
end | |
if height then | |
bit3 = 32 | |
end | |
local retval = pshape+bit1+bit2+bit3 | |
return retval | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment