Skip to content

Instantly share code, notes, and snippets.

@Jordach
Jordach / .lua
Created February 22, 2017 00:01
-- 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
@Jordach
Jordach / .lua
Created February 17, 2017 17:17
remember to use self.object:field_here and not self:field_here
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",
@Jordach
Jordach / .lua
Created February 12, 2017 23:06
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]"))
@Jordach
Jordach / .lua
Created February 12, 2017 22:24
-- 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
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)
@Jordach
Jordach / .lua
Last active February 12, 2017 16:11
-- 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}
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:
@Jordach
Jordach / .lua
Last active February 12, 2017 14:53
-- 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}
@Jordach
Jordach / .lua
Last active February 11, 2017 22:51
-- 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}
@Jordach
Jordach / .lua
Created February 11, 2017 19:51
-- 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}