[Mod] Shapes Library [lib_shapes][git]

ShadMOrdre
Member
 
Posts: 597
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

[Mod] Shapes Library [lib_shapes][git]

by ShadMOrdre » Fri Jan 19, 2018 23:36

This mod is a standalone library for adding node box shaped nodes. Nodebox shapes are defined within sets. Mods can register single shaped nodes or entire sets. This works just like the stairs mod, in that, you can register a shaped node for any defined node. Cobble stairs, wood furniture, metal doors, and many other combinations are possible.

This mod is a drop in replacement for stairs, walls, beds, doors, fences. This mod registers a shape node for each define nodebox. The shape node is used in the craft grid to create the nodebox shaped nodes.
DOWNLOAD: https://github.com/ShadMOrdre/lib_shapes/archive/master.zip
Browse Code: https://github.com/ShadMOrdre/lib_shapes

DEPENDENCIES: None
OPTIONAL DEP: None

LICENSES: LGPLv2.1, for code by me, CC-BY-SA-4.0 for graphics by me. Other licenses apply for code and graphics done by others. Where found, those licenses included.

SCREENSHOTS:
Image
Image
Image
Image
Last edited by ShadMOrdre on Tue Sep 24, 2019 05:35, edited 1 time in total.
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

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

Re: [Mod] Shapes Library [lib_shapes][git]

by bell07 » Sat Jan 20, 2018 09:36

How to use the library? I looked to the linked mods and all of them does use an copy of the shape instead of provided in this mod.

One suggestion: Maybe you add the "do_shape" function for each shape to the lib_shapes mod for easy usage?

something like
Code: Select all
lib_shapes.register_shape("myshape", {
   description = "My Shape",
   shape_type = "basic",
   node_box = { },
   do_shape = function(self, name, template_node or textures or any other required info to get a shaped node),
      --do magic, apply textures to the shape
      minetest.register_node(new_shaped_node, def)
   end),
}


In other mod it should be usable as
Code: Select all
local shape = lib_shapes.get("myshape")
shape:do_shape("dirty_shape", "default:dirt")
 

ShadMOrdre
Member
 
Posts: 597
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mod] Shapes Library [lib_shapes][git]

by ShadMOrdre » Tue Sep 03, 2019 00:04

So I've updated this mod to simply be an API.

You may register nodes with the various assigned nodebox shape, simply by calling this mods functions.

This mod is meant to be a drop in replacement for stairs, walls, and others.

Currently, the API is not documented, but can be summed up as follows:

To register a shape set for any node, simply call the appropriate function. Each of the functions below register all the shapes assigned to that set for the supplied node. Each set contains several shapes, so this can grow rather quickly, overloading MTs allowable node definitions limit of 32768.

lib_shapes.register_basic_set("mymod:mynode")
lib_shapes.register_fancy_set("mymod:mynode")
lib_shapes.register_door_set("mymod:mynode")
lib_shapes.register_furniture_set("mymod:mynode")

To enable node registration for a single shape, use one of the following functions:

lib_shapes.register_node("mymod:mynode", "shape_name")
lib_shapes.register_fancy_node("mymod:mynode", "shape_name")
lib_shapes.register_door_node("mymod:mynode", "shape_name")
lib_shapes.register_furniture_node("mymod:mynode", "shape_name")

The available shape sets, and their corresponding shapes, are listed below. Columnia, nnmobs, stairs, xdecor, and the Farlands game provided some shapes, the rest are of my own design. I've tried to make the names as simple as possible, and am open to discussion regarding shape names, as they do get a little long.

BASIC SET:
beam, beam_with_support, pillar_thick, pillar, pillar_with_wall_thick, pillar_with_wall, stairs, stairs_inner,
stairs_outer, slab, ceiling, wall_thick, wall, wall_thick_centered, wall_centered

FANCY SET:
column_base_100_height_100_width, column_base_050_height_100_width, column_beam,
column_beam_with_support, column_pillar_075_width, column_pillar_050_width,
column_pillar_with_slab_100_height_050_width, column_pillar_with_full_wall_075_width,
column_pillar_with_full_wall_050_width, steps_open_basic_01, steps_solid_basic_01,
wall_100_height_075_width, wall_100_height_050_width, wall_100_height_025_width,
wall_100_height_125_width, wall_junction_with_slab_100_height_050_width,
wall_with_slab_100_height_050_width, wall_with_deco_01_100_height_050_width,
wall_arch_large_100_height_050_width, wall_arch_small_100_height_050_width

DOOR SET: (Left and right doors are registered separately, and must be placed separately.
door_centered, door_centered_right, door_centered_with_window, door_centered_with_window_right,
door_centered_sliding, door_centered_sliding_right, door_centered_300_height_150_width,
door_centered_300_height_150_width_right, door_centered_400_height_200_width,
door_centered_400_height_200_width_right, door_centered_400_height_250_width,
door_centered_400_height_250_width_right, trapdoor_solid, trapdoor_with_window, fencegate_centered,
fencegate_centered_right, fencegate_centered_solid, fencegate_centered_solid_right

FURNITURE SET:
bed_simple, chair_arm_01, chair_arm_02, sofa_basic_01_corner, sofa_basic_01_left, sofa_basic_01_right,
sofa_basic_01_section, cabinet_basic_01, chair_basic_01, stool_basic_01, table_basic_01, table_basic_02,
table_half_01, table_section_01

LICENSE: LGPL 2.1
TO DOs: Document API. Add screenshots. Fix topic post to include this info. ???
DEPENDENCIES: NONE
OPTIONAL DEPENDENCIES: NONE
DOWNLOAD:Click the green download button.
SOURCE:Git
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

R-One
Member
 
Posts: 153
Joined: Wed Dec 20, 2017 23:06
Location: Nice, France

Re: [Mod] Shapes Library [lib_shapes][git]

by R-One » Tue Sep 03, 2019 07:22

hello, first of all it's a great job!

A small question :
I have not managed to craft a shape with blueprints is it normal?

A suggestion :
To implement it on a non-creative server in a role-play spirit, would it be possible to go through separate craft tables, workbenches?
 

ShadMOrdre
Member
 
Posts: 597
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mod] Shapes Library [lib_shapes][git]

by ShadMOrdre » Tue Sep 03, 2019 22:41

The blueprints and pencil are currently non-functional.

I thought it best, in the bigger picture of things, to only provide a means to register the shapes, much like the stairs mod.

The basic crafting mechanism, of applying a shape and a node in the craft grid, is mainly for creative, but could also be used by games or mods, as a way to also craft these blocks.

Games, or other mods, can implement the various ways in which these blocks are crafted. I'm personally looking at creating a chisel tool, as part of a tools mod, that will enable crafting the node shapes of this mod, as an example of how this could be implemented independently by game devs and modders.

In essence, crafting being such a central game mechanic, IMHO, it should be implemented on a game basis, as opposed to internalizing that behaviour within this mod. (If that makes sense.) ;)

Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

ShadMOrdre
Member
 
Posts: 597
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mod] Shapes Library [lib_shapes][git]

by ShadMOrdre » Tue Sep 24, 2019 05:37

UPDATE.

Now includes fences, including special stone post, wood rail fences.

Fixed issues with sitting and sleeping.

Please report issues here or on github. Please let me know what you think.


Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

ShadMOrdre
Member
 
Posts: 597
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mod] Shapes Library [lib_shapes][git]

by ShadMOrdre » Sun Oct 13, 2019 07:28

UPDATE 2019 - 10 - 12:
Prevent shaped nodes from appearing in creative. Nodes should be crafted using the shape node and the material desired.
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 21 guests