[Mod]Frame - lag-free non-entity item frames![frame]

User avatar
Fixer
Member
Posts: 904
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer
Location: Ukraine

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by Fixer » Post

List of supported blocks is hardcoded? Can it autogenerate for all mods loaded by using some criteria?

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by texmex » Post

Fixer wrote:List of supported blocks is hardcoded? Can it autogenerate for all mods loaded by using some criteria?
You should be able to use the API for creating an autogeneration loop from registered items. The problem is making sure that code runs last, I reckon.

Also, please add support for craftitems.

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by Krock » Post

This mod registers an item frame for each item and node which you would like to have supported. The limit of ~32k registered nodes is reached quite easily on that way. However, would be possible to loop through the registered nodes (and overwrite minetest.register_node for nodes that were registered afterwards) and ignore all of them which are in the "not_in_creative_inventory" group.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by bosapara » Post

Water and lava source looks a few weird, any fix?

Image

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

Fixer wrote:List of supported blocks is hardcoded? Can it autogenerate for all mods loaded by using some criteria?
No, because there is no way to guarantee that you're last mod loaded, ever.

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

texmex wrote:
Fixer wrote:List of supported blocks is hardcoded? Can it autogenerate for all mods loaded by using some criteria?
You should be able to use the API for creating an autogeneration loop from registered items. The problem is making sure that code runs last, I reckon.
I specifically avoided doing this for lots of reasons. You can't add stairs or non-cubic blocks like this easily, and putting water in a frame is nonsensical (it needs to go into a bucket).
texmex wrote:Also, please add support for craftitems.
They are supported, and mods that add them can use the API to create the needed frame blocks.

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

Krock wrote:This mod registers an item frame for each item and node which you would like to have supported. The limit of ~32k registered nodes is reached quite easily on that way. However, would be possible to loop through the registered nodes (and overwrite minetest.register_node for nodes that were registered afterwards) and ignore all of them which are in the "not_in_creative_inventory" group.
I considered this, but I'd rather avoid the possible max_node overflow and offer a simple API to allow mods to create frames. This is more consistent and robust, and avoids lots of the aforementioned problems with adding them automatically.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by texmex » Post

Woulf it be possible to whip up an engine feature for marking a mod to load last?

Has craftitem support been added recently? Is this issue invalid? https://github.com/minetest-mods/frame/issues/4

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

texmex wrote:Woulf it be possible to whip up an engine feature for marking a mod to load last?

Has craftitem support been added recently? Is this issue invalid? https://github.com/minetest-mods/frame/issues/4
https://github.com/minetest-mods/frame
This minetest mod adds a lag-free, simple and stylish item and node frame to minetest. It can contain either nodes or craftitems.
I haven't (re) tested this claim, but it should... just work?

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by bosapara » Post

sofar wrote:putting water in a frame is nonsensical (it needs to go into a bucket
Adding bucket with lava/water to frame doesnt work

User avatar
csirolli
Member
Posts: 133
Joined: Mon Jan 15, 2018 21:46
GitHub: HeyITGuyFixIt
IRC: CSirolli
In-game: CSirolli
Location: Florida, USA
Contact:

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by csirolli » Post

texmex wrote:Woulf it be possible to whip up an engine feature for marking a mod to load last?
What happens if a bunch of mods ask to be loaded last?

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by texmex » Post

csirolli wrote:
texmex wrote:Woulf it be possible to whip up an engine feature for marking a mod to load last?
What happens if a bunch of mods ask to be loaded last?
Then those would load last but in a random order internally.

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by bosapara » Post

problem with not adding of the bucket with lava/water solved with World Edit,
just replaced block with name: frame:bucket_bucket_lava and frame:bucket_bucket_water

but with default:dirt_with_rainforest_litter block this trick doesnt works

Image

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

bosapara wrote:
sofar wrote:putting water in a frame is nonsensical (it needs to go into a bucket
Adding bucket with lava/water to frame doesnt work
This is probably an interface problem in the bucket code - it likely doesn't pass the right click event to the clicked node. I'm not sure this is fixable, since it would mean fixing the bucket, not the frame mod.

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

bosapara wrote: but with default:dirt_with_rainforest_litter block this trick doesnt works
that's because that node isn't registered in the frame mod. Send a PR to add it to the list in `init.lua` and I'll merge it.

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by bosapara » Post

sofar wrote:
bosapara wrote: but with default:dirt_with_rainforest_litter block this trick doesnt works
that's because that node isn't registered in the frame mod. Send a PR to add it to the list in `init.lua` and I'll merge it.
by some reasons even after adding didnt work, now all works (did several shutdowns)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by texmex » Post

Hey, I'm trying to use the mod's API in order to support more items.

Code: Select all

minetest.register_on_mods_loaded(function()
  for _, node in pairs(minetest.registered_nodes) do
  	frame.register(node.name)
  end
end)
No matter what I do i get this:

Code: Select all

WARNING[Main]: Frame registered for ":simple_potions:potion_black" but it isn't registered
If I was to omit the : I'd instead get:

Code: Select all

ERROR[Main]: ModError: Runtime error from mod 'testing' in callback on_mods_loaded(): ...inetest.app/Contents/Resources/builtin/game/register.lua:63: attempt to concatenate a nil value
ERROR[Main]: stack traceback:
ERROR[Main]: 	...inetest.app/Contents/Resources/builtin/game/register.lua:63: in function 'check_modname_prefix'
ERROR[Main]: 	...inetest.app/Contents/Resources/builtin/game/register.lua:113: in function 'register_item'
ERROR[Main]: 	...inetest.app/Contents/Resources/builtin/game/register.lua:206: in function 'register_node'
ERROR[Main]: 	...mods/frame/init.lua:152: in function 'register'
ERROR[Main]: 	...mods/testing/compatibility.lua:5: in function <...mods/testing/compatibility.lua:3>
ERROR[Main]: 	...inetest.app/Contents/Resources/builtin/game/register.lua:419: in function <...inetest.app/Contents/Resources/builtin/game/register.lua:399>
Am I using it wrong? This on Minetest 5.0.0-dev-84a5fa0.

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

You can't re-register items that were already registered before, don't do that. At a minimum, call the registration function only once per item.

The frame mod registration function doesn't handle a leading ":" character. You'll need to omit it.

The crash is weird. The registration will try and minetest.register_node("frame:simple_potions_potion_black" ... but that mail fail the check_modname_prefix somehow, but that should probably be an explicit failure than a stack trace. Worth filing a bug against minetest IMHO.

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by 12Me21 » Post

texmex wrote:Hey, I'm trying to use the mod's API in order to support more items.

Code: Select all

minetest.register_on_mods_loaded(function()
  for _, node in pairs(minetest.registered_nodes) do
  	frame.register(node.name)
  end
end)
No matter what I do i get this:

Code: Select all

WARNING[Main]: Frame registered for ":simple_potions:potion_black" but it isn't registered
If I was to omit the : I'd instead get:

Code: Select all

ERROR[Main]: ModError: Runtime error from mod 'testing' in callback on_mods_loaded(): ...inetest.app/Contents/Resources/builtin/game/register.lua:63: attempt to concatenate a nil value
ERROR[Main]: stack traceback:
ERROR[Main]: 	...inetest.app/Contents/Resources/builtin/game/register.lua:63: in function 'check_modname_prefix'
ERROR[Main]: 	...inetest.app/Contents/Resources/builtin/game/register.lua:113: in function 'register_item'
ERROR[Main]: 	...inetest.app/Contents/Resources/builtin/game/register.lua:206: in function 'register_node'
ERROR[Main]: 	...mods/frame/init.lua:152: in function 'register'
ERROR[Main]: 	...mods/testing/compatibility.lua:5: in function <...mods/testing/compatibility.lua:3>
ERROR[Main]: 	...inetest.app/Contents/Resources/builtin/game/register.lua:419: in function <...inetest.app/Contents/Resources/builtin/game/register.lua:399>
Am I using it wrong? This on Minetest 5.0.0-dev-84a5fa0.
EDIT 2:
The problem is that you are calling frame.register when the frame mod is not the currently loading mod.
frame.register uses `minetest.register_node("frame:" .. name:gsub(":", "_"), {`, which is only allowed while the game is loading the `frame` mod.

Change "frame:" to ":frame:" here and that should fix it:
https://github.com/minetest-mods/frame/ ... t.lua#L152
(and don't add ":" to the item name when calling frame.register)

(The error happens because, when checking if an item name is allowed, the game tests if the name starts with `core.get_current_modname() .. ":"`. But get_current_modname returns nil if there is no mod being loaded.
You should just get a "does not follow naming conventions" error instead, so it's not a very important bug)
Last edited by 12Me21 on Fri Oct 12, 2018 08:28, edited 3 times in total.

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

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by Pyrollo » Post

sofar wrote:
bosapara wrote:Is it possible to make sword/picks etc at frame more "3d" (1px depth) like at usual frames?
yes, but you'd get back the lag again, because that can only be done by using entities again, which is what this mod avoids.
At the opposite, I'm wondering if it is possible to have all flat, with the same image as in the inventory for cubes.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

Pyrollo wrote:At the opposite, I'm wondering if it is possible to have all flat, with the same image as in the inventory for cubes.
Yes, entirely possible, not even that hard either.

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by sofar » Post

12Me21 wrote:Change "frame:" to ":frame:" here and that should fix it:
https://github.com/minetest-mods/frame/ ... t.lua#L152
(and don't add ":" to the item name when calling frame.register)
this should fix it, and I added an assert to warn about incorrect name values passed to the registration:

https://github.com/minetest-mods/frame/ ... fe749f37d9

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by texmex » Post

Thanks sofar!

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by texmex » Post

Got it working now. For some reason I had to check for existing tiles definition beforehand though I thought that frame mod did that same check internally.

Code: Select all

minetest.register_on_mods_loaded(function()
	for _, node in pairs(minetest.registered_nodes) do
		if node.tiles then
			frame.register(node.name)
		end
	end
end)
Which items are working and which aren't is a hit and miss though:
- Animated node textures don't get cropped
- Armor items don't attach
- Wings are registered as craftitems so they don't work still

Also, I think the frames should rotate on placement so that they'll always face the player who placed it. :)

Image
Attachments
screenshot_20181013_081811.png
screenshot_20181013_081811.png (461.36 KiB) Viewed 1127 times

User avatar
PEAK
Member
Posts: 187
Joined: Mon Jun 08, 2015 20:32
In-game: PEAK
Contact:

Re: [Mod]Frame - lag-free non-entity item frames![frame]

by PEAK » Post

A suggestion:

change the selection box from:

Code: Select all

selection_box = {
	type = "wallmounted",
	wall_side = {-1/2, -1/2, -1/2, -3/8, 1/2, 1/2},
},
to:

Code: Select all

selection_box = {
	type = "wallmounted",
	wall_side = {-6/16, -6/16, -6/16, -3/8, 6/16, 6/16},
},
So you can place the frame on a chest while still having easy access to the chest behind it by clicking on the border of the frame.

Image
Attachments
Frame_selbox.png
Frame_selbox.png (67.2 KiB) Viewed 1127 times
I am okay with using the screenshots in all my posts for the website of Minetest (http://minetest.net).

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests