Skip to content

Commit

Permalink
Add textures to default formspecs
Browse files Browse the repository at this point in the history
  • Loading branch information
PilzAdam committed Feb 26, 2013
1 parent 230747c commit 32a552c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
5 changes: 5 additions & 0 deletions mods/default/README.txt
Expand Up @@ -89,6 +89,11 @@ MirceaKitsune (WTFPL):
Jordach (CC BY-SA 3.0):
character.png

PilzAdam (WTFPL):
default_inventory.png
default_inventory_furnace.png
default_inventory_chest.png

Glass breaking sounds (CC BY 3.0):
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
2: http://www.freesound.org/people/Tomlija/sounds/97669/
Expand Down
28 changes: 16 additions & 12 deletions mods/default/init.lua
Expand Up @@ -1233,6 +1233,7 @@ minetest.register_node("default:chest", {
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"size[8,9]"..
"background[-0.19,-0.25;8.41,9.75;default_inventory_chest.png]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Chest")
Expand Down Expand Up @@ -1342,19 +1343,21 @@ minetest.register_node("default:chest_locked", {
local pos = pos.x .. "," .. pos.y .. "," ..pos.z
minetest.show_formspec(clicker:get_player_name(), "default:chest_locked",
"size[8,9]"..
"background[-0.19,-0.25;8.41,9.75;default_inventory_chest.png]"..
"list[nodemeta:".. pos .. ";main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
end
end,
})

default.furnace_inactive_formspec =
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
"size[8,7.5]"..
"background[-0.19,-0.25;8.41,8.25;default_inventory_furnace.png]"..
"image[2,1;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,2;1,1;]"..
"list[current_name;src;2,0;1,1;]"..
"list[current_name;dst;5,0;2,2;]"..
"list[current_player;main;0,3.5;8,4;]"

minetest.register_node("default:furnace", {
description = "Furnace",
Expand Down Expand Up @@ -1488,13 +1491,14 @@ minetest.register_abm({
meta:set_string("infotext","Furnace active: "..percent.."%")
hacky_swap_node(pos,"default:furnace_active")
meta:set_string("formspec",
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
"size[8,7.5]"..
"background[-0.19,-0.25;8.41,8.25;default_inventory_furnace.png]"..
"image[2,1;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]")
"list[current_name;fuel;2,2;1,1;]"..
"list[current_name;src;2,0;1,1;]"..
"list[current_name;dst;5,0;2,2;]"..
"list[current_player;main;0,3.5;8,4;]")
return
end

Expand Down
17 changes: 15 additions & 2 deletions mods/default/player.lua
Expand Up @@ -67,8 +67,21 @@ function player_update_visuals(pl)
pl:set_properties(prop)
end

-- Update appearance when the player joins
minetest.register_on_joinplayer(player_update_visuals)
function default.set_player_inventory(player)
player:set_inventory_formspec(
"size[8,7.5]"..
"background[-0.19,-0.25;8.41,8.25;default_inventory.png]"..
"list[current_player;main;0,3.5;8,4;]"..
"list[current_player;craft;3,0;3,3;]"..
"list[current_player;craftpreview;7,1;1,1;]"
)
end

-- Set model and formspec of player
minetest.register_on_joinplayer(function(player)
player_update_visuals(player)
default.set_player_inventory(player)
end)

-- Check each player and apply animations
function player_step(dtime)
Expand Down
Binary file added mods/default/textures/default_inventory.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mods/default/textures/default_inventory_chest.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 32a552c

Please sign in to comment.