Re: [Mod]Frame - lag-free non-entity item frames![frame]
Posted: Tue Jun 12, 2018 10:56
List of supported blocks is hardcoded? Can it autogenerate for all mods loaded by using some criteria?
The official Minetest discussion board
https://forum.minetest.net/
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.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.Fixer wrote:List of supported blocks is hardcoded? Can it autogenerate for all mods loaded by using some criteria?
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: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.Fixer wrote:List of supported blocks is hardcoded? Can it autogenerate for all mods loaded by using some criteria?
They are supported, and mods that add them can use the API to create the needed frame blocks.texmex wrote:Also, please add support for craftitems.
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.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.
https://github.com/minetest-mods/frametexmex 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
I haven't (re) tested this claim, but it should... just work?This minetest mod adds a lag-free, simple and stylish item and node frame to minetest. It can contain either nodes or craftitems.
Adding bucket with lava/water to frame doesnt worksofar wrote:putting water in a frame is nonsensical (it needs to go into a bucket
What happens if a bunch of mods ask to be loaded last?texmex wrote:Woulf it be possible to whip up an engine feature for marking a mod to load last?
Then those would load last but in a random order internally.csirolli wrote:What happens if a bunch of mods ask to be loaded last?texmex wrote:Woulf it be possible to whip up an engine feature for marking a mod to load last?
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.bosapara wrote:Adding bucket with lava/water to frame doesnt worksofar wrote:putting water in a frame is nonsensical (it needs to go into a bucket
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.bosapara wrote: but with default:dirt_with_rainforest_litter block this trick doesnt works
by some reasons even after adding didnt work, now all works (did several shutdowns)sofar wrote: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.bosapara wrote: but with default:dirt_with_rainforest_litter block this trick doesnt works
Code: Select all
minetest.register_on_mods_loaded(function()
for _, node in pairs(minetest.registered_nodes) do
frame.register(node.name)
end
end)
Code: Select all
WARNING[Main]: Frame registered for ":simple_potions:potion_black" but it isn't registered
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>
EDIT 2:texmex wrote:Hey, I'm trying to use the mod's API in order to support more items.
No matter what I do i get this:Code: Select all
minetest.register_on_mods_loaded(function() for _, node in pairs(minetest.registered_nodes) do frame.register(node.name) end end)
If I was to omit the : I'd instead get:Code: Select all
WARNING[Main]: Frame registered for ":simple_potions:potion_black" but it isn't registered
Am I using it wrong? This on Minetest 5.0.0-dev-84a5fa0.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>
At the opposite, I'm wondering if it is possible to have all flat, with the same image as in the inventory for cubes.sofar wrote: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.bosapara wrote:Is it possible to make sword/picks etc at frame more "3d" (1px depth) like at usual frames?
Yes, entirely possible, not even that hard either.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.
this should fix it, and I added an assert to warn about incorrect name values passed to the registration: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)
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)
Code: Select all
selection_box = {
type = "wallmounted",
wall_side = {-1/2, -1/2, -1/2, -3/8, 1/2, 1/2},
},
Code: Select all
selection_box = {
type = "wallmounted",
wall_side = {-6/16, -6/16, -6/16, -3/8, 6/16, 6/16},
},