Skip to content

Instantly share code, notes, and snippets.

View gist:1c4fbbf1f9259c07f8b13e5b639fe8df
Beds Flowchart:
|- 1) on_rightclick() (beds:bed_name or any node:here) (function call beds.bed_rightclick(pos, player))
|
|
|--- i) Is it night time and a player? (Gone 6pm in local clock?)
| |
| |
|------ I) else, return, end
| |
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 gist:48d75afe7215433d80020cb4b95bea5c
You guessed: 65
Too Small!
Please input your guess.
66
You guessed: 66
Too Big!
Please input your guess.
View gist:8e2fce2776df568fba314722a4353df1
You guessed: 65
Too Small!
Please input your guess.
66
You guessed: 66
Too Big!
Please input your guess.
View .lua
function wardrobe.load_user_data(player)
local pname = player:get_player_name()
-- load non-RGB choices
if player:get_attribute("wardrobe_choices") == nil then
wardrobe.formspec_selections[pname] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
print ("[Wardrobe] Failed Loading Texture Data for Player: " .. pname)
player:set_attribute("wardrobe_choices", minetest.serialize(wardrobe.formspec_selections[pname]))
View .lua
wardrobe.formspec_selections_rgb[pname][22] = wardrobe.is_save_hex(fields.acc6)
if wardrobe.is_hex(fields.acc6) then
wardrobe.formspec_selections_rgb[pname][22] = fields.acc6
else
wardrobe.formspec_selections_rgb[pname][22] = "ffffff"
end
end
View .lua
function wardrobe.load_user_data(player)
local pname = player:get_player_name()
-- load non-RGB choices
if minetest.deserialize(player:get_attribute("wardrobe_choices")) == nil then
wardrobe.formspec_selections[pname] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
View .lua
entity[1]:set_properties({
textures = {
"ptextures_transparent.png",
"(wardrobe_skin.png^[multiply:#"..fields.skintone..")^"..
"(wardrobe_eyes_white_"..wardrobe.formspec_selections[pname][1]..".png^[multiply:#"..fields.ewhite..")^"..
"(wardrobe_eyes_pupil_"..wardrobe.formspec_selections[pname][2]..".png^[multiply:#"..fields.pcolour..")^"..
"(wardrobe_hair_"..wardrobe.formspec_selections[pname][3]..".png^[multiply:#"..fields.hairdye..")^"..
"(wardrobe_under_shirt_"..wardrobe.formspec_selections[pname][5]..".png^[multiply:#"..fields.undshirt..")^"..
"(wardrobe_under_shirt_"..wardrobe.formspec_selections[pname][6]..".png^[multiply:#"..fields.undshirt2..")^"..
"(wardrobe_socks_2.png^[multiply:#"..fields.socks..")^"..
View gist:85ccd50a9a472a1accc8cd69f3f3bd97
function wardrobe.is_save_hex(textfield)
if string.match(textfield, "^[0-9a-fA-F]+$") and #textfield == 6 then
return textfield
else
return "ffffff"
end
end
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