k_smallblocks/generate_map.lua

119 lines
5.0 KiB
Lua

--[[
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/>.
--]]
for key_int, val_bitmap_as_int in pairs( smallblocks.origin_bitmaps ) do
local bitmap_as_int = val_bitmap_as_int
local bitmap = util.integer_to_bitmap( bitmap_as_int )
local rotated_bitmap = bitmap
local facedir = 0
-- rotations around +y
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
for i = 1, 3, 1 do
rotated_bitmap = util.rotate_bitmap_around_plus_y( rotated_bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
end
rotated_bitmap = util.orient_bitmap_towards_plus_z( bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
for i = 1, 3, 1 do
rotated_bitmap = util.rotate_bitmap_around_plus_z( rotated_bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
end
rotated_bitmap = util.orient_bitmap_towards_minus_z( bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
for i = 1, 3, 1 do
rotated_bitmap = util.rotate_bitmap_around_minus_z( rotated_bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
end
rotated_bitmap = util.orient_bitmap_towards_plus_x( bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
for i = 1, 3, 1 do
rotated_bitmap = util.rotate_bitmap_around_plus_x( rotated_bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
end
rotated_bitmap = util.orient_bitmap_towards_minus_x( bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
for i = 1, 3, 1 do
rotated_bitmap = util.rotate_bitmap_around_minus_x( rotated_bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
end
rotated_bitmap = util.orient_bitmap_towards_minus_y( bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
for i = 1, 3, 1 do
rotated_bitmap = util.rotate_bitmap_around_minus_y( rotated_bitmap )
smallblocks.int_facedir_map[util.bitmap_to_integer( rotated_bitmap )] = facedir
smallblocks.int_name_map[util.bitmap_to_integer( rotated_bitmap )] = ""..bitmap_as_int
facedir = facedir + 1
end
end
for i = 1, 255, 1 do
minetest.log( "none", i.." maps to " .. smallblocks.int_name_map[i] .. " facedir:" .. smallblocks.int_facedir_map[i] )
end
local test_bitmap_plus_y = util.integer_to_bitmap( 1 )
local test_bitmap = test_bitmap_plus_y
test_bitmap = util.orient_bitmap_towards_minus_x( test_bitmap_plus_y )
minetest.log( "error", "tb-x" .. util.bitmap_to_integer( test_bitmap ) )
test_bitmap = util.orient_bitmap_towards_plus_x( test_bitmap_plus_y )
minetest.log( "error", "tb+x" .. util.bitmap_to_integer( test_bitmap ) )
test_bitmap = util.orient_bitmap_towards_minus_z( test_bitmap_plus_y )
minetest.log( "error", "tb-z" .. util.bitmap_to_integer( test_bitmap ) )
test_bitmap = util.orient_bitmap_towards_plus_z( test_bitmap_plus_y )
minetest.log( "error", "tb+z" .. util.bitmap_to_integer( test_bitmap ) )