Guest User

Untitled

a guest
Nov 9th, 2017
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local INV_WIDTH = 8
  2. local INV_HEIGHT = 6
  3.  
  4. minetest.register_on_joinplayer(
  5.     function( player )
  6.         local inv = minetest.get_inventory( { type = "player", name = player:get_player_name() } )
  7.    
  8.         local list_name = "main"
  9.         inv:set_size( list_name, INV_WIDTH * INV_HEIGHT )
  10.         inv:set_width( list_name, INV_WIDTH )
  11.  
  12.         local s = player:get_inventory_formspec()
  13.         -- change view size
  14.         s = s:gsub( "(size%[)([%d%.]+),([%d%.]+)(%])",
  15.             function( prefix, w, h, suffix )
  16.                return prefix .. INV_WIDTH .. "," .. ( INV_HEIGHT + 2.5 ) .. suffix
  17.             end
  18.         )
  19.    
  20.         -- change number of slots
  21.         s = s:gsub( "(list%[current_player;" .. list_name .. ";)([%d%.]+),([%d%.]+);([%d%.]+),([%d%.]+)",
  22.                 function( prefix, x, y, w, h )
  23.                     return prefix ..
  24.                            x .. "," .. y .. ";" ..
  25.                            INV_WIDTH .. "," .. INV_HEIGHT
  26.                 end
  27.         )
  28.         player:set_inventory_formspec( s )
  29.     end
  30. )
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×