New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add simple fast inventory #1179
Conversation
|
||
sfinv.register_page("sfinv:crafting", { | ||
title = "Crafting", | ||
is_in_nav = function(self, player, context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed as not needed
I've been waiting for something like this, so, I'm very positive about a change like this. |
+1 |
return [[ | ||
size[8,8.6] | ||
bgcolor[#080808BB;true] | ||
background[5,5;1,1;gui_formbg.png;true] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these overwritten later with default.gui_bg .. default.gui_bg_img ..
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Background is an image which is drawn below all other elements, this background image is at (5, 5) and has size (1, 1). I imagine that default.gui_bg covers the entire window
Fixed all issues except page number coloring |
|
||
* `title` - human readable page name (required) | ||
* `get(self, player, context, vars)` - returns a formspec string. See formspec variables. (required) | ||
* `is_in_nav(self, player, context)` - return true if it appears in tab header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a bit confusing, how about Return true to show it in the tab header
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed (hopefully to your satisfaction)
I haven't tested it, but I'm very positive about the idea as well. |
It now uses a label and colorize instead of a table. |
Very useful for things like armor, etc. We can finally get rid of inventory_plus and it's like! |
@rubenwardy Hm, wouldn't there be problems with the text overlapping other buttons if it's center-aligned? |
Ideally you'd be able to specify a rectangle for the text to be in, then center align it there
That's the aim! |
Hm, I don't know if this is possible though. I think keeping it left-aligned is good anyway. |
Is using a table that much of a problem? It's a bit overkill, but at least it looks right |
Please note than an older version of this code has been running on the capture the flag server with no noticed performance issues. The sfinv code is only really called on player join and tab switch |
I have no opinion on this so am neutral. I can't review as am useless with inventory / formspec stuff. |
Great idea, don't have time to review properly. |
This should be a nice thing, I'm tired of clicking via buttons in inventory plus, should be much faster and easier with tabs 👍 |
rebased |
Found something weird: searching for "bone" gets no results even though bone is seen on the first page, and has bone in the description. Very weird. |
player:set_inventory_formspec(fs) | ||
end | ||
|
||
minetest.register_on_joinplayer(function(player) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make sense to free the contexts on leave player, to free unused memory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
+1 |
2 weeks to freeze, want this in release? |
I'd really like to get this in, I think it'll be a good step forward for mods. |
Does anyone have any more objections/points? It isn't possible to modify set_inventory_formspec, the mods would have to do sfinv.enabled = false |
Sorry i can't comment being useless with inventory stuff. I have no objection to the intent. |
@rubenwardy @sofar @paramat Will it get there for 0.4.15? |
Works ok. Did the trash icon background disappear in this PR? |
I'd recommend a huge squash+merge. 37 commits is way too much. As squashed PR it's not that big
|
Of course - I was leaving squash until later |
a56089f
to
1bf739e
Compare
done |
readded trash background |
👍 |
But,
Why was this changed? 42 and 256 are intentional @rubenwardy |
Sfinv was started before that change, so that was a rebasing error |
The problems with email are due to that mod using an outdated sfinv api. Will fix later |
Ok. |
Allows mods to define tabs for the 'i' inventory, even when creative mode is off.
Potential Problems
Planned improvements
When this PR is merged, I'll work on: