Code style fixes in mcl_chests

This commit is contained in:
AFCMS 2022-09-10 18:32:37 +02:00
parent 0ae76776b1
commit 0da1822d26
Signed by untrusted user: AFCMS
GPG Key ID: 8720389A25B652E3
1 changed files with 22 additions and 23 deletions

View File

@ -96,7 +96,8 @@ minetest.register_entity("mcl_chests:chest", {
return return
end end
self:set_animation("close") self:set_animation("close")
minetest.sound_play(self.sound_prefix .. "_close", { pos = self.node_pos, gain = 0.3, max_hear_distance = 16 }, minetest.sound_play(self.sound_prefix .. "_close",
{ pos = self.node_pos, gain = 0.3, max_hear_distance = 16 },
true) true)
self.is_open = false self.is_open = false
end end
@ -148,7 +149,8 @@ minetest.register_entity("mcl_chests:chest", {
}) })
local function get_entity_pos(pos, dir, double) local function get_entity_pos(pos, dir, double)
pos = vector.new(pos) pos = vector.copy(pos)
pos.y = pos.y - 0.49
if double then if double then
local add, mul, vec, cross = vector.add, vector.multiply, vector.new, vector.cross local add, mul, vec, cross = vector.add, vector.multiply, vector.new, vector.cross
pos = add(pos, mul(cross(dir, vec(0, 1, 0)), -0.5)) pos = add(pos, mul(cross(dir, vec(0, 1, 0)), -0.5))
@ -398,10 +400,9 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
drawtype = "mesh", drawtype = "mesh",
mesh = "mcl_chests_chest.b3d", mesh = "mcl_chests_chest.b3d",
tiles = small_textures, tiles = small_textures,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, use_texture_alpha = "opaque",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
stack_max = 64,
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
groups = { deco_block = 1 }, groups = { deco_block = 1 },
on_construct = function(pos, node) on_construct = function(pos, node)
@ -436,14 +437,13 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
fixed = { -0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375 }, fixed = { -0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375 },
}, },
tiles = { "blank.png^[resize:16x16" }, tiles = { "blank.png^[resize:16x16" },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, use_texture_alpha = "clip",
_chest_entity_textures = small_textures, _chest_entity_textures = small_textures,
_chest_entity_sound = "default_chest", _chest_entity_sound = "default_chest",
_chest_entity_mesh = "mcl_chests_chest", _chest_entity_mesh = "mcl_chests_chest",
_chest_entity_animation_type = "chest", _chest_entity_animation_type = "chest",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
stack_max = 64,
drop = drop, drop = drop,
groups = { groups = {
handy = 1, handy = 1,
@ -585,7 +585,7 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
fixed = { -0.4375, -0.5, -0.4375, 0.5, 0.375, 0.4375 }, fixed = { -0.4375, -0.5, -0.4375, 0.5, 0.375, 0.4375 },
}, },
tiles = { "blank.png^[resize:16x16" }, tiles = { "blank.png^[resize:16x16" },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, use_texture_alpha = "clip",
_chest_entity_textures = left_textures, _chest_entity_textures = left_textures,
_chest_entity_sound = "default_chest", _chest_entity_sound = "default_chest",
_chest_entity_mesh = "mcl_chests_chest", _chest_entity_mesh = "mcl_chests_chest",
@ -761,7 +761,7 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
fixed = { -0.5, -0.5, -0.4375, 0.4375, 0.375, 0.4375 }, fixed = { -0.5, -0.5, -0.4375, 0.4375, 0.375, 0.4375 },
}, },
tiles = { "blank.png^[resize:16x16" }, tiles = { "blank.png^[resize:16x16" },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, use_texture_alpha = "clip",
groups = { groups = {
handy = 1, handy = 1,
axey = 1, axey = 1,
@ -1093,13 +1093,12 @@ minetest.register_node("mcl_chests:ender_chest", {
drawtype = "mesh", drawtype = "mesh",
mesh = "mcl_chests_chest.b3d", mesh = "mcl_chests_chest.b3d",
tiles = tiles_chest_ender_small, tiles = tiles_chest_ender_small,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, use_texture_alpha = "opaque",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
stack_max = 64,
groups = { deco_block = 1 }, groups = { deco_block = 1 },
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
on_construct = function(pos, node) on_construct = function(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
node.name = "mcl_chests:ender_chest_small" node.name = "mcl_chests:ender_chest_small"
minetest.set_node(pos, node) minetest.set_node(pos, node)
@ -1142,7 +1141,7 @@ minetest.register_node("mcl_chests:ender_chest_small", {
_chest_entity_mesh = "mcl_chests_chest", _chest_entity_mesh = "mcl_chests_chest",
_chest_entity_animation_type = "chest", _chest_entity_animation_type = "chest",
tiles = { "blank.png^[resize:16x16" }, tiles = { "blank.png^[resize:16x16" },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, use_texture_alpha = "clip",
-- Note: The “container” group is missing here because the ender chest does not -- Note: The “container” group is missing here because the ender chest does not
-- have an inventory on its own -- have an inventory on its own
groups = { pickaxey = 1, deco_block = 1, material_stone = 1, chest_entity = 1, not_in_creative_inventory = 1 }, groups = { pickaxey = 1, deco_block = 1, material_stone = 1, chest_entity = 1, not_in_creative_inventory = 1 },
@ -1157,7 +1156,7 @@ minetest.register_node("mcl_chests:ender_chest_small", {
"mcl_chests_enderchest", "mcl_chests_chest", "chest") "mcl_chests_enderchest", "mcl_chests_chest", "chest")
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if minetest.registered_nodes[minetest.get_node({ x = pos.x, y = pos.y + 1, z = pos.z }).name].groups.opaque == 1 then if minetest.registered_nodes[minetest.get_node(vector.offset(pos, 0, 1, 0)).name].groups.opaque == 1 then
-- won't open if there is no space from the top -- won't open if there is no space from the top
return false return false
end end
@ -1303,7 +1302,7 @@ for color, desc in pairs(boxtypes) do
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp, _doc_items_usagehelp = usagehelp,
tiles = { mob_texture }, tiles = { mob_texture },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, use_texture_alpha = "opaque",
drawtype = "mesh", drawtype = "mesh",
mesh = "mcl_chests_shulker.b3d", mesh = "mcl_chests_shulker.b3d",
groups = { groups = {
@ -1374,7 +1373,7 @@ for color, desc in pairs(boxtypes) do
fixed = { -0.48, -0.5, -0.48, 0.48, 0.489, 0.48 }, fixed = { -0.48, -0.5, -0.48, 0.48, 0.489, 0.48 },
}, },
tiles = { "blank.png^[resize:16x16" }, tiles = { "blank.png^[resize:16x16" },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, use_texture_alpha = "clip",
_chest_entity_textures = { mob_texture }, _chest_entity_textures = { mob_texture },
_chest_entity_sound = "mcl_chests_shulker", _chest_entity_sound = "mcl_chests_shulker",
_chest_entity_mesh = "mcl_chests_shulker", _chest_entity_mesh = "mcl_chests_shulker",