How to make a formspec furance-like object?

User avatar
Nitro
Member
 
Posts: 15
Joined: Thu Dec 27, 2018 10:56
GitHub: henry9836

How to make a formspec furance-like object?

by Nitro » Sat Dec 29, 2018 10:02

I looked at the furnace code and still can't seem to wrap my head around this. When I show the formspec to the player there are no boxs for items to go in

Image

What happens if I click on where the boxs should be
Image

Code: Select all
      minetest.show_formspec(player:get_player_name(), "jamm_base:boilerform",
                     "size[8,8.5;]" ..
                     default.gui_bg..
                     default.gui_bg_img..
                     default.gui_slots..
                     "list[current_name;src;2.75,0.5;1,1;]"..
                     "list[current_name;fuel;2.75,2.5;1,1;]"..
                     "list[current_name;dst;4.75,0.96;2,2;]"..
                     "list[current_player;main;0,4.25;8,1;]"..
                     "list[current_player;main;0,5.5;8,3;8]"..
                     "listring[current_name;dst]"..
                     "listring[current_player;main]"..
                     "listring[current_name;src]"..
                     "listring[current_player;main]"..
                     "listring[current_name;fuel]"..
                     "listring[current_player;main]"..
                     default.get_hotbar_bg(0, 4.25)
                     )
         end
})
 

User avatar
Napiophelios
Member
 
Posts: 966
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: How to make a formspec furance-like object?

by Napiophelios » Sat Dec 29, 2018 11:54

These are set in node registration
look at furnace node:

Code: Select all
   on_construct = function(pos)
      local meta = minetest.get_meta(pos)
      meta:set_string("formspec", default.get_furnace_inactive_formspec())
      local inv = meta:get_inventory()
      inv:set_size('src', 1)
      inv:set_size('fuel', 1)
      inv:set_size('dst', 4)
   end,
 

User avatar
Nitro
Member
 
Posts: 15
Joined: Thu Dec 27, 2018 10:56
GitHub: henry9836
 

User avatar
Pyrollo
Member
 
Posts: 223
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: How to make a formspec furance-like object?

by Pyrollo » Sat Dec 29, 2018 12:33

show_formspec forms and node forms are a bit different.

show_formspec forms are attached to a player only. node formspec are attached to player and node.

So with show_formspec, you have to manage the node context yourself.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]
 


Return to Modding Discussion



Who is online

Users browsing this forum: Exabot [Bot] and 3 guests