forked from mtcontrib/connected_chests
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
e13bb490d1
2
.luacheckrc
Normal file
2
.luacheckrc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
read_globals = {"minetest", "table", "default", "pipeworks"}
|
||||||
|
globals = {"connected_chests"}
|
@ -1,2 +1,2 @@
|
|||||||
connected_chest_open from default
|
connected_chest_open from default
|
||||||
rest WTFPL
|
Content which is not copied from minetest_game is licensed under MIT.
|
||||||
|
27
init.lua
27
init.lua
@ -1,6 +1,3 @@
|
|||||||
local load_time_start = minetest.get_us_time()
|
|
||||||
|
|
||||||
|
|
||||||
-- param_tab maps the x and z offset to a param2 value
|
-- param_tab maps the x and z offset to a param2 value
|
||||||
local param_tab = {
|
local param_tab = {
|
||||||
["-1 0"] = 0,
|
["-1 0"] = 0,
|
||||||
@ -279,7 +276,7 @@ function connected_chests.register_chest(fromname, data)
|
|||||||
}
|
}
|
||||||
def_opened.diggable = false
|
def_opened.diggable = false
|
||||||
def_opened.on_blast = function() end
|
def_opened.on_blast = function() end
|
||||||
inside_texture = "default_chest_inside.png^([combine:16x32:5,0=" ..
|
inside_texture = "default_chest_inside.png^([combine:16x32:5,0=" ..
|
||||||
"default_chest_inside.png^connected_chests_inside_frame.png^[" ..
|
"default_chest_inside.png^connected_chests_inside_frame.png^[" ..
|
||||||
"makealpha:255,126,126)"
|
"makealpha:255,126,126)"
|
||||||
-- TODO, see right chest
|
-- TODO, see right chest
|
||||||
@ -475,7 +472,7 @@ local function close_chest(vi)
|
|||||||
pos.x = pos.x + x * 0.5
|
pos.x = pos.x + x * 0.5
|
||||||
pos.z = pos.z + z * 0.5
|
pos.z = pos.z + z * 0.5
|
||||||
minetest.sound_play("default_chest_close",
|
minetest.sound_play("default_chest_close",
|
||||||
{gain = 10.3, pos = pos, max_hear_distance = 10})
|
{gain = 0.3, pos = pos, max_hear_distance = 10, pitch = 0.7}, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- close all remaining open chest on shutdown
|
-- close all remaining open chest on shutdown
|
||||||
@ -521,7 +518,7 @@ connected_chests.register_chest("default:chest", {
|
|||||||
add_open_chest = true,
|
add_open_chest = true,
|
||||||
on_rightclick = function(pos, _, player)
|
on_rightclick = function(pos, _, player)
|
||||||
minetest.sound_play("default_chest_open",
|
minetest.sound_play("default_chest_open",
|
||||||
{gain = 0.3, pos = pos, max_hear_distance = 10})
|
{gain = 0.3, pos = pos, max_hear_distance = 10, pitch = 0.7}, true)
|
||||||
|
|
||||||
local vi = minetest.hash_node_position(pos)
|
local vi = minetest.hash_node_position(pos)
|
||||||
if not open_chests[vi]
|
if not open_chests[vi]
|
||||||
@ -563,12 +560,12 @@ connected_chests.register_chest("default:chest_locked", {
|
|||||||
add_open_chest = true,
|
add_open_chest = true,
|
||||||
on_rightclick = function(pos, _, player)
|
on_rightclick = function(pos, _, player)
|
||||||
if not default.can_interact_with_node(player, pos) then
|
if not default.can_interact_with_node(player, pos) then
|
||||||
minetest.sound_play("default_chest_locked", {pos = pos})
|
minetest.sound_play("default_chest_locked", {pos = pos}, true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.sound_play("default_chest_open",
|
minetest.sound_play("default_chest_open",
|
||||||
{gain = 0.32, pos = pos, max_hear_distance = 10})
|
{gain = 0.32, pos = pos, max_hear_distance = 10, pitch = 0.7}, true)
|
||||||
|
|
||||||
local vi = minetest.hash_node_position(pos)
|
local vi = minetest.hash_node_position(pos)
|
||||||
-- TODO: somehow avoid using the chest node names here
|
-- TODO: somehow avoid using the chest node names here
|
||||||
@ -638,17 +635,3 @@ minetest.register_alias("connected_chests:chest_left_locked", "default:chest_loc
|
|||||||
minetest.register_alias("connected_chests:chest_right_locked", "default:chest_locked_connected_right")
|
minetest.register_alias("connected_chests:chest_right_locked", "default:chest_locked_connected_right")
|
||||||
minetest.register_alias("connected_chests:chest_locked_left", "default:chest_locked_connected_left")
|
minetest.register_alias("connected_chests:chest_locked_left", "default:chest_locked_connected_left")
|
||||||
minetest.register_alias("connected_chests:chest_locked_right", "default:chest_locked_connected_right")
|
minetest.register_alias("connected_chests:chest_locked_right", "default:chest_locked_connected_right")
|
||||||
|
|
||||||
--~ local function log_access(pos, player, text)
|
|
||||||
--~ minetest.log("action", player:get_player_name()..
|
|
||||||
--~ " moves stuff "..text.." at "..minetest.pos_to_string(pos))
|
|
||||||
--~ end
|
|
||||||
|
|
||||||
|
|
||||||
local time = (minetest.get_us_time() - load_time_start) / 1000000
|
|
||||||
local msg = "[connected_chests] loaded after ca. " .. time .. " seconds."
|
|
||||||
if time > 0.01 then
|
|
||||||
print(msg)
|
|
||||||
else
|
|
||||||
minetest.log("info", msg)
|
|
||||||
end
|
|
||||||
|
Loading…
Reference in New Issue
Block a user