Basic maintainance + fix bugs

This commit is contained in:
Jean-Patrick Guerrero 2021-02-28 21:02:06 +01:00
parent 7e3549842f
commit b3fc6daf71
5 changed files with 71 additions and 71 deletions

View File

@ -1,4 +1,3 @@
unused_args = false
allow_defined_top = true
read_globals = {

View File

@ -1015,18 +1015,16 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, _, player
if from_y < to_y then
-- Goes down
-- Ensure that no piece disturbs the way
for i = 1, dx - 1 do
if inv:get_stack(
from_list, xy_to_index(from_x, from_y + i)):get_name() ~= "" then
for i = from_y + 1, to_y - 1 do
if inv:get_stack(from_list, xy_to_index(from_x, i)):get_name() ~= "" then
return 0
end
end
else
-- Goes up
-- Ensure that no piece disturbs the way
for i = 1, dx - 1 do
if inv:get_stack(
from_list, xy_to_index(from_x, from_y - i)):get_name() ~= "" then
for i = to_y + 1, from_y - 1 do
if inv:get_stack(from_list, xy_to_index(from_x, i)):get_name() ~= "" then
return 0
end
end
@ -1035,9 +1033,8 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, _, player
if from_y == to_y then
-- Goes right
-- Ensure that no piece disturbs the way
for i = 1, dx - 1 do
if inv:get_stack(
from_list, xy_to_index(from_x + i, from_y)):get_name() ~= "" then
for i = from_x + 1, to_x - 1 do
if inv:get_stack(from_list, xy_to_index(i, from_y)):get_name() ~= "" then
return 0
end
end
@ -1064,9 +1061,8 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, _, player
if from_y == to_y then
-- Goes left
-- Ensure that no piece disturbs the way and destination cell does
for i = 1, dx - 1 do
if inv:get_stack(
from_list, xy_to_index(from_x - i, from_y)):get_name() ~= "" then
for i = to_x + 1, from_x - 1 do
if inv:get_stack(from_list, xy_to_index(i, from_y)):get_name() ~= "" then
return 0
end
end

View File

@ -65,12 +65,15 @@ local enchant_buttons = {
function enchanting.formspec(pos, num)
local meta = minetest.get_meta(pos)
local formspec = [[ size[9,9;]
local formspec = [[
size[9,8.6;]
no_prepend[]
bgcolor[#080808BB;true]
background[0,0;9,9;ench_ui.png]
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
background9[0,0;9,9;ench_ui.png;6]
list[context;tool;0.9,2.9;1,1;]
list[context;mese;2,2.9;1,1;]
list[current_player;main;0.5,4.5;8,4;]
list[current_player;main;0.55,4.5;8,4;]
listring[current_player;main]
listring[context;tool]
listring[current_player;main]
@ -80,7 +83,7 @@ function enchanting.formspec(pos, num)
.."tooltip[sharp;"..FS("Your weapon inflicts more damages").."]"
.."tooltip[durable;"..FS("Your tool last longer").."]"
.."tooltip[fast;"..FS("Your tool digs faster").."]"
..default.gui_slots .. default.get_hotbar_bg(0.5,4.5)
..default.gui_slots .. default.get_hotbar_bg(0.55, 4.5)
formspec = formspec .. (enchant_buttons[num] or "")
meta:set_string("formspec", formspec)

View File

@ -83,7 +83,7 @@ local main_fs = "label[0.9,1.23;"..FS("Cut").."]"
box[-0.05,2;2.05,0.9;#555555] ]]
.."button[0,0;2,1;craft;"..FS("Crafting").."]"
.."button[2,0;2,1;storage;"..FS("Storage").."]"
..[[ image[3,1;1,1;gui_furnace_arrow_bg.png^[transformR270]
..[[ image[3,1;1,1;gui_arrow.png]
image[0,1;1,1;worktable_saw.png]
image[0,2;1,1;worktable_anvil.png]
image[3,2;1,1;hammer_layout.png]
@ -274,67 +274,69 @@ xdecor.register("workbench", {
allow_metadata_inventory_move = workbench.allow_move
})
for _, d in ipairs(workbench.defs) do
for i = 1, #nodes do
local node = nodes[i]
local mod_name, item_name = node:match("^(.-):(.*)")
local def = registered_nodes[node]
minetest.register_on_mods_loaded(function()
for _, d in ipairs(workbench.defs) do
for i = 1, #nodes do
local node = nodes[i]
local mod_name, item_name = node:match("^(.-):(.*)")
local def = registered_nodes[node]
if item_name and d[3] then
local groups = {}
local tiles
groups.not_in_creative_inventory = 1
if item_name and d[3] then
local groups = {}
local tiles
groups.not_in_creative_inventory = 1
for k, v in pairs(def.groups) do
if k ~= "wood" and k ~= "stone" and k ~= "level" then
groups[k] = v
for k, v in pairs(def.groups) do
if k ~= "wood" and k ~= "stone" and k ~= "level" then
groups[k] = v
end
end
end
if def.tiles then
if #def.tiles > 1 and (def.drawtype:sub(1,5) ~= "glass") then
tiles = def.tiles
if def.tiles then
if #def.tiles > 1 and (def.drawtype:sub(1,5) ~= "glass") then
tiles = def.tiles
else
tiles = {def.tiles[1]}
end
else
tiles = {def.tiles[1]}
tiles = {def.tile_images[1]}
end
else
tiles = {def.tile_images[1]}
--TODO: Translation support for Stairs/Slab
if not registered_nodes["stairs:slab_" .. item_name] then
stairs.register_stair_and_slab(item_name, node,
groups, tiles, def.description .. " Stair",
def.description .. " Slab", def.sounds)
end
minetest.register_node(":" .. node .. "_" .. d[1], {
--TODO: Translation support
description = def.description .. " " .. d[1]:gsub("^%l", string.upper),
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
sounds = def.sounds,
tiles = tiles,
groups = groups,
-- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box = xdecor.pixelbox(16, {unpack(d, 3)}),
sunlight_propagates = true,
on_place = minetest.rotate_node
})
elseif item_name and mod_name then
minetest.register_alias_force(
("%s:%s_innerstair"):format(mod_name, item_name),
("stairs:stair_inner_%s"):format(item_name)
)
minetest.register_alias_force(
("%s:%s_outerstair"):format(mod_name, item_name),
("stairs:stair_outer_%s"):format(item_name)
)
end
--TODO: Translation support for Stairs/Slab
if not registered_nodes["stairs:slab_" .. item_name] then
stairs.register_stair_and_slab(item_name, node,
groups, tiles, def.description .. " Stair",
def.description .. " Slab", def.sounds)
end
minetest.register_node(":" .. node .. "_" .. d[1], {
--TODO: Translation support
description = def.description .. " " .. d[1]:gsub("^%l", string.upper),
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
sounds = def.sounds,
tiles = tiles,
groups = groups,
-- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box = xdecor.pixelbox(16, {unpack(d, 3)}),
sunlight_propagates = true,
on_place = minetest.rotate_node
})
elseif item_name and mod_name then
minetest.register_alias_force(
("%s:%s_innerstair"):format(mod_name, item_name),
("stairs:stair_inner_%s"):format(item_name)
)
minetest.register_alias_force(
("%s:%s_outerstair"):format(mod_name, item_name),
("stairs:stair_outer_%s"):format(item_name)
)
end
end
end
end
end)
-- Craft items

BIN
textures/gui_arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B