Skip to content

Instantly share code, notes, and snippets.

@Jordach
Jordach / .lua
Created Feb 17, 2017
remember to use self.object:field_here and not self:field_here
View .lua
minetest.register_entity("wardrobe:dummy", {
collisionbox = {-0.35,-0.5,-0.35,0.35,1.2,0.35},
visual = "mesh",
mesh = "wardrobe_dummy.x",
textures = {
"ptextures_transparent.png",
--"stm.png^[mask:stm.png^[multiply:#e3c0a3^eyewhite.png^eyepupil.png^[mask:test.png^[multiply:#00ff00",
"(stm.png^[multiply:#e3c0a3)^(eyewhite.png)^(eyepupil.png^[multiply:#0055ff)^(sam_plaid.png^[multiply:#64e034)",
"ptextures_transparent.png",
View .lua
print(string.match(fields.skintone, "[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]"))
View .lua
-- how to add your own textures to the wardrobe;
--[[
Make sure your textures are in greyscale, eg, from black to white in 0-255 steps
The engine prefers this colour as it is easier to look right once a player has
set their colour preferences for a specific piece of clothing.
The only non-colourable texture is the mouth, as that either lightly shades the mouth area or
View init.lua
bucket = {}
bucket.place = {} -- list of liquids to place
bucket.fill = {} -- list of liquids to loop over and set to air
bucket.name = {} -- list of bucket names to return after using the empty bucket
function bucket.give_filled(user, ltype)
View .lua
-- wardrobe formspec
wardrobe = {}
wardrobe.player_materials = {}
wardrobe.formspec_selections = {}
wardrobe.formspec_selections_rgb = {}
wardrobe.formspec_selections["singleplayer"] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
View gist:c14d9d68cf241b58b49bb634bf4d4004
2017-02-12 14:28:08: ACTION[Server]: singleplayer places node wardrobe:node at (-7,4,3)
2017-02-12 14:28:08: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'wardrobe' in callback item_OnPlace(): ...st-0.4.15\bin\..\games\great_farm\mods\wardrobe\init.lua:86: attempt to concatenate local 'hairrgb' (a nil value)
2017-02-12 14:28:08: ERROR[Main]: stack traceback:
2017-02-12 14:28:08: ERROR[Main]: ...st-0.4.15\bin\..\games\great_farm\mods\wardrobe\init.lua:86: in function 'formspec_meta'
2017-02-12 14:28:08: ERROR[Main]: ...st-0.4.15\bin\..\games\great_farm\mods\wardrobe\init.lua:101: in function 'after_place_node'
2017-02-12 14:28:08: ERROR[Main]: ...rda\Desktop\minetest-0.4.15\bin\..\builtin\game\item.lua:304: in function <...rda\Desktop\minetest-0.4.15\bin\..\builtin\game\item.lua:207>
2017-02-12 14:28:08: ACTION[Server]: singleplayer leaves game. List of players:
View .lua
-- wardrobe formspec
wardrobe = {}
wardrobe.player_materials = {}
wardrobe.formspec_selections = {}
wardrobe.formspec_selections_rgb = {}
wardrobe.formspec_selections["singleplayer"] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
View .lua
-- wardrobe formspec
wardrobe = {}
wardrobe.player_materials = {}
wardrobe.formspec_selections = {}
wardrobe.formspec_selections["singleplayer"] = {1,1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
View .lua
-- wardrobe formspec
wardrobe = {}
wardrobe.player_materials = {}
wardrobe.formspec_selections = {}
wardrobe.formspec_selections["singleplayer"] = {1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
View gist:4385e9a5687f778a54158e9d9df3b616
function wardrobe.formspec_meta(
eye,
hair,
ushirt, ushirt2,
utrou, utrou2,
socks, socks2,
jacket, jacket2,
trous, trous2,
shoes, shoes2,
acc1, acc2, acc3, acc4, acc5, acc6 )