Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local INV_WIDTH = 8
- local INV_HEIGHT = 6
- minetest.register_on_joinplayer(
- function( player )
- local inv = minetest.get_inventory( { type = "player", name = player:get_player_name() } )
- local list_name = "main"
- inv:set_size( list_name, INV_WIDTH * INV_HEIGHT )
- inv:set_width( list_name, INV_WIDTH )
- local s = player:get_inventory_formspec()
- -- change view size
- s = s:gsub( "(size%[)([%d%.]+),([%d%.]+)(%])",
- function( prefix, w, h, suffix )
- return prefix .. INV_WIDTH .. "," .. ( INV_HEIGHT + 2.5 ) .. suffix
- end
- )
- -- change number of slots
- s = s:gsub( "(list%[current_player;" .. list_name .. ";)([%d%.]+),([%d%.]+);([%d%.]+),([%d%.]+)",
- function( prefix, x, y, w, h )
- return prefix ..
- x .. "," .. y .. ";" ..
- INV_WIDTH .. "," .. INV_HEIGHT
- end
- )
- player:set_inventory_formspec( s )
- end
- )
RAW Paste Data