123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- --[[
- k_smallblocks is a Minetest mod that adds smaller blocks to minetest aswell as
- its own node placement prediction/system
- Copyright (C) 2019 Kurtzmusch
- This file is part of k_smallblocks
- k_smallblocks is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 2.1 of the License, or (at your option) any
- later version.
- k_smallblocks is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along
- with k_smallblocks. If not, see <https://www.gnu.org/licenses/>.
- --]]
- -- bitmaps are a binary representation of which of the 8 divisions of each node are filled by the material
- -- origin bitmaps are the ones that can be rotated to make any other of the 255 possibilities
- -- many bitmaps can be mapped to a single origin_bitmap, and each origin is a node registration
- -- the origin bitmaps are generated by generate_origin_bitmaps.lua
- -- 22 bitmaps will be generated and 22 nodes for each material will be registered
- -- the mod creates bitmaps when placing nodes over other nodes of the same material,
- -- then finds the correct node name and facedir using the maps int_facedir_map and int_name_map
- -- all 'unnamed nodes' will be called "<number>_<material>"
- -- 'named nodes' are the ones craftable and have a distinc name like "stair_<material>"
- -- example of named node "stair_stonebrick"
- -- exmaple of unnamed node "127_stonebrick"
- -- named nodes apear in the creative inventory and can be crafted
- -- unnamed nodes will not drop themselves when dug, but will drop the equivalent amount in smallblock_<material>
- -- example: when a cobble inner stair is dug, it will drop 7 smallblock_cobble
- -- inner and outer stairs are not craftable, but easily buildable
- -- the mod doesnt work with screwdriver, the idea is that you never need to rotate anything because you can manually
- -- dig a smallblock out of a node and replace it in other place in that node. textures always lign up aswell
- -- definitions of named nodes will contain a recipe, logic for correct orientation when placed and dug
- smallblocks = {}
- local modpath = minetest.get_modpath("k_smallblocks")
- smallblocks.int_facedir_map = { [255]=0 } -- maps an int that represents a bitmap to a facedir
- smallblocks.int_name_map = { [255]="" } -- maps an int that represents a bitmap to a name. many ints can map to a single name. a name is a string of the interger that represents the bitmap
- -- smallblocks.name_int_map = {} -- inverse of the above map, might be usefull in the future
- -- definitions of named (and craftable) nodes
-
- dofile(modpath .. "/util.lua")
- dofile(modpath .. "/definitions.lua")
- dofile(modpath .. "/generate_shapes.lua")
- dofile(modpath .. "/generate_nodeboxes.lua")
- dofile(modpath .. "/generate_map.lua")
- dofile(modpath .. "/api.lua")
- -- smallblocks.name_int_map = util.table_invert( smallblocks.int_name_map )
- -- example of how a mod would make smallblocks for a base node
- smallblocks.register_node( "stonebrick", true, false )
|