[solved]beds.bed api top/bottom

Nordal
Member
 
Posts: 49
Joined: Mon Jul 30, 2018 15:46
Location: Germany

[solved]beds.bed api top/bottom

by Nordal » Wed Jul 24, 2019 06:38

The Minetest Game API contains a beds API. Thought this to be a simple means to make a bed.
Unfortunately I don't understand the definition part:
Code: Select all
### Bed definition

   {
      description = "Simple Bed",
      inventory_image = "beds_bed.png",
      wield_image = "beds_bed.png",
      tiles = {
         bottom = {'Tile definition'}, -- the tiles of the bottom part of the bed.
         top = {Tile definition} -- the tiles of the bottom part of the bed.
      },
      nodebox = {
         bottom = 'regular nodebox',     -- bottom part of bed (see [Node boxes])
         top = 'regular nodebox',        -- top part of bed (see [Node boxes])
      },
      selectionbox = 'regular nodebox',  -- for both nodeboxes (see [Node boxes])
      recipe = {                                         -- Craft recipe
         {"group:wool", "group:wool", "group:wool"},
         {"group:wood", "group:wood", "group:wood"}
      }
   }

What is the difference between inventory image and wield image?
What do bottom and top of the bed mean? Where is the boundary between top and bottom? What means Tile definition in this context?
Last edited by Nordal on Sun Sep 08, 2019 15:58, edited 1 time in total.
 

User avatar
TumeniNodes
Member
 
Posts: 2825
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: beds.bed api top/bottom

by TumeniNodes » Wed Jul 24, 2019 07:06

All of the defs are found in the 'beds.lua' https://github.com/minetest/minetest_ga ... ds.lua#L52

then, if you look within the textures folder for the beds mod, it should become clear.
The small beds_bed.png image is used for both the inventory image (which shows in the hud bar) and the wield image shown in the hand when selected
*and this should help to understand where some of those textures are flipped or rotated, which reduces the number of textures required: https://rubenwardy.com/minetest_modding ... transformt

The simple beds are made up from 2 separate nodeboxes

The api really should provide a comment for this reference
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

Nordal
Member
 
Posts: 49
Joined: Mon Jul 30, 2018 15:46
Location: Germany

Re: beds.bed api top/bottom

by Nordal » Wed Jul 24, 2019 17:57

Thank you TumeniNodes for your explanation and the valuable hints to the defs and the textures!
 

Nordal
Member
 
Posts: 49
Joined: Mon Jul 30, 2018 15:46
Location: Germany

Re: beds.bed api top/bottom

by Nordal » Thu Aug 15, 2019 04:30

I now defined a bed completely, but I have problems with the inventory image and the wielded image. They are shown as a colored square. The error is
Code: Select all
2019-08-15 06:21:25: ERROR[Main]: generateImage(): Could not load image "beds_bunkbed_sides32x16.png" while building texture; Creating a dummy image
2019-08-15 06:21:25: ERROR[Main]: generateImage(): Could not load image "beds_bunkbed_sides32x16.png" while building texture; Creating a dummy image

I suppose it's the image size on the one hand. How to make a 16x16 image if the bed's 32 long?
Secondly I don't know how to produce an image with that typical 3D inventory view out of 2D tile images.
Can someone help, please?
https://github.com/Nordall/darkageobjects/tree/master
 

User avatar
TumeniNodes
Member
 
Posts: 2825
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: beds.bed api top/bottom

by TumeniNodes » Thu Aug 15, 2019 05:06

I'll help you but won't be until later in eve.
Basically, you will open a new texture in an image editor such as Gimp, make it 16x16 with transparent background, and then create the image within that space.

I cannot promise that bunk beds will look very good in that space but, I'll give it a shot.
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
TumeniNodes
Member
 
Posts: 2825
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
 

Nordal
Member
 
Posts: 49
Joined: Mon Jul 30, 2018 15:46
Location: Germany

Re: beds.bed api top/bottom

by Nordal » Thu Sep 05, 2019 19:08

Hello TumeniNodes,
I went on commenting in issue#2. https://github.com/Nordall/darkageobjects/issues/2. May you want to take a look at it. In short here: bed works fine, only top and bottom are exchanged and the inv image is missing. I'll try this later on.
 

Nordal
Member
 
Posts: 49
Joined: Mon Jul 30, 2018 15:46
Location: Germany

Re: beds.bed api top/bottom

by Nordal » Sun Sep 08, 2019 15:56

I managed to draw an acceptable inv image!

Thank you very much, TumeniNodes, for your patience and friendliness. I've learned a lot, and without your help this bed would never have been existed.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests