This commit is contained in:
Lizzy Fleckenstein 2021-01-27 19:21:28 +01:00
parent 85f3fb7ea1
commit dbd6ebd4b5
2 changed files with 11 additions and 3 deletions

View File

@ -2,6 +2,7 @@ local S = minetest.get_translator("mcl_chests")
local mod_doc = minetest.get_modpath("doc") local mod_doc = minetest.get_modpath("doc")
-- Chest Entity -- Chest Entity
local animate_chests = (minetest.settings:get_bool("animated_chests") ~= false)
local entity_animation_speed = 25 local entity_animation_speed = 25
local entity_animations = { local entity_animations = {
["open"] = {x = 0, y = 10}, ["open"] = {x = 0, y = 10},
@ -163,8 +164,10 @@ end
local player_chest_open = function(player, pos, node_name, textures, param2, double, sound, mesh) local player_chest_open = function(player, pos, node_name, textures, param2, double, sound, mesh)
local name = player:get_player_name() local name = player:get_player_name()
open_chests[name] = {pos = pos, node_name = node_name, textures = textures, param2 = param2, double = double, sound = sound, mesh = mesh} open_chests[name] = {pos = pos, node_name = node_name, textures = textures, param2 = param2, double = double, sound = sound, mesh = mesh}
if animate_chests then
local dir = minetest.facedir_to_dir(param2) local dir = minetest.facedir_to_dir(param2)
find_or_create_entity(pos, node_name, textures, param2, double, sound, mesh, dir):open(name, back_is_blocked(pos, dir) or double and back_is_blocked(mcl_util.get_double_container_neighbor_pos(pos, param2, node_name:sub(-4)), dir)) find_or_create_entity(pos, node_name, textures, param2, double, sound, mesh, dir):open(name, back_is_blocked(pos, dir) or double and back_is_blocked(mcl_util.get_double_container_neighbor_pos(pos, param2, node_name:sub(-4)), dir))
end
end end
-- Simple protection checking functions -- Simple protection checking functions
@ -223,7 +226,9 @@ local player_chest_close = function(player)
if open_chest == nil then if open_chest == nil then
return return
end end
if animate_chests then
find_or_create_entity(open_chest.pos, open_chest.node_name, open_chest.textures, open_chest.param2, open_chest.double, open_chest.sound, open_chest.mesh):close(name) find_or_create_entity(open_chest.pos, open_chest.node_name, open_chest.textures, open_chest.param2, open_chest.double, open_chest.sound, open_chest.mesh):close(name)
end
chest_update_after_close(open_chest.pos) chest_update_after_close(open_chest.pos)
open_chests[name] = nil open_chests[name] = nil

View File

@ -91,6 +91,9 @@ flame_sound (Flame sound) bool true
# Form: Image height / Image width # Form: Image height / Image width
fire_animation_frames (Fire Animation Frames) int 8 fire_animation_frames (Fire Animation Frames) int 8
# Whether to animate chests when open / close
animated_chests (Animated chests) bool true
[Experimental] [Experimental]
# Whether ice is translucent. If disabled, ice is fully opaque. # Whether ice is translucent. If disabled, ice is fully opaque.
# #