[Mod] Formspex - Consistent Backgrounds [formspex]

User avatar
orwell
Member
 
Posts: 779
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

[Mod] Formspex - Consistent Backgrounds [formspex]

by orwell » Thu Jul 30, 2015 13:03

This mod makes all formspecs automatically look like they look in minetest_game. No work on the side of other mods is required.

-specific background image and colors for forms
-player inventory hotbar is highlighted in a darker color.

Depends: default
License: WTFPL
There are no textures and sounds

Notes: formspecs set by set_inventory_formspec and set_creative_formspec remain unchanged (would be too difficult to implement). For many containers, it is required to re-place the node.
I won't continue development on this mod except if bugs are found.

Latest version:
formspex_1_2.zip
v. 1.2
(1.7 KiB) Downloaded 88 times

-fixed: forms already declaring a background element (e.g. signs_lib) looked weird
-fixed some other stuff I don't remember

Old versions:
formspex.zip
v. 1.1
(1.45 KiB) Downloaded 33 times

- Fix: meta:from_table() not working
- Fix: showed a warning "invalid use of background without a size[] element" when using short form of field[] in formspecs (won't modify these forms.)

formspex.zip
v. 1.0
(1.45 KiB) Downloaded 46 times
Last edited by orwell on Mon Nov 16, 2015 21:02, edited 5 times in total.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47
 

User avatar
orwell
Member
 
Posts: 779
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: [Mod] Formspex [formspex]

by orwell » Fri Jul 31, 2015 08:14

screenshot showing a craft-guide form.
nothing in craft-guide's source was changed.
fs_screenie_cg_no.png
Without Formspex
(225.39 KiB) Not downloaded yet

screenshot_1848063.png
With Formspex
(102.62 KiB) Not downloaded yet

fs_screenie_hotbardark.png
Highlighted Hotbar
(15.18 KiB) Not downloaded yet
Last edited by orwell on Wed Aug 19, 2015 10:01, edited 1 time in total.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [Mod] Formspex [formspex]

by 4aiman » Fri Jul 31, 2015 08:31

A before/after image would be great :)
Anyways, judging by the code, this mod will add extra lag when opening inventories.

It is One Thing to concat strings while registering nodes (i.e. at a server startup) and The Other Thing to do that every time someone opens inventory. Aside from additional calculations this adds an extra delay - once the minetest.show_formspec is called the server will wait it to finish. The same goes to the get_meta replacement.



The idea of quickly changing formspecs IS great on it's own nevertheless.

To speed-up your code, try using a table.
Just populate it with the pieces of a formspec and then use table.concat.

Regards!
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
Location: On earth
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun
 

User avatar
rubenwardy
Moderator
 
Posts: 5790
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Formspex [formspex]

by rubenwardy » Sun Aug 02, 2015 17:10

The name was confusing to me, maybe put: [Mod] Formspex [formspex] - Consistent backgrounds

4aiman wrote:It is One Thing to concat strings while registering nodes (i.e. at a server startup) and The Other Thing to do that every time someone opens inventory. Aside from additional calculations this adds an extra delay - once the minetest.show_formspec is called the server will wait it to finish. The same goes to the get_meta replacement.


I doubt that the delay will be noticeable. Even with 40 players there won't be more than 100 opens per second. Optimise in the right places, in the places that need it most. If this was C++ or a lower level language, then yes these optimisations would be good.
 

User avatar
orwell
Member
 
Posts: 779
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: [Mod] Formspex [formspex]

by orwell » Mon Aug 03, 2015 15:13

rubenwardy wrote:The name was confusing to me, maybe put: [Mod] Formspex [formspex] - Consistent backgrounds

Thanks. I changed the title.
4aiman wrote:It is One Thing to concat strings while registering nodes (i.e. at a server startup) and The Other Thing to do that every time someone opens inventory. Aside from additional calculations this adds an extra delay - once the minetest.show_formspec is called the server will wait it to finish. The same goes to the get_meta replacement.

To the show_formspec method: It is a function, and so it is unpredictable for my mod what it will return.
To the meta replacement: every time a mod sets the "formspec" meta tag, the style information is added. (not every time someone opens formspecs). Again, it is unpredictable what the tag will be set to.
So, nothing can be set on load time.
rubenwardy wrote:I doubt that the delay will be noticeable. Even with 40 players there won't be more than 100 opens per second. Optimise in the right places, in the places that need it most. If this was C++ or a lower level language, then yes these optimisations would be good.

This is Lua, and Lua is great!
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [Mod] Formspex [formspex] - Consistent Backgrounds

by 4aiman » Tue Aug 04, 2015 10:46

@orwell
You don't have to explain anything to me, since I can't remember suggesting to use concatenation only at load-time. :/
Actually, I can't really tell why you decided I've told you to do that...


Anyway, I'd like to cite the other part of my message (which was the reason to post it):
4aiman wrote:To speed-up your code, try using a table.
Just populate it with the pieces of a formspec and then use table.concat.

^ This is really important. Just try it and you'll see the difference.
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
Location: On earth
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: [Mod] Formspex [formspex] - Consistent Backgrounds

by Minetestforfun » Mon Aug 10, 2015 20:16

Always no screens :(

EDIT : i see it, sorry and thank you :)
Last edited by Minetestforfun on Tue Aug 11, 2015 11:01, edited 1 time in total.
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47
 

User avatar
orwell
Member
 
Posts: 779
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: [Mod] Formspex [formspex] - Consistent Backgrounds

by orwell » Wed Aug 19, 2015 10:06

4aiman wrote:@orwell
Anyway, I'd like to cite the other part of my message (which was the reason to post it):
4aiman wrote:To speed-up your code, try using a table.
Just populate it with the pieces of a formspec and then use table.concat.

^ This is really important. Just try it and you'll see the difference.


Sorry, now I understand what you mean with this part of your post. I've seen it in another mod.
I will think about it.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

amadin
Member
 
Posts: 544
Joined: Tue Jun 16, 2015 16:23
 

User avatar
orwell
Member
 
Posts: 779
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: [Mod] Formspex - Consistent Backgrounds [formspex]

by orwell » Tue Oct 18, 2016 17:32

just enable both your mod and this one.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

amadin
Member
 
Posts: 544
Joined: Tue Jun 16, 2015 16:23
 

User avatar
orwell
Member
 
Posts: 779
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: [Mod] Formspex - Consistent Backgrounds [formspex]

by orwell » Fri Nov 04, 2016 21:07

amadin wrote:I mean change to not default color, for example to red.

And I mean, just try to enable both your mod viewtopic.php?f=11&t=15640 and this one.
See what happens when you open e.g. a homedecor nightstand(it must have been placed after formspex was enabled)
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 


Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 4 guests