Code style fixes in mcl_chests

This commit is contained in:
AFCMS 2022-09-10 18:32:37 +02:00
parent 0ae76776b1
commit 0da1822d26
No known key found for this signature in database
GPG Key ID: 8720389A25B652E3

@ -96,7 +96,8 @@ minetest.register_entity("mcl_chests:chest", {
return
end
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)
self.is_open = false
end
@ -148,7 +149,8 @@ minetest.register_entity("mcl_chests:chest", {
})
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
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))
@ -398,10 +400,9 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
drawtype = "mesh",
mesh = "mcl_chests_chest.b3d",
tiles = small_textures,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
use_texture_alpha = "opaque",
paramtype = "light",
paramtype2 = "facedir",
stack_max = 64,
sounds = mcl_sounds.node_sound_wood_defaults(),
groups = { deco_block = 1 },
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 },
},
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_sound = "default_chest",
_chest_entity_mesh = "mcl_chests_chest",
_chest_entity_animation_type = "chest",
paramtype = "light",
paramtype2 = "facedir",
stack_max = 64,
drop = drop,
groups = {
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 },
},
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_sound = "default_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 },
},
tiles = { "blank.png^[resize:16x16" },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
use_texture_alpha = "clip",
groups = {
handy = 1,
axey = 1,
@ -1093,13 +1093,12 @@ minetest.register_node("mcl_chests:ender_chest", {
drawtype = "mesh",
mesh = "mcl_chests_chest.b3d",
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",
paramtype2 = "facedir",
stack_max = 64,
groups = { deco_block = 1 },
sounds = mcl_sounds.node_sound_stone_defaults(),
on_construct = function(pos, node)
on_construct = function(pos)
local node = minetest.get_node(pos)
node.name = "mcl_chests:ender_chest_small"
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_animation_type = "chest",
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
-- have an inventory on its own
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")
end,
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
return false
end
@ -1303,7 +1302,7 @@ for color, desc in pairs(boxtypes) do
_doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp,
tiles = { mob_texture },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
use_texture_alpha = "opaque",
drawtype = "mesh",
mesh = "mcl_chests_shulker.b3d",
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 },
},
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_sound = "mcl_chests_shulker",
_chest_entity_mesh = "mcl_chests_shulker",