shaped based mods

bell07
Member
 
Posts: 140
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

shaped based mods

by bell07 » Mon Feb 27, 2017 20:56

Hi,

before I start to create pull requests for different projects I need to ask if I am on the right way.

In short:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua
index 191c78d..2781ce2 100644
--- a/mods/stairs/init.lua
+++ b/mods/stairs/init.lua
@@ -33,6 +33,8 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
                is_ground_content = false,
                groups = groups,
                sounds = sounds,
+               base_material = recipeitem,
+               shape_type = "stair",
                selection_box = {
                        type = "fixed",
                        fixed = {
@@ -143,6 +145,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
                is_ground_content = false,
                groups = groups,
                sounds = sounds,
+               base_material = recipeitem,
+               shape_type = "slab",
                node_box = {
                        type = "fixed",
                        fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},


The longer description: I like to introduce the "base_material" and "shape_type" attributes on "shaped" items (mostly nodes).

Why? There are some mods that just creates nodes definitions for each combination of existing textures (base_material) and some (new or existing) shapes. I am about ts_doors, moreblocks, stairsplus, carpets, lib_node_shapes...

Sometimes I look to buildings of MC players, they have very limited count of blocks available but this people mostly build more pretty things, andI asked me "why"? The answer is: trough nearly unlimited blocks available in MT, the player (me and my childs) loose the overview and use mostly just the first-known blocks like cobblestone and sand. I see this issue is not new, the mod developer of mods above try to solve it by
1: limit textures usage to limit the outcome nodes
2: set "not_in_creative_inventory" group and take a second way to get the blocks, like circular saw or doors-workshop

The Solution 1 is sad.
My proposal about "base_material" and "shape_type" is about generalization of solution 2.

I started the smart_inventory with the goal to be able to manage as much item definitions as possible. The whole gloss of diversity in Minetest should be available to the player in an intuitive way. Coincided with lib_node_shapes I seen the differentiation need. If I enable all generated shapes, the shapes takes over the inventory because of 90% all items are from this one mod. But the game focus should not be moved to this one mod. The solution is to differentiate the "natural items" and "shaped items". Natural items are individual, each of them earned a place of honor in inventory. The "shaped items" are just combinations of a base-material and a shape.
If the both attributes "base_material" and "shape_type" are available on item definition, the information is usable for some things more like
- generalized "shaping tool" possible for circular saw, doors worshop, carpet maker
- Encourages to take more shaped combinations in more mods
- shaping-mods can check for "if base_material exists, do not use them for new shape", to avoid carpets for each variation of wood chapes.

In smart_inventory a simple handling of shaped material outcome is impelemted. In creative there is a top-level group "material outcome" that distinguish the ~ 4.000 shaped items from ~ 300 natural items in other groups. See second screenshot in https://forum.minetest.net/viewtopic.php?f=9&t=16740#p253365
lib_node_shapes did included the "base_material+shape_type" patch already so you can play with them. Note, smart_inventory ignores the "not_in_creative_inventory" group if "base_material" is set. So the lib_node_shapes does not spam the creative inventory if an other inventory mod is used.

Now the question: Will the patch been accepted in minetest_game and the proposed attributes able to be "official"?

PS: sorry for my bad English.
 

User avatar
octacian
Member
 
Posts: 408
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian

Re: shaped based mods

by octacian » Tue Feb 28, 2017 05:49

First off, I agree with what you've said here, though I think there could possibly be a better solution to separating things, but this is a start. I'd give a suggestion but my brain is dead at this point, it's getting late for me xD

In terms of whether the patch will be accepted, well, that's why we open pull requests. Open a pull request with your patch, and chances are some developers will review it and deem it worthwhile, or they may deem it as not worthwhile. You really don't know until you open the PR ;)
God isn't dead!

My Coolest Mods:
MicroExpansion, Working Computers, Interchangeable Hands

Check out my YouTube channel! (octacian)
 

bell07
Member
 
Posts: 140
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: shaped based mods

by bell07 » Tue Feb 28, 2017 10:39

Thanks!
I did it: https://github.com/minetest/minetest_game/pull/1594

By the way, I added a "Shaped" tab to the minetest_game default inventory sfinv in creative and filter them out from "Nodes" and "Items":
Image

Unsure how to handle the tools because all tools are shaped :-/
Attachments
screenshot_20170228_113243.png
screenshot_20170228_113243.png (166.22 KiB) Viewed 735 times
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: shaped based mods

by burli » Tue Feb 28, 2017 11:56

This is something for a mod or subgame. I don't think that a PR is successful for Minetest Game
 

bell07
Member
 
Posts: 140
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: shaped based mods

by bell07 » Tue Feb 28, 2017 12:17

I got it feared and therefore I asked at the beginning of this thread :)

It is a new feature that I applied to 5 mods in minetest_game and already to 4 mods outside of minetest_game. So take it to an own mod and redefine work in other mods does not sense. A subgame that differs from minetest_game just by this one feature does no sense too for me.
It is an enhancement on the base framework, like the custom groups http://dev.minetest.net/Groups/Custom_groups at his time. The both attributes are noting new, the change takes the at definition time available information available at the runtime too.
I looked already to if the new attributes should be new custom groups, but the groups allow integer values only, but I need string-values for base_material and shape_type (like mod_origin).
I am sure the both attributes can be used for different things in the feature, my pull request contains just the definition and really basic usage in sfinv-creative page.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 68 guests

cron