[solved]beds.bed api top/bottom

Post Reply
Nordal
Member
Posts: 158
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

[solved]beds.bed api top/bottom

by Nordal » Post

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.
CFS - still widely unknown

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

Re: beds.bed api top/bottom

by TumeniNodes » Post

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
A Wonderful World

Nordal
Member
Posts: 158
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: beds.bed api top/bottom

by Nordal » Post

Thank you TumeniNodes for your explanation and the valuable hints to the defs and the textures!
CFS - still widely unknown

Nordal
Member
Posts: 158
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: beds.bed api top/bottom

by Nordal » Post

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
CFS - still widely unknown

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

Re: beds.bed api top/bottom

by TumeniNodes » Post

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.
A Wonderful World

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

Re: beds.bed api top/bottom

by TumeniNodes » Post

A Wonderful World

Nordal
Member
Posts: 158
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: beds.bed api top/bottom

by Nordal » Post

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.
CFS - still widely unknown

Nordal
Member
Posts: 158
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: beds.bed api top/bottom

by Nordal » Post

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.
CFS - still widely unknown

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests