code:
--global constants

helicopter.gravity = tonumber(minetest.settings:get("movement_gravity")) or 9.8
helicopter.tilting_speed = 1
helicopter.tilting_max = 0.20
helicopter.power_max = 15
helicopter.power_min = 0.2 -- if negative, the helicopter can actively fly downwards
helicopter.wanted_vert_speed = 5

helicopter.vector_up = vector.new(0, 1, 0)
helicopter.vector_forward = vector.new(0, 0, 1)

helicopter.last_time_command = 0

function helicopter.vector_length_sq(v)
	return v.x * v.x + v.y * v.y + v.z * v.z
end

if not minetest.global_exists("matrix3") then
	dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "matrix.lua")
end

function helicopter.check_node_below(obj)
	local pos_below = obj:get_pos()
	pos_below.y = pos_below.y - 0.1
	local node_below = minetest.get_node(pos_below).name
	local nodedef = minetest.registered_nodes[node_below]
	local touching_ground = not nodedef or -- unknown nodes are solid
			nodedef.walkable or false
	local liquid_below = not touching_ground and nodedef.liquidtype ~= "none"
	return touching_ground, liquid_below
end

function helicopter.heli_control(self, dtime, touching_ground, liquid_below, vel_before)
    helicopter.last_time_command = helicopter.last_time_command + dtime
    if helicopter.last_time_command > 1 then helicopter.last_time_command = 1 end

    if self.driver_name == nil then
        return
    end
    local driver = minetest.get_player_by_name(self.driver_name)

	if not driver then
		-- there is no driver (eg. because driver left)
		self.driver_name = nil
		if self.sound_handle then
			minetest.sound_stop(self.sound_handle)
			self.sound_handle = nil
		end
		self.object:set_animation_frame_speed(0)
		-- gravity
		self.object:set_acceleration(vector.multiply(helicopter.vector_up, -helicopter.gravity))
		return
	end

    local ctrl = driver:get_player_control()

    if ctrl.aux1 and helicopter.last_time_command > 0.3 then
        helicopter.last_time_command = 0
        if self._by_mouse == true then
            self._by_mouse = false
        else
            self._by_mouse = true
        end
    end

	local rot = self.object:get_rotation()

	local vert_vel_goal = 0
	if not liquid_below then
		if ctrl.jump then
			vert_vel_goal = vert_vel_goal + helicopter.wanted_vert_speed
		end
		if ctrl.sneak then
			vert_vel_goal = vert_vel_goal - helicopter.wanted_vert_speed
		end
	else
		vert_vel_goal = helicopter.wanted_vert_speed
	end

	-- rotation
	if not touching_ground then
        local rotation = self.object:get_rotation()
        local yaw = rotation.y
		local tilting_goal = vector.new()
		if ctrl.up then
			tilting_goal.z = tilting_goal.z + 4
		end
		if ctrl.down then
			tilting_goal.z = tilting_goal.z - 4
		end
        if self._by_mouse == true then
		    if ctrl.right then
			    tilting_goal.x = tilting_goal.x + 4
		    end
		    if ctrl.left then
			    tilting_goal.x = tilting_goal.x - 4
		    end
        else
		    if ctrl.right then
			    yaw = yaw - 0.02
                tilting_goal.x = tilting_goal.x + 0.2
		    end
		    if ctrl.left then
			    yaw = yaw + 0.02
                tilting_goal.x = tilting_goal.x - 0.2
		    end
        end
		tilting_goal = vector.multiply(vector.normalize(tilting_goal), helicopter.tilting_max)

		-- tilting
		if helicopter.vector_length_sq(vector.subtract(tilting_goal, self.tilting)) > (dtime * helicopter.tilting_speed)^2 then
			self.tilting = vector.add(self.tilting,
					vector.multiply(vector.direction(self.tilting, tilting_goal), dtime * helicopter.tilting_speed))
		else
			self.tilting = tilting_goal
		end
		if helicopter.vector_length_sq(self.tilting) > helicopter.tilting_max^2 then
			self.tilting = vector.multiply(vector.normalize(self.tilting), helicopter.tilting_max)
		end
		local new_up = vector.new(self.tilting)
		new_up.y = 1
		new_up = vector.normalize(new_up) -- this is what vector_up should be after the rotation
		local new_right = vector.cross(new_up, helicopter.vector_forward)
		local new_forward = vector.cross(new_right, new_up)
		local rot_mat = matrix3.new(
			new_right.x, new_up.x, new_forward.x,
			new_right.y, new_up.y, new_forward.y,
			new_right.z, new_up.z, new_forward.z
		)
		rot = matrix3.to_pitch_yaw_roll(rot_mat)

        if self._by_mouse == true then
		    rot.y = driver:get_look_horizontal()
        else
            rot.y = yaw
        end

	else
		rot.x = 0
		rot.z = 0
		self.tilting.x = 0
		self.tilting.z = 0
	end

	self.object:set_rotation(rot)

	-- calculate how strong the heli should accelerate towards rotated up
	local power = vert_vel_goal - vel_before.y + helicopter.gravity * dtime
	power = math.min(math.max(power, helicopter.power_min * dtime), helicopter.power_max * dtime)

    -- calculate energy consumption --
    ----------------------------------
    if self.energy > 0 and touching_ground == false then
        local position = self.object:get_pos()
        local altitude_consumption_variable = 0

        -- if gaining altitude, it consumes more power
        local y_pos_reference = position.y - 200 --after altitude 200 the power need will increase
        if y_pos_reference > 0 then altitude_consumption_variable = ((y_pos_reference/1000)^2) end

        local consumed_power = (power/1500) + altitude_consumption_variable
        self.energy = self.energy - consumed_power;

        local energy_indicator_angle = ((self.energy * 18) - 90) * -1
        if self.pointer:get_luaentity() then
            self.pointer:set_attach(self.object,'',{x=0,y=11.26,z=9.37},{x=0,y=0,z=energy_indicator_angle})
        else
            --in case it have lost the entity by some conflict
            self.pointer=minetest.add_entity({x=0,y=11.26,z=9.37},'helicopter:pointer')
            self.pointer:set_attach(self.object,'',{x=0,y=11.26,z=9.37},{x=0,y=0,z=energy_indicator_angle})
        end
    end
    if self.energy <= 0 then
        power = 0.2
		if touching_ground or liquid_below then
            --criar uma fucao pra isso pois ela repete na linha 268
			-- sound and animation
            if self.sound_handle then minetest.sound_stop(self.sound_handle) end
			self.object:set_animation_frame_speed(0)
			-- gravity
			self.object:set_acceleration(vector.multiply(helicopter.vector_up, -helicopter.gravity))
		end
    end
    ----------------------------
    -- end energy consumption --

	local rotated_up = matrix3.multiply(matrix3.from_pitch_yaw_roll(rot), helicopter.vector_up)
	local added_vel = vector.multiply(rotated_up, power)
	added_vel = vector.add(added_vel, vector.multiply(helicopter.vector_up, -helicopter.gravity * dtime))
	return vector.add(vel_before, added_vel)
end


code:
--
-- items
--

-- blades
minetest.register_craftitem("helicopter:blades",{
	description = "Helicopter Blades",
	inventory_image = "helicopter_blades_inv.png",
})
-- cabin
minetest.register_craftitem("helicopter:cabin",{
	description = "Cabin for Helicopter",
	inventory_image = "helicopter_cabin_inv.png",
})
-- heli
minetest.register_craftitem("helicopter:heli", {
	description = "Helicopter",
	inventory_image = "helicopter_heli_inv.png",

	on_place = function(itemstack, placer, pointed_thing)
		if pointed_thing.type ~= "node" then
			return
		end
		if minetest.get_node(pointed_thing.above).name ~= "air" then
			return
		end

        local obj = minetest.add_entity(pointed_thing.above, "helicopter:heli")
        local ent = obj:get_luaentity()
        --local imeta = itemstack:get_meta()
        local owner = placer:get_player_name()
        ent.owner = owner
        --[[
        ent.energy = imeta:get_int("energy")
        ent.hp = imeta:get_int("hp")]]--

        local properties = ent.object:get_properties()
        properties.infotext = owner .. " nice helicopter"
        ent.object:set_properties(properties)

		if not (creative_exists and placer and
				creative.is_enabled_for(placer:get_player_name())) then
			itemstack:take_item()
		end
		return itemstack
	end,
})

--
-- crafting
--

if minetest.get_modpath("default") then
	minetest.register_craft({
		output = "helicopter:blades",
		recipe = {
			{"basic_materials:steel_bar", "default:steel_ingot", "basic_materials:steel_bar"},
			{"default:steel_ingot", "basic_materials:gear_steel", "default:steel_ingot"},
			{"basic_materials:steel_bar", "default:steel_ingot", "basic_materials:steel_bar"},
		}
	})
	minetest.register_craft({
		output = "helicopter:cabin",
		recipe = {
			{"mesecons_materials:glue",           "group:wood",           "mesecons_materials:glue"},
			{"group:wood", "", "default:glass"},
			{"group:wood", "group:wood",           "group:wood"},
		}
	})
	minetest.register_craft({
		output = "helicopter:heli",
		recipe = {
			{"", "", "helicopter:blades"},
			{"", "oil:oil_bucket", "basic_materials:motor"},
			{"helicopter:blades", "basic_materials:motor", "helicopter:cabin"},
		}
	})
end

repo_name: korkut/MeseCraft

license: mit


code:
--
-- entity
--

minetest.register_entity('helicopter:seat_base',{
initial_properties = {
	physical = false,
	collide_with_objects=false,
	pointable=false,
	visual = "mesh",
	mesh = "seat_base.b3d",
    textures = {"helicopter_black.png",},
	},

    on_activate = function(self,std)
	    self.sdata = minetest.deserialize(std) or {}
	    if self.sdata.remove then self.object:remove() end
    end,

    get_staticdata=function(self)
      self.sdata.remove=true
      return minetest.serialize(self.sdata)
    end,

})

minetest.register_entity("helicopter:heli", {
	initial_properties = {
		physical = true,
		collide_with_objects = true,
		collisionbox = {-1,0,-1, 1,0.3,1},
		selectionbox = {-1,0,-1, 1,0.3,1},
		visual = "mesh",
		mesh = "helicopter_heli.b3d",
        backface_culling = false,
        textures = {"helicopter_interior_black.png", "helicopter_metal.png", "helicopter_strips.png",
                "helicopter_painting.png", "helicopter_black.png", "helicopter_aluminum.png", "helicopter_glass.png",
                "helicopter_interior.png", "helicopter_panel.png", "helicopter_colective.png", "helicopter_painting.png",
                "helicopter_rotors.png", "helicopter_interior_black.png",},
	},

	driver_name = nil,
	sound_handle = nil,
	tilting = vector.new(),
    energy = 0.001,
    owner = "",
    static_save = true,
    infotext = "A nice helicopter",
    last_vel = vector.new(),
    hp_max = 50,
    color = "#0063b0",
    _passenger = nil,
    _by_mouse = false,

    get_staticdata = function(self) -- unloaded/unloads ... is now saved
        return minetest.serialize({
            stored_energy = self.energy,
            stored_owner = self.owner,
            stored_hp = self.hp_max,
            stored_color = self.color,
            stored_driver_name = self.driver_name,
        })
    end,

	on_activate = function(self, staticdata, dtime_s)
        if staticdata ~= "" and staticdata ~= nil then
            local data = minetest.deserialize(staticdata) or {}
            self.energy = data.stored_energy
            self.owner = data.stored_owner
            self.hp_max = data.stored_hp
            self.color = data.stored_color
            self.driver_name = data.stored_driver_name
            --minetest.debug("loaded: ", self.energy)
            local properties = self.object:get_properties()
            properties.infotext = data.stored_owner .. " nice helicopter"
            self.object:set_properties(properties)
        end

        helicopter.paint(self, self.color)
        local pos = self.object:get_pos()
	    local pointer=minetest.add_entity(pos,'helicopter:pointer')
        local energy_indicator_angle = ((self.energy * 18) - 90) * -1
	    pointer:set_attach(self.object,'',{x=0,y=11.26,z=9.37},{x=0,y=0,z=energy_indicator_angle})
	    self.pointer = pointer

        local pilot_seat_base=minetest.add_entity(pos,'helicopter:seat_base')
        pilot_seat_base:set_attach(self.object,'',{x=4.2,y=10,z=2},{x=0,y=0,z=0})
	    self.pilot_seat_base = pilot_seat_base

        local passenger_seat_base=minetest.add_entity(pos,'helicopter:seat_base')
        passenger_seat_base:set_attach(self.object,'',{x=-4.2,y=10,z=2},{x=0,y=0,z=0})
	    self.passenger_seat_base = passenger_seat_base

		-- set the animation once and later only change the speed
		self.object:set_animation({x = 0, y = 11}, 0, 0, true)

		self.object:set_armor_groups({immortal=1})

        local vector_up = vector.new(0, 1, 0)
		self.object:set_acceleration(vector.multiply(vector_up, -helicopter.gravity))
	end,

	on_step = function(self, dtime)
        helicopter.helicopter_last_time_command = helicopter.helicopter_last_time_command + dtime
        if helicopter.helicopter_last_time_command > 1 then helicopter.helicopter_last_time_command = 1 end
		local touching_ground, liquid_below

		local vel = self.object:get_velocity()

		touching_ground, liquid_below = helicopter.check_node_below(self.object)
		vel = helicopter.heli_control(self, dtime, touching_ground, liquid_below, vel) or vel

		if vel.x == 0 and vel.y == 0 and vel.z == 0 then
			return
		end

		if touching_ground == nil then
			touching_ground, liquid_below = helicopter.check_node_below(self.object)
		end

		-- quadratic and constant deceleration
		local speedsq = helicopter.vector_length_sq(vel)
		local fq, fc
		if touching_ground then
			fq, fc = helicopter.friction_land_quadratic, helicopter.friction_land_constant
		elseif liquid_below then
			fq, fc = helicopter.friction_water_quadratic, helicopter.friction_water_constant
		else
			fq, fc = helicopter.friction_air_quadratic, helicopter.friction_air_constant
		end
		vel = vector.apply(vel, function(a)
			local s = math.sign(a)
			a = math.abs(a)
			a = math.max(0, a - fq * dtime * speedsq - fc * dtime)
			return a * s
		end)

        --[[
            collision detection
            using velocity vector as virtually a point on space, we compare
            if last velocity has a great distance difference (virtually 5) from current velocity
            using some trigonometry (get_hipotenuse_value). If yes, we have an abrupt collision
        ]]--

        local is_attached = false
        if self.owner then
            local player = minetest.get_player_by_name(self.owner)

            if player then
                local player_attach = player:get_attach()
                if player_attach then
                    --XXXXXXXX
                    if player_attach == self.pilot_seat_base then is_attached = true end
                    --XXXXXXXX
                end
            end
        end

        if is_attached then
            local impact = helicopter.get_hipotenuse_value(vel, self.last_vel)
            if impact > 5 then
                --self.damage = self.damage + impact --sum the impact value directly to damage meter
                local curr_pos = self.object:get_pos()
                minetest.sound_play("collision", {
                    to_player = self.driver_name,
	                --pos = curr_pos,
	                --max_hear_distance = 5,
	                gain = 1.0,
                    fade = 0.0,
                    pitch = 1.0,
                })
                --[[if self.damage > 100 then --if acumulated damage is greater than 100, adieu
                    helicopter.destroy(self, player)
                end]]--
            end

            --update hud
            local player = minetest.get_player_by_name(self.driver_name)
            if helicopter.helicopter_last_time_command > 0.3 then
                helicopter.helicopter_last_time_command = 0
                update_heli_hud(player)
            end
        else
            -- for some error the player can be detached from the helicopter, so lets set him attached again
            local can_stop = true
            if self.owner and self.driver_name and touching_ground == false then
                -- attach the driver again
                local player = minetest.get_player_by_name(self.owner)
                if player then
                    helicopter.attach(self, player)
                    can_stop = false
                end
            end

            if can_stop then
                --detach player
                if self.sound_handle ~= nil then
	                minetest.sound_stop(self.sound_handle)
	                self.sound_handle = nil

                    --why its here? cause if the sound is attached, player must so
                    local player_owner = minetest.get_player_by_name(self.owner)
                    if player_owner then remove_heli_hud(player_owner) end
                end
            end
        end
        self.last_vel = vel --saves velocity for collision comparation
        -- end collision detection

		self.object:set_velocity(vel)
	end,

	on_punch = function(self, puncher, ttime, toolcaps, dir, damage)
		if not puncher or not puncher:is_player() then
			return
		end
		local name = puncher:get_player_name()
        if self.owner and self.owner ~= name and self.owner ~= "" then return end
        if self.owner == nil then
            self.owner = name
        end

        if self.driver_name and self.driver_name ~= name then
			-- do not allow other players to remove the object while there is a driver
			return
		end

        local touching_ground, liquid_below = helicopter.check_node_below(self.object)

        --XXXXXXXX
        local is_attached = false
        if puncher:get_attach() == self.pilot_seat_base then is_attached = true end
        --XXXXXXXX

        local itmstck=puncher:get_wielded_item()
        local item_name = ""
        if itmstck then item_name = itmstck:get_name() end

        if is_attached == false then
            if touching_ground then
                if helicopter.loadFuel(self, self.owner) then return end
            end
            -- deal with painting or destroying
		    if itmstck then
			    local _,indx = item_name:find('dye:')
			    if indx then

                    --lets paint!!!!
				    local color = item_name:sub(indx+1)
				    local colstr = helicopter.colors[color]
                    --minetest.chat_send_all(color ..' '.. dump(colstr))
				    if colstr then
                        helicopter.paint(self, colstr)
					    itmstck:set_count(itmstck:get_count()-1)
					    puncher:set_wielded_item(itmstck)
				    end
                    -- end painting

			    else -- deal damage
				    if not self.driver and toolcaps and toolcaps.damage_groups and toolcaps.damage_groups.fleshy then
					    --mobkit.hurt(self,toolcaps.damage_groups.fleshy - 1)
					    --mobkit.make_sound(self,'hit')
                        self.hp_max = self.hp_max - 10
                        minetest.sound_play("collision", {
	                        object = self.object,
	                        max_hear_distance = 5,
	                        gain = 1.0,
                            fade = 0.0,
                            pitch = 1.0,
                        })
				    end
			    end
            end

            if self.hp_max <= 0 then
                helicopter.destroy(self, puncher)
            end

        end

	end,

	on_rightclick = function(self, clicker)
		if not clicker or not clicker:is_player() then
			return
		end

		local name = clicker:get_player_name()

        if self.owner == "" then
            self.owner = name
        end

        if self.owner == name then
		    if name == self.driver_name then
			    -- driver clicked the object => driver gets off the vehicle
                helicopter.dettach(self, clicker)
                if self._passenger then
                    local passenger = minetest.get_player_by_name(self._passenger)
                    if passenger then
                        helicopter.dettach_pax(self, passenger)
                    end
                end
		    elseif not self.driver_name then
                local is_under_water = helicopter.check_is_under_water(self.object)
                if is_under_water then return end
                -- temporary------
                self.hp_max = 50 -- why? cause I can desist from destroy
                ------------------

                helicopter.attach(self, clicker)
		    end
        else
            --passenger section
            --only can enter when the pilot is inside
            if self.driver_name then
                if self._passenger == nil then
                    helicopter.attach_pax(self, clicker)
                else
                    helicopter.dettach_pax(self, clicker)
                end
            else
                if self._passenger then
                    helicopter.dettach_pax(self, clicker)
                end
            end
        end
	end,
})


code:
--
-- fuel
--
helicopter.fuel = {['oil:oil_bucket'] = 4}
helicopter.returns = "mesecraft_bucket:bucket_empty"

minetest.register_entity('helicopter:pointer',{
initial_properties = {
	physical = false,
	collide_with_objects=false,
	pointable=false,
	visual = "mesh",
	mesh = "pointer.b3d",
	textures = {"clay.png"},
	},

on_activate = function(self,std)
	self.sdata = minetest.deserialize(std) or {}
	if self.sdata.remove then self.object:remove() end
end,

get_staticdata=function(self)

  self.sdata.remove=true
  return minetest.serialize(self.sdata)
end,

})

function helicopter.get_gauge_angle(value)
    local angle = value * 18
    angle = angle - 90
    angle = angle * -1
	return angle
end

function helicopter.contains(table, val)
    for k,v in pairs(table) do
        if k == val then
            return v
        end
    end
    return false
end

function helicopter.loadFuel(self, player_name)
    local player = minetest.get_player_by_name(player_name)
    local inv = player:get_inventory()

    local itmstck=player:get_wielded_item()
    local item_name = ""
    if itmstck then item_name = itmstck:get_name() end

    local stack = nil
    local fuel = helicopter.contains(helicopter.fuel, item_name)
    if fuel then
        stack = ItemStack(item_name .. " 1")

        if self.energy < 10 then
            local taken = inv:remove_item("main", stack)
            if helicopter.returns then
                local ret_stack = ItemStack(helicopter.returns)
                if inv:room_for_item("main", ret_stack ) then
                    inv:add_item("main", ret_stack)
                else
                    minetest.add_item(player:get_pos(), ret_stack)
                end
            end
            self.energy = self.energy + fuel
            if self.energy > 10 then self.energy = 10 end

            local energy_indicator_angle = helicopter.get_gauge_angle(self.energy)
            self.pointer:set_attach(self.object,'',{x=0,y=11.26,z=9.37},{x=0,y=0,z=energy_indicator_angle})
        end

        return true
    end

    return false
end


code:
local heli_hud_list = {}

function update_heli_hud(player)
    --[[
    local player_name = player:get_player_name()

	hour = minetest.env:get_timeofday() * 24
	hour = math.ceil(hour)

    -- Get the dig and place count from storage, or default to 0
    local meta        = player:get_meta()
    local time_text   = "Time of day: " .. hour .. "h "
    local pos = player:get_pos()
    local altitude = math.ceil(pos.y)
    local altitude_text = "Altitude: " .. math.ceil(altitude)

    local ids = heli_hud_list[player_name]
    if ids then
        player:hud_change(ids["time"], "text", time_text)
        player:hud_change(ids["altitude"],   "text", altitude_text)
    else
        local screen_pos_y = -250
        local screen_pos_x = -100
        ids = {}
        ids["bg"] = player:hud_add({
            hud_elem_type = "image",
            position  = {x = 1, y = 0.5},
            offset    = {x = -240 + screen_pos_x, y = -10 + screen_pos_y},
            text      = "flight_info_bg.png",
            scale     = { x = 1, y = 1},
            alignment = { x = 1, y = 0 },
        })

        ids["title"] = player:hud_add({
            hud_elem_type = "text",
            position  = {x = 1, y = 0.5},
            offset    = {x = -120 + screen_pos_x, y = -25 + screen_pos_y},
            text      = "Flight Information",
            alignment = 0,
            scale     = { x = 100, y = 30},
            number    = 0xFFFFFF,
        })

        ids["time"] = player:hud_add({
            hud_elem_type = "text",
            position  = {x = 1, y = 0.5},
            offset    = {x = -180 + screen_pos_x, y = 0 + screen_pos_y},
            text      = time_text,
            alignment = -1,
            scale     = { x = 50, y = 10},
            number    = 0xFFFFFF,
        })

        ids["altitude"] = player:hud_add({
            hud_elem_type = "text",
            position  = {x = 1, y = 0.5},
            offset    = {x = -70 + screen_pos_x, y = 0 + screen_pos_y},
            text      = altitude_text,
            alignment = -1,
            scale     = { x = 50, y = 10},
            number    = 0xFFFFFF,
        })

        heli_hud_list[player_name] = ids
    end
    ]]--
end

function remove_heli_hud(player)
    --[[
    local player_name = player:get_player_name()
    local ids = heli_hud_list[player_name]
    player:hud_remove(ids["altitude"])
    player:hud_remove(ids["time"])
    player:hud_remove(ids["title"])
    player:hud_remove(ids["bg"])
    heli_hud_list[player_name] = nil
    ]]--
end


code:
helicopter.gravity = tonumber(minetest.settings:get("movement_gravity")) or 9.8
helicopter.vector_up = vector.new(0, 1, 0)

function helicopter.get_hipotenuse_value(point1, point2)
    return math.sqrt((point1.x - point2.x) ^ 2 + (point1.y - point2.y) ^ 2 + (point1.z - point2.z) ^ 2)
end

--painting
function helicopter.paint(self, colstr)
    if colstr then
        self.color = colstr
        local l_textures = self.initial_properties.textures
        for _, texture in ipairs(l_textures) do
            local i,indx = texture:find('helicopter_painting.png')
            if indx then
                l_textures[_] = "helicopter_painting.png^[multiply:".. colstr
            end
            local i,indx = texture:find('helicopter_colective.png')
            if indx then
                l_textures[_] = "helicopter_colective.png^[multiply:".. colstr
            end
        end
	    self.object:set_properties({textures=l_textures})
    end
end

function helicopter.setText(self)
    local properties = self.object:get_properties()
    local formatted = string.format(
       "%.2f", self.hp_max
    )
    if properties then
        properties.infotext = "Nice helicopter of " .. self.owner .. ". Current hp: " .. formatted
        self.object:set_properties(properties)
    end
end

-- attach player
function helicopter.attach(self, player)
    local name = player:get_player_name()
    self.driver_name = name

    -- sound and animation
    self.sound_handle = minetest.sound_play({name = "helicopter_motor"},
            {object = self.object, gain = 2.0, max_hear_distance = 32, loop = true,})
    self.object:set_animation_frame_speed(60)

    -- attach the driver
    player:set_attach(self.pilot_seat_base, "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
    player:set_eye_offset({x = 0, y = -4, z = 1}, {x = 0, y = 8, z = -30})
    player_api.player_attached[name] = true
    -- make the driver sit
    minetest.after(0.2, function()
        local player = minetest.get_player_by_name(name)
        if player then
	        player_api.set_animation(player, "sit")
            update_heli_hud(player)
        end
    end)
    -- disable gravity
    self.object:set_acceleration(vector.new())
end

-- dettach player
function helicopter.dettach(self, player)
    local name = self.driver_name
    helicopter.setText(self)

    -- driver clicked the object => driver gets off the vehicle
    self.driver_name = nil

    -- sound and animation
    if self.sound_handle then
        minetest.sound_stop(self.sound_handle)
        self.sound_handle = nil
    end

    self.object:set_animation_frame_speed(0)

    -- detach the player
    player:set_detach()
    player_api.player_attached[name] = nil
    player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
    player_api.set_animation(player, "stand")
    self.object:set_acceleration(vector.multiply(helicopter.vector_up, -helicopter.gravity))

    --remove hud
    if player then remove_heli_hud(player) end
end

-- attach passenger
function helicopter.attach_pax(self, player)
    local name = player:get_player_name()
    self._passenger = name
    -- attach the passenger
    player:set_attach(self.passenger_seat_base, "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
    player:set_eye_offset({x = 0, y = -4, z = 1}, {x = 0, y = 8, z = -5})
    player_api.player_attached[name] = true
    -- make the driver sit
    minetest.after(0.2, function()
        local player = minetest.get_player_by_name(name)
        if player then
            player_api.set_animation(player, "sit")
        end
    end)
end

-- dettach passenger
function helicopter.dettach_pax(self, player)
    local name = self._passenger

    -- passenger clicked the object => driver gets off the vehicle
    self._passenger = nil

    -- detach the player
    player:set_detach()
    player_api.player_attached[name] = nil
    player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
    player_api.set_animation(player, "stand")
end

-- destroy the helicopter
function helicopter.destroy(self, puncher)
    if self.sound_handle then
        minetest.sound_stop(self.sound_handle)
        self.sound_handle = nil
    end

    if self.driver_name then
        -- detach the driver first (puncher must be driver)
        puncher:set_detach()
        puncher:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
        player_api.player_attached[name] = nil
        -- player should stand again
        player_api.set_animation(puncher, "stand")
        self.driver_name = nil
    end

    local pos = self.object:get_pos()
    if self.pointer then self.pointer:remove() end
    if self.pilot_seat_base then self.pilot_seat_base:remove() end
    if self.passenger_seat_base then self.passenger_seat_base:remove() end

    self.object:remove()

    pos.y=pos.y+2
    for i=1,2 do
        if math.random(0,1) == 1 then
	        minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'basic_materials:gear_steel')
        end
    end

    for i=1,4 do
        if math.random(0,1) == 1 then
	        minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'basic_materials:steel_bar')
        end
    end

    for i=1,12 do
        if math.random(0,1) == 1 then
	        minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'default:steel_ingot')
        end
    end

    for i=1,6 do
        if math.random(0,1) == 1 then
	        minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'default:copper_ingot')
        end
    end

    for i=1,4 do
        if math.random(0,1) == 1 then
	        minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'basic_materials:plastic_sheet')
        end
    end

    for i=1,5 do
        if math.random(0,1) == 1 then
	        minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'default:wood')
        end
    end

    for i=1,1 do
        if math.random(0,1) == 1 then
	        minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'default:glass')
        end
    end

end


code:
--
-- constants
--

helicopter = {}

helicopter.friction_air_quadratic = 0.01
helicopter.friction_air_constant = 0.2
helicopter.friction_land_quadratic = 1
helicopter.friction_land_constant = 2
helicopter.friction_water_quadratic = 0.1
helicopter.friction_water_constant = 1

helicopter.colors ={
    black='#2b2b2b',
    blue='#0063b0',
    brown='#8c5922',
    cyan='#07B6BC',
    dark_green='#567a42',
    dark_grey='#6d6d6d',
    green='#4ee34c',
    grey='#9f9f9f',
    magenta='#ff0098',
    orange='#ff8b0e',
    pink='#ff62c6',
    red='#dc1818',
    violet='#a437ff',
    white='#FFFFFF',
    yellow='#ffe400',
}

--dofile(minetest.get_modpath(minetest.get_current_modname()) .. DIR_DELIM .. "heli_hud.lua")
dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "heli_hud.lua")
dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "heli_utilities.lua")
dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "heli_entities.lua")
dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "heli_crafts.lua")
dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "heli_control.lua")
dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "heli_fuel_management.lua")

helicopter.helicopter_last_time_command = 0

--
-- helpers and co.
--

if not minetest.global_exists("matrix3") then
	dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "matrix.lua")
end

local creative_exists = minetest.global_exists("creative")

function helicopter.check_is_under_water(obj)
	local pos_up = obj:get_pos()
	pos_up.y = pos_up.y + 0.1
	local node_up = minetest.get_node(pos_up).name
	local nodedef = minetest.registered_nodes[node_up]
	local liquid_up = nodedef.liquidtype ~= "none"
	return liquid_up
end


code:
-- everything in this file is licensed under CC0
-- see also minetest PR #8515

matrix3 = {}

function matrix3.new(a, ...)
	if not a then
		return {0, 0, 0, 0, 0, 0, 0, 0, 0}
	elseif type(a) ~= "table" then
		return {a, ...}
	else
		return {a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]}
	end
end

matrix3.identity = {1, 0, 0, 0, 1, 0, 0, 0, 1}

function matrix3.apply(m, func)
	local mr = {}
	for i = 1, 9 do
		mr[i] = func(m[i])
	end
	return mr
end

function matrix3.equals(m1, m2)
	for i = 1, 9 do
		if m1[i] ~= m2[i] then
			return false
		end
	end
	return true
end

function matrix3.index(m, l, c)
	return m[(l - 1) * 3 + c]
end

function matrix3.add(m1, m2)
	local m3 = {}
	for i = 1, 9 do
		m3[i] = m1[i] + m2[i]
	end
	return m3
end

local function multiply_matrix3_scalar(m, a)
	local mr = {}
	for i = 1, 9 do
		mr[i] = m[i] * a
	end
	return mr
end

local function multiply_matrix3_vector(m1, v)
	return {
		x = m1[1] * v.x + m1[2] * v.y + m1[3] * v.z,
		y = m1[4] * v.x + m1[5] * v.y + m1[6] * v.z,
		z = m1[7] * v.x + m1[8] * v.y + m1[9] * v.z,
	}
end

function matrix3.multiply(m1, m2)
	if type(m2) ~= "table" then
		return multiply_matrix3_scalar(m1, m2)
	elseif m2.x then
		return multiply_matrix3_vector(m1, m2)
	end
	local m3 = {}
	for l = 1, 3 do
		for c = 1, 3 do
			local i = (l - 1) * 3 + c
			m3[i] = 0
			for k = 1, 3 do
				m3[i] = m3[i] + m1[(l - 1) * 3 + k] * m2[(k - 1) * 3 + c]
			end
		end
	end
	return m3
end

function matrix3.tensor_multiply(a, b)
	local m1 = matrix3.new()
	m1[1] = a.x
	m1[4] = a.y
	m1[7] = a.z
	local m2 = matrix3.new()
	m2[1] = a.x
	m2[2] = a.y
	m2[3] = a.z
	return matrix3.multiply(m1, m2)
end

function matrix3.transpose(m)
	return {m[1], m[4], m[7],
	        m[2], m[5], m[8],
	        m[3], m[6], m[9]}
end

function matrix3.determinant(m)
	return m[1] * (m[5] * m[9] - m[6] * m[8])
	     + m[2] * (m[6] * m[7] - m[4] * m[9])
	     + m[3] * (m[4] * m[8] - m[5] * m[7])
end

function matrix3.invert(a)
	local t11 = a[5] * a[9] - a[6] * a[8]
	local t12 = a[6] * a[7] - a[4] * a[9]
	local t13 = a[4] * a[8] - a[5] * a[7]

	local det = a[1] * t11 + a[2] * t12 + a[3] * t13

	if det == 0 then
		return false -- there is no inverted
	end
	local b = {
		t11 / det, (a[3]*a[8] - a[2]*a[9]) / det, (a[2]*a[6] - a[3]*a[5]) / det,
		t12 / det, (a[1]*a[9] - a[3]*a[7]) / det, (a[3]*a[4] - a[1]*a[6]) / det,
		t13 / det, (a[2]*a[7] - a[1]*a[8]) / det, (a[1]*a[5] - a[2]*a[4]) / det
	}
	return b
end

local function sin(x)
	if x % math.pi == 0 then
		return 0
	else
		return math.sin(x)
	end
end

local function cos(x)
	if x % math.pi == math.pi / 2 then
		return 0
	else
		return math.cos(x)
	end
end

function matrix3.rotation_around_x(angle)
	local s = sin(angle)
	local c = cos(angle)
	return {1, 0,  0,
	        0, c, -s,
	        0, s,  c}
end

function matrix3.rotation_around_y(angle)
	local s = sin(angle)
	local c = cos(angle)
	return { c, 0, s,
	         0, 1, 0,
	        -s, 0, c}
end

function matrix3.rotation_around_z(angle)
	local s = sin(angle)
	local c = cos(angle)
	return {c, -s, 0,
	        s,  c, 0,
	        0,  0, 1}
end

function matrix3.rotation_around_vector(v, angle)
	local length_v = vector.length(v)
	v = vector.divide(v, length_v)
	angle = angle or length_v

	local s = sin(angle)
	local c = cos(angle)
	local omc = 1 - c
	return {
		v.x * v.x * omc + c,       v.x * v.y * omc - v.z * s, v.x * v.z * omc + v.y * s,
		v.y * v.x * omc + v.z * s, v.y * v.y * omc + c,       v.y * v.z * omc - v.x * s,
		v.z * v.x * omc - v.y * s, v.z * v.y * omc + v.x * s, v.z * v.z * omc + c
	}
end

function matrix3.to_pitch_yaw_roll(m)
	local r = vector.new()
	r.y = math.atan2(-m[3], m[9])
	local c2 = math.sqrt(m[4]^2 + m[5]^2)
	r.x = math.atan2(m[6], c2)
	local s1 = sin(r.y)
	local c1 = cos(r.y)
	r.z = math.atan2(s1 * m[8] + c1 * m[2], s1 * m[7] + c1 * m[1])
	return r
end

function matrix3.from_pitch_yaw_roll(v)
	local sx, cx = sin(v.x), cos(v.x)
	local sy, cy = sin(v.y), cos(v.y)
	local sz, cz = sin(v.z), cos(v.z)
	return {
		-sy * sx * sz + cy * cz, cz * sy * sx + cy * sz,  -cx * sy,
		-cx * sz,                cx * cz,                 sx,
		cy * sx * sz + cz * sy,  -cy * cz * sx + sy * sz, cy * cx
	}
end


code:
name = helicopter
depends = player_api, oil
optional_depends = default, creative
description = It adds an expensive helicopter with power consumption. It uses oil to fly. With oil buckets on your inventory, you can recharge your helicopter attaching himself into it (with right click on seat) and punching the seat after. It does not refuel on flying, only when landed. The power consumption increases as high you climb, so, stay below the flight level 100.
title = Not So Simple Helicopter


code:
EUROPEAN UNION PUBLIC LICENCE v. 1.2
EUPL © the European Union 2007, 2016

This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined below) which is provided under the
terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such
use is covered by a right of the copyright holder of the Work).
The Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following
notice immediately following the copyright notice for the Work:
                          Licensed under the EUPL
or has expressed by any other means his willingness to license under the EUPL.

1.Definitions
In this Licence, the following terms have the following meaning:
— ‘The Licence’:this Licence.
— ‘The Original Work’:the work or software distributed or communicated by the Licensor under this Licence, available
as Source Code and also as Executable Code as the case may be.
— ‘Derivative Works’:the works or software that could be created by the Licensee, based upon the Original Work or
modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work
required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in
the country mentioned in Article 15.
— ‘The Work’:the Original Work or its Derivative Works.
— ‘The Source Code’:the human-readable form of the Work which is the most convenient for people to study and
modify.
— ‘The Executable Code’:any code which has generally been compiled and which is meant to be interpreted by
a computer as a program.
— ‘The Licensor’:the natural or legal person that distributes or communicates the Work under the Licence.
— ‘Contributor(s)’:any natural or legal person who modifies the Work under the Licence, or otherwise contributes to
the creation of a Derivative Work.
— ‘The Licensee’ or ‘You’:any natural or legal person who makes any usage of the Work under the terms of the
Licence.
— ‘Distribution’ or ‘Communication’:any act of selling, giving, lending, renting, distributing, communicating,
transmitting, or otherwise making available, online or offline, copies of the Work or providing access to its essential
functionalities at the disposal of any other natural or legal person.

2.Scope of the rights granted by the Licence
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive, sublicensable licence to do the following, for
the duration of copyright vested in the Original Work:
— use the Work in any circumstance and for all usage,
— reproduce the Work,
— modify the Work, and make Derivative Works based upon the Work,
— communicate to the public, including the right to make available or display the Work or copies thereof to the public
and perform publicly, as the case may be, the Work,
— distribute the Work or copies thereof,
— lend and rent the Work or copies thereof,
— sublicense rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the
applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed
by law in order to make effective the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to any patents held by the Licensor, to the
extent necessary to make use of the rights granted on the Work under this Licence.

3.Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as
Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with
each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to
the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to
distribute or communicate the Work.

4.Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the
exclusive rights of the rights owners in the Work, of the exhaustion of those rights or of other applicable limitations
thereto.

5.Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those
obligations are the following:

Attribution right: The Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to
the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the
Licence with every copy of the Work he/she distributes or communicates. The Licensee must cause any Derivative Work
to carry prominent notices stating that the Work has been modified and the date of modification.

Copyleft clause: If the Licensee distributes or communicates copies of the Original Works or Derivative Works, this
Distribution or Communication will be done under the terms of this Licence or of a later version of this Licence unless
the Original Work is expressly distributed only under this version of the Licence — for example by communicating
‘EUPL v. 1.2 only’. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the
Work or Derivative Work that alter or restrict the terms of the Licence.

Compatibility clause: If the Licensee Distributes or Communicates Derivative Works or copies thereof based upon both
the Work and another work licensed under a Compatible Licence, this Distribution or Communication can be done
under the terms of this Compatible Licence. For the sake of this clause, ‘Compatible Licence’ refers to the licences listed
in the appendix attached to this Licence. Should the Licensee's obligations under the Compatible Licence conflict with
his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail.

Provision of Source Code: When distributing or communicating copies of the Work, the Licensee will provide
a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available
for as long as the Licensee continues to distribute or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names, trademarks, service marks, or names
of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.

6.Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or
licensed to him/her and that he/she has the power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or
licensed to him/her and that he/she has the power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions
to the Work, under the terms of this Licence.

7.Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous Contributors. It is not a finished work
and may therefore contain defects or ‘bugs’ inherent to this type of development.
For the above reason, the Work is provided under the Licence on an ‘as is’ basis and without warranties of any kind
concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or
errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this
Licence.
This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work.

8.Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be
liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the
Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss
of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However,
the Licensor will be liable under statutory product liability laws as far such laws apply to the Work.

9.Additional agreements
While distributing the Work, You may choose to conclude an additional agreement, defining obligations or services
consistent with this Licence. However, if accepting obligations, You may act only on your own behalf and on your sole
responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by
the fact You have accepted any warranty or additional liability.

10.Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon ‘I agree’ placed under the bottom of a window
displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms
and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You
by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution
or Communication by You of the Work or copies thereof.

11.Information to the public
In case of any Distribution or Communication of the Work by means of electronic communication by You (for example,
by offering to download the Work from a remote location) the distribution channel or media (for example, a website)
must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence
and the way it may be accessible, concluded, stored and reproduced by the Licensee.

12.Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms
of the Licence.
Such a termination will not terminate the licences of any person who has received the Work from the Licensee under
the Licence, provided such persons remain in full compliance with the Licence.

13.Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the
Work.
If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or
enforceability of the Licence as a whole. Such provision will be construed or reformed so as necessary to make it valid
and enforceable.
The European Commission may publish other linguistic versions or new versions of this Licence or updated versions of
the Appendix, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence.
New versions of the Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take
advantage of the linguistic version of their choice.

14.Jurisdiction
Without prejudice to specific agreement between parties,
— any litigation resulting from the interpretation of this License, arising between the European Union institutions,
bodies, offices or agencies, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice
of the European Union, as laid down in article 272 of the Treaty on the Functioning of the European Union,
— any litigation arising between other parties and resulting from the interpretation of this License, will be subject to
the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business.

15.Applicable Law
Without prejudice to specific agreement between parties,
— this Licence shall be governed by the law of the European Union Member State where the Licensor has his seat,
resides or has his registered office,
— this licence shall be governed by Belgian law if the Licensor has no seat, residence or registered office inside
a European Union Member State.

                                                         Appendix

‘Compatible Licences’ according to Article 5 EUPL are:
— GNU General Public License (GPL) v. 2, v. 3
— GNU Affero General Public License (AGPL) v. 3
— Open Software License (OSL) v. 2.1, v. 3.0
— Eclipse Public License (EPL) v. 1.0
— CeCILL v. 2.0, v. 2.1
— Mozilla Public Licence (MPL) v. 2
— GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
— Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for works other than software
— European Union Public Licence (EUPL) v. 1.1, v. 1.2
— Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong Reciprocity (LiLiQ-R+)

The European Commission may update this Appendix to later versions of the above licences without producing
a new version of the EUPL, as long as they provide the rights granted in Article 2 of this Licence and protect the
covered Source Code from exclusive appropriation.
All other changes or additions to this Appendix require the production of a new EUPL version.


code:
### HIDDEN DOORS
![Hidden Doors' screenshot](screenshot.png)
**_Adds various wood, stone, etc. doors._**

**Version:** 1.12.0
**Source code's license:** [EUPL v1.2][1] or later.
**Media (Textures, Sounds) license:** [CC BY-SA 4.0 International][2] or later.

**Dependencies:** default, doors, stairs, vessels (found in [Minetest Game][3])
**Supported:** [Darkage (Addi's fork)][4], [Moreblocks][5]

__Advanced settings:__
Settings -> All settings -> Mods -> hidden_doors

Allows to use painted doors
Allows self-removal to prevent unknown nodes after the mod's deinstallation.

### Installation

Unzip the archive, rename the folder to hidden_doors and place it in
../minetest/mods/

If you only want this to be used in a single world, place it in
../minetest/worlds/WORLD_NAME/worldmods/

GNU+Linux - If you use a system-wide installation place it in
~/.minetest/mods/

For further information or help see:
https://wiki.minetest.net/Help:Installing_Mods

[1]: https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
[2]: https://creativecommons.org/licenses/by-sa/4.0/
[3]: https://github.com/minetest/minetest_game
[4]: https://forum.minetest.net/viewtopic.php?f=11&t=3213&start=125#p253141
[5]: https://forum.minetest.net/viewtopic.php?t=509


code:
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

	- No other feature planned.

## [1.12.0] - 2019-11-13
## Added

	- Permafrost hidden door (if permafrost node available).
	- Support for Minetest engine v5.x translator.

## Changed

	- License changed to EUPL v1.2.
	- Code style and formatting refresh.
	- Textures have been optimized using optipng.

## [1.11] - 2018-09-12
### Added

	Painted doors, thanks to Treer

## [1.10.2] - 2018-07-12
### Added

	screenshot.png

### Changed

	Default options' values are no longer written on minetest.conf.
	Minor code changes.
	changelog.txt -> changelog.md
	README.txt -> README.md

## [1.10.1]
### Changed
	Code fix due to changed or removed Moreblocks nodes.

## [1.10.0]
### Added

	Added self removing option.
	Settings/Advanced Settings/Mods/hidden_doors

## [1.9.0]
### Added

	Added sand, silver sand and desert sand doors.

## [1.8.0]
### Added

	Added support for the Moreblocks module.
	Added bookshelf door from Minetest Game (vessels dependency).

### Changed

	Moved the doors registrations into subfiles named after their
	respective modules (e.g. darkage.lua); for an easier maintenance.

## [1.7.2]
### Changed

	Removed goto statement, changed the code to accomplish the same
	task without it.

## [1.7.1]
### Changed

	Disabled textures' scaling for Darkage: when using texture packs
	having a resolution higher than 16px, Darkage's textures will be
	kept at their native resolution.

## [1.7.0]
### Added

	Added support for the Darkage module (Addi's fork).

## [1.6.0]
### Added

	Texture resolution configurable via GUI under Advanced Settings.
	Stone doors' sound volume as above.
	Hardcoded check for invalid resolutions.
	Hidden doors made of ice.
	Locale template updated.
	Italian locale updated.

## [1.5.2]
### Changed

	Minor fix - Stone doors' sound increased.

## [1.5.1]
### Changed

	Bugfix - Textures applied correctly to doors, inventory images are generated
	as they should. Napiophelios

## [1.5.0]
### Added

	New hidden doors: dirt, brick, metals, gems.

## [1.4.0]
### Changed

	Texture combiner's code changed to be more easier to understand and mantain.
	Optional support for resolutions higher than 16px using
	hidden_doors_res = <number> into minetest.conf; defaults to 16.
	Supported resolutions: 16, 32, 64, 128, 256, 512

## [1.3.0]
### Added

	Added the opening and closing sounds for the stone doors.

### Changed

	Changed the module's description.
	Code re-formatted to fit into 80 columns.
	Recipes changed to prevent any conflict.

## [1.2.0]
### Added

	Added localization support: intllib by Diego Martínez (kaeza)
	Added the Italian locale file.

### Changed

	Updated the function to handle sound's specification to allow different
	sounds for different materials doors.

## [1.1.0]
### Added

	Napiophelios added texture handling and the function to dynamically
	register the doors.
	Hamlet added the new doors.

## [1.0.0]
### Added

	Initial stable release.
	Cobble, stone and stone brick's doors available.


code:
--[[
	Hidden Doors - Adds various wood, stone, etc. doors.
	Copyright © 2017, 2019 Hamlet <hamlatmesehub@riseup.net> and contributors.

	Licensed under the EUPL, Version 1.2 or – as soon they will be
	approved by the European Commission – subsequent versions of the
	EUPL (the "Licence");
	You may not use this work except in compliance with the Licence.
	You may obtain a copy of the Licence at:

	https://joinup.ec.europa.eu/software/page/eupl
	https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863

	Unless required by applicable law or agreed to in writing,
	software distributed under the Licence is distributed on an
	"AS IS" basis,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
	implied.
	See the Licence for the specific language governing permissions
	and limitations under the Licence.

--]]

--
-- Variables
--

-- Used for localization, choose either built-in or intllib.

local s_ModPath, S, NS = nil

if (minetest.get_modpath("intllib") == nil) then
	S = minetest.get_translator("hidden_doors")

else
	-- internationalization boilerplate
	s_ModPath = minetest.get_modpath(minetest.get_current_modname())
	S, NS = dofile(s_ModPath.."/intllib.lua")

end

--
-- Darkage module support
--

hidden_doors.RegisterHiddenDoors("darkage", "adobe", s_RecipeItem1,
	"darkage:adobe", nil, S("Adobe"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "basalt", s_RecipeItem1,
	"stairs:slab_darkage_basalt", "stairs:slab_darkage_basalt", S("Basalt"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "basalt_rubble", s_RecipeItem1,
	"stairs:slab_darkage_basalt_rubble", "stairs:slab_darkage_basalt_rubble",
	S("Basalt Rubble"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "basalt_brick", s_RecipeItem1,
	"stairs:slab_darkage_basalt_brick", "stairs:slab_darkage_basalt_brick",
	S("Basalt Brick"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "basalt_block", s_RecipeItem1,
	"darkage:basalt_block", nil, S("Basalt Block"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "gneiss", s_RecipeItem1,
	"stairs:slab_darkage_gneiss", "stairs:slab_darkage_gneiss",
	S("Gneiss"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "gneiss_rubble", s_RecipeItem1,
	"stairs:slab_darkage_gneiss_rubble", "stairs:slab_darkage_gneiss_rubble",
	S("Gneiss Rubble"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "gneiss_brick", s_RecipeItem1,
	"stairs:slab_darkage_gneiss_brick", "stairs:slab_darkage_gneiss_brick",
	S("Gneiss Brick"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "gneiss_block", s_RecipeItem1,
	"darkage:gneiss_block", nil, S("Gneiss Block"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "marble", s_RecipeItem1,
	"stairs:slab_darkage_marble", "stairs:slab_darkage_marble",
	S("Marble"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "marble_tile", s_RecipeItem1,
	"stairs:slab_darkage_marble_tile", "stairs:slab_darkage_marble_tile",
	S("Marble Tile"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "ors", s_RecipeItem1,
	"stairs:slab_darkage_ors", "stairs:slab_darkage_ors",
	S("Old Red Sandstone"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "ors_rubble", s_RecipeItem1,
	"stairs:slab_darkage_ors_rubble", "stairs:slab_darkage_ors_rubble",
	S("Old Red Sandstone Rubble"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "ors_brick", s_RecipeItem1,
	"stairs:slab_darkage_ors_brick", "stairs:slab_darkage_ors_brick",
	S("Old Red Sandstone Brick"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "ors_block", s_RecipeItem1,
	"darkage:ors_block", nil, S("Old Red Sandstone Block"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "serpentine", s_RecipeItem1,
	"stairs:slab_darkage_serpentine", "stairs:slab_darkage_serpentine",
	S("Serpentine"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "shale", s_RecipeItem1,
	"stairs:slab_darkage_shale", "stairs:slab_darkage_shale",
	S("Shale"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "schist", s_RecipeItem1,
	"stairs:slab_darkage_schist", "stairs:slab_darkage_schist",
	S("Schist"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "slate", s_RecipeItem1,
	"stairs:slab_darkage_slate", "stairs:slab_darkage_slate",
	S("Slate"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "slate_rubble", s_RecipeItem1,
	"stairs:slab_darkage_slate_rubble", "stairs:slab_darkage_slate_rubble",
	S("Slate Rubble"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "slate_tile", s_RecipeItem1,
	"stairs:slab_darkage_slate_tile", "stairs:slab_darkage_slate_tile",
	S("Slate Tile"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "slate_block", s_RecipeItem1,
	"darkage:slate_block", nil, S("Slate Block"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "slate_brick", s_RecipeItem1,
	"stairs:slab_darkage_slate_brick", "stairs:slab_darkage_slate_brick",
	S("Slate Brick"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "tuff", s_RecipeItem1,
	"stairs:slab_darkage_tuff", "stairs:slab_darkage_tuff",
	S("Tuff"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "tuff_bricks", s_RecipeItem1,
	"stairs:slab_darkage_tuff_bricks", "stairs:slab_darkage_tuff_bricks",
	S("Tuff Bricks"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "tuff_rubble", s_RecipeItem1,
	"darkage:tuff_rubble", nil, S("Tuff Rubble"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "rhyolitic_tuff", s_RecipeItem1,
	"stairs:slab_darkage_rhyolitic_tuff",
	"stairs:slab_darkage_rhyolitic_tuff",
	S("Rhyolitic Tuff"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "rhyolitic_tuff_bricks",
	s_RecipeItem1,
	"stairs:slab_darkage_rhyolitic_tuff_bricks",
	"stairs:slab_darkage_rhyolitic_tuff_bricks",
	S("Rhyolitic Tuff Bricks"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "old_tuff_bricks",
	s_RecipeItem1,
	"stairs:slab_darkage_old_tuff_bricks",
	"stairs:slab_darkage_old_tuff_bricks",
	S("Old Tuff Bricks"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("darkage", "rhyolitic_tuff_rubble",
	s_RecipeItem1, "darkage:rhyolitic_tuff_rubble", nil,
	S("Rhyolitic Tuff Rubble"), t_StoneDefault, t_StoneOpen, t_StoneClose)


code:
default
doors
stairs
vessels
intllib?
darkage?
moreblocks?


code: Adds various wood, stone, etc. doors.


code:
--[[
	Hidden Doors - Adds various wood, stone, etc. doors.
	Copyright © 2017, 2019 Hamlet <hamlatmesehub@riseup.net> and contributors.

	Licensed under the EUPL, Version 1.2 or – as soon they will be
	approved by the European Commission – subsequent versions of the
	EUPL (the "Licence");
	You may not use this work except in compliance with the Licence.
	You may obtain a copy of the Licence at:

	https://joinup.ec.europa.eu/software/page/eupl
	https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863

	Unless required by applicable law or agreed to in writing,
	software distributed under the Licence is distributed on an
	"AS IS" basis,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
	implied.
	See the Licence for the specific language governing permissions
	and limitations under the Licence.

--]]

--
-- General variables
--

local s_ModPath = minetest.get_modpath("hidden_doors")

-- Hidden Doors' operation mode
local b_HiddenDoorsRemover = minetest.settings:get_bool("b_HiddenDoorsRemover")

if (b_HiddenDoorsRemover == nil) then
	b_HiddenDoorsRemover = false
end

if (b_HiddenDoorsRemover == false) then
	dofile(s_ModPath .. "/main.lua")

else
	dofile(s_ModPath .. "/remover.lua")

end

--
-- Minetest engine debug logging
--

local s_LogLevel = minetest.settings:get("debug_log_level")

if (s_LogLevel == nil)
or (s_LogLevel == "action")
or (s_LogLevel == "info")
or (s_LogLevel == "verbose")
then
	s_LogLevel = nil
end


code:
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.

-- Get the latest version of this file at:
--   https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua

local function format(str, ...)
	local args = { ... }
	local function repl(escape, open, num, close)
		if escape == "" then
			local replacement = tostring(args[tonumber(num)])
			if open == "" then
				replacement = replacement..close
			end
			return replacement
		else
			return "@"..open..num..close
		end
	end
	return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end

local gettext, ngettext
if minetest.get_modpath("intllib") then
	if intllib.make_gettext_pair then
		-- New method using gettext.
		gettext, ngettext = intllib.make_gettext_pair()
	else
		-- Old method using text files.
		gettext = intllib.Getter()
	end
end

-- Fill in missing functions.

gettext = gettext or function(msgid, ...)
	return format(msgid, ...)
end

ngettext = ngettext or function(msgid, msgid_plural, n, ...)
	return format(n==1 and msgid or msgid_plural, ...)
end

return gettext, ngettext


code:
# textdomain:hidden_doors

Concealed =porta camuffata di
 Door=
Painted =porta dipinta di
Stone=pietra
Cobble=ciottoli
Stone Brick=mattone di pietra
Stone Block=blocco di pietra
Mossy Cobble=ciottoli muschiosi
Desert Stone=pietra del deserto
Desert Cobble=ciottoli del deserto
Desert Stone Brick=mattone di pietra del deserto
Desert Stone Block=blocco di pietra del deserto
Sandstone=arenaria
Sandstone Brick=mattone d'arenaria
Sandstone Block=blocco d'arenaria
Desert Sandstone=arenaria del deserto
Desert Sandstone Brick=mattone d'arenaria del deserto
Desert Sandstone Block=blocco d'arenaria del deserto
Silver Sandstone=arenaria argentata
Silver Sandstone Brick=mattone d'arenaria argentata
Silver Sandstone Block=blocco d'arenaria argentata
Obsidian=ossidiana
Obsidian Brick=mattone d'ossidiana
Obsidian Block=blocco d'ossidiana
Tree=albero
Jungle Tree=albero della giungla
Pine Tree=pino
Acacia Tree=acacia
Aspen Tree=pioppo
Wood=legno
Jungle Wood=legno della giungla
Pine Wood=legno di pino
Acacia Wood=legno d'acacia
Aspen Wood=legno di pioppo
Bronze Block=blocco di bronzo
Copper Block=blocco di rame
Gold Block=blocco d'oro
Steel Block=blocco d'acciaio
Tin Block=blocco di stagno
Dirt=terra
Brick=mattone
Ice=ghiaccio
Diamond Block=blocco di diamante
Mese Block=blocco di mese
Bookshelf=scaffale
Sand=sabbia
Silver Sand=sabbia argentata
Desert Sand=sabbia del deserto
All-faces Jungle Tree=cuore di albero della giungla
All-faces Tree=cuore di albero
Cactus Brick=mattone di cactus
Circle Stone Bricks=mattone di pietra a cerchio concentrico
Coal Stone=pietra carbone
Cobble Compressed=ciottoli compressi
Copper Patina=patina di rame
Empty Shelf=scaffale vuoto
Stone Bricks=mattone di pietra
Iron Stone=pietra ferro
Iron Stone Bricks=mattone di pietra ferro
Plankstone=pietra e assi
Split Stone Tile=mattonella di pietra divisa
Stone Tile=mattonella di pietra
Tar=catrame
Full Wooden Tile=mattonella di legno pieno
Permafrost=permafrost


code:
# ITALIAN LOCALE FILE FOR THE HIDDEN DOORS MODULE.
# Copyright (C) 2017 H4mlet <h4mlet@riseup.net>
# This file is distributed under the same license as the HIDDEN DOORS package.
# H4mlet <h4mlet@riseup.net>, 2017
#
msgid ""
msgstr ""
"Project-Id-Version: Hidden Doors module's Italian locale\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-12 14:18+0200\n"
"PO-Revision-Date: 2018-09-12 14:20+0100\n"
"Last-Translator: Hamlet\n"
"Language-Team: \n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.6.10\n"

#: main.lua
msgid "Concealed "
msgstr "porta camuffata di "

#: main.lua
msgid " Door"
msgstr " "

#: main.lua
msgid "Painted "
msgstr "porta dipinta di "

#: minetest_game.lua
msgid "Stone"
msgstr "pietra"

#: minetest_game.lua
msgid "Cobble"
msgstr "ciottoli"

#: minetest_game.lua
msgid "Stone Brick"
msgstr "mattone di pietra"

#: minetest_game.lua
msgid "Stone Block"
msgstr "blocco di pietra"

#: minetest_game.lua
msgid "Mossy Cobble"
msgstr "ciottoli muschiosi"

#: minetest_game.lua
msgid "Desert Stone"
msgstr "pietra del deserto"

#: minetest_game.lua
msgid "Desert Cobble"
msgstr "ciottoli del deserto"

#: minetest_game.lua
msgid "Desert Stone Brick"
msgstr "mattone di pietra del deserto"

#: minetest_game.lua
msgid "Desert Stone Block"
msgstr "blocco di pietra del deserto"

#: minetest_game.lua
msgid "Sandstone"
msgstr "arenaria"

#: minetest_game.lua
msgid "Sandstone Brick"
msgstr "mattone d'arenaria"

#: minetest_game.lua
msgid "Sandstone Block"
msgstr "blocco d'arenaria"

#: minetest_game.lua
msgid "Desert Sandstone"
msgstr "arenaria del deserto"

#: minetest_game.lua
msgid "Desert Sandstone Brick"
msgstr "mattone d'arenaria del deserto"

#: minetest_game.lua
msgid "Desert Sandstone Block"
msgstr "blocco d'arenaria del deserto"

#: minetest_game.lua
msgid "Silver Sandstone"
msgstr "arenaria argentata"

#: minetest_game.lua
msgid "Silver Sandstone Brick"
msgstr "mattone d'arenaria argentata"

#: minetest_game.lua
msgid "Silver Sandstone Block"
msgstr "blocco d'arenaria argentata"

#: minetest_game.lua
msgid "Obsidian"
msgstr "ossidiana"

#: minetest_game.lua
msgid "Obsidian Brick"
msgstr "mattone d'ossidiana"

#: minetest_game.lua
msgid "Obsidian Block"
msgstr "blocco d'ossidiana"

#: minetest_game.lua
msgid "Tree"
msgstr "albero"

#: minetest_game.lua
msgid "Jungle Tree"
msgstr "albero della giungla"

#: minetest_game.lua
msgid "Pine Tree"
msgstr "pino"

#: minetest_game.lua
msgid "Acacia Tree"
msgstr "acacia"

#: minetest_game.lua
msgid "Aspen Tree"
msgstr "pioppo"

#: minetest_game.lua
msgid "Wood"
msgstr "legno"

#: minetest_game.lua
msgid "Jungle Wood"
msgstr "legno della giungla"

#: minetest_game.lua
msgid "Pine Wood"
msgstr "legno di pino"

#: minetest_game.lua
msgid "Acacia Wood"
msgstr "legno d'acacia"

#: minetest_game.lua
msgid "Aspen Wood"
msgstr "legno di pioppo"

#: minetest_game.lua
msgid "Bronze Block"
msgstr "blocco di bronzo"

#: minetest_game.lua
msgid "Copper Block"
msgstr "blocco di rame"

#: minetest_game.lua
msgid "Gold Block"
msgstr "blocco d'oro"

#: minetest_game.lua
msgid "Steel Block"
msgstr "blocco d'acciaio"

#: minetest_game.lua
msgid "Tin Block"
msgstr "blocco di stagno"

#: minetest_game.lua
msgid "Dirt"
msgstr "terra"

#: minetest_game.lua
msgid "Brick"
msgstr "mattone"

#: minetest_game.lua
msgid "Ice"
msgstr "ghiaccio"

#: minetest_game.lua
msgid "Diamond Block"
msgstr "blocco di diamante"

#: minetest_game.lua
msgid "Mese Block"
msgstr "blocco di mese"

#: minetest_game.lua
msgid "Bookshelf"
msgstr "scaffale"

#: minetest_game.lua
msgid "Sand"
msgstr "sabbia"

#: minetest_game.lua
msgid "Silver Sand"
msgstr "sabbia argentata"

#: minetest_game.lua
msgid "Desert Sand"
msgstr "sabbia del deserto"

#: moreblocks.lua
msgid "All-faces Jungle Tree"
msgstr "cuore di albero della giungla"

#: moreblocks.lua
msgid "All-faces Tree"
msgstr "cuore di albero"

#: moreblocks.lua
msgid "Cactus Brick"
msgstr "mattone di cactus"

#: moreblocks.lua
msgid "Circle Stone Bricks"
msgstr "mattone di pietra a cerchio concentrico"

#: moreblocks.lua
msgid "Coal Stone"
msgstr "pietra carbone"

#: moreblocks.lua
msgid "Cobble Compressed"
msgstr "ciottoli compressi"

#: moreblocks.lua
msgid "Copper Patina"
msgstr "patina di rame"

#: moreblocks.lua
msgid "Empty Shelf"
msgstr "scaffale vuoto"

#: moreblocks.lua
msgid "Stone Bricks"
msgstr "mattone di pietra"

#: moreblocks.lua
msgid "Iron Stone"
msgstr "pietra ferro"

#: moreblocks.lua
msgid "Iron Stone Bricks"
msgstr "mattone di pietra ferro"

#: moreblocks.lua
msgid "Plankstone"
msgstr "pietra e assi"

#: moreblocks.lua
msgid "Split Stone Tile"
msgstr "mattonella di pietra divisa"

#: moreblocks.lua
msgid "Stone Tile"
msgstr "mattonella di pietra"

#: moreblocks.lua
msgid "Tar"
msgstr "catrame"

#: moreblocks.lua
msgid "Full Wooden Tile"
msgstr "mattonella di legno pieno"


code:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-12 14:18+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: main.lua
msgid "Concealed "
msgstr ""

#: main.lua
msgid " Door"
msgstr ""

#: main.lua
msgid "Painted "
msgstr ""

#: minetest_game.lua
msgid "Stone"
msgstr ""

#: minetest_game.lua
msgid "Cobble"
msgstr ""

#: minetest_game.lua
msgid "Stone Brick"
msgstr ""

#: minetest_game.lua
msgid "Stone Block"
msgstr ""

#: minetest_game.lua
msgid "Mossy Cobble"
msgstr ""

#: minetest_game.lua
msgid "Desert Stone"
msgstr ""

#: minetest_game.lua
msgid "Desert Cobble"
msgstr ""

#: minetest_game.lua
msgid "Desert Stone Brick"
msgstr ""

#: minetest_game.lua
msgid "Desert Stone Block"
msgstr ""

#: minetest_game.lua
msgid "Sandstone"
msgstr ""

#: minetest_game.lua
msgid "Sandstone Brick"
msgstr ""

#: minetest_game.lua
msgid "Sandstone Block"
msgstr ""

#: minetest_game.lua
msgid "Desert Sandstone"
msgstr ""

#: minetest_game.lua
msgid "Desert Sandstone Brick"
msgstr ""

#: minetest_game.lua
msgid "Desert Sandstone Block"
msgstr ""

#: minetest_game.lua
msgid "Silver Sandstone"
msgstr ""

#: minetest_game.lua
msgid "Silver Sandstone Brick"
msgstr ""

#: minetest_game.lua
msgid "Silver Sandstone Block"
msgstr ""

#: minetest_game.lua
msgid "Obsidian"
msgstr ""

#: minetest_game.lua
msgid "Obsidian Brick"
msgstr ""

#: minetest_game.lua
msgid "Obsidian Block"
msgstr ""

#: minetest_game.lua
msgid "Tree"
msgstr ""

#: minetest_game.lua
msgid "Jungle Tree"
msgstr ""

#: minetest_game.lua
msgid "Pine Tree"
msgstr ""

#: minetest_game.lua
msgid "Acacia Tree"
msgstr ""

#: minetest_game.lua
msgid "Aspen Tree"
msgstr ""

#: minetest_game.lua
msgid "Wood"
msgstr ""

#: minetest_game.lua
msgid "Jungle Wood"
msgstr ""

#: minetest_game.lua
msgid "Pine Wood"
msgstr ""

#: minetest_game.lua
msgid "Acacia Wood"
msgstr ""

#: minetest_game.lua
msgid "Aspen Wood"
msgstr ""

#: minetest_game.lua
msgid "Bronze Block"
msgstr ""

#: minetest_game.lua
msgid "Copper Block"
msgstr ""

#: minetest_game.lua
msgid "Gold Block"
msgstr ""

#: minetest_game.lua
msgid "Steel Block"
msgstr ""

#: minetest_game.lua
msgid "Tin Block"
msgstr ""

#: minetest_game.lua
msgid "Dirt"
msgstr ""

#: minetest_game.lua
msgid "Brick"
msgstr ""

#: minetest_game.lua
msgid "Ice"
msgstr ""

#: minetest_game.lua
msgid "Diamond Block"
msgstr ""

#: minetest_game.lua
msgid "Mese Block"
msgstr ""

#: minetest_game.lua
msgid "Bookshelf"
msgstr ""

#: minetest_game.lua
msgid "Sand"
msgstr ""

#: minetest_game.lua
msgid "Silver Sand"
msgstr ""

#: minetest_game.lua
msgid "Desert Sand"
msgstr ""

#: moreblocks.lua
msgid "All-faces Jungle Tree"
msgstr ""

#: moreblocks.lua
msgid "All-faces Tree"
msgstr ""

#: moreblocks.lua
msgid "Cactus Brick"
msgstr ""

#: moreblocks.lua
msgid "Circle Stone Bricks"
msgstr ""

#: moreblocks.lua
msgid "Coal Stone"
msgstr ""

#: moreblocks.lua
msgid "Cobble Compressed"
msgstr ""

#: moreblocks.lua
msgid "Copper Patina"
msgstr ""

#: moreblocks.lua
msgid "Empty Shelf"
msgstr ""

#: moreblocks.lua
msgid "Stone Bricks"
msgstr ""

#: moreblocks.lua
msgid "Iron Stone"
msgstr ""

#: moreblocks.lua
msgid "Iron Stone Bricks"
msgstr ""

#: moreblocks.lua
msgid "Plankstone"
msgstr ""

#: moreblocks.lua
msgid "Split Stone Tile"
msgstr ""

#: moreblocks.lua
msgid "Stone Tile"
msgstr ""

#: moreblocks.lua
msgid "Tar"
msgstr ""

#: moreblocks.lua
msgid "Full Wooden Tile"
msgstr ""


code:
# textdomain:hidden_doors

Concealed =
 Door=
Painted =
Stone=
Cobble=
Stone Brick=
Stone Block=
Mossy Cobble=
Desert Stone=
Desert Cobble=
Desert Stone Brick=
Desert Stone Block=
Sandstone=
Sandstone Brick=
Sandstone Block=
Desert Sandstone=
Desert Sandstone Brick=
Desert Sandstone Block=
Silver Sandstone=
Silver Sandstone Brick=
Silver Sandstone Block=
Obsidian=
Obsidian Brick=
Obsidian Block=
Tree=
Jungle Tree=
Pine Tree=
Acacia Tree=
Aspen Tree=
Wood=
Jungle Wood=
Pine Wood=
Acacia Wood=
Aspen Wood=
Bronze Block=
Copper Block=
Gold Block=
Steel Block=
Tin Block=
Dirt=
Brick=
Ice=
Diamond Block=
Mese Block=
Bookshelf=
Sand=
Silver Sand=
Desert Sand=
All-faces Jungle Tree=
All-faces Tree=
Cactus Brick=
Circle Stone Bricks=
Coal Stone=
Cobble Compressed=
Copper Patina=
Empty Shelf=
Stone Bricks=
Iron Stone=
Iron Stone Bricks=
Plankstone=
Split Stone Tile=
Stone Tile=
Tar=
Full Wooden Tile=
Permafrost=


code:
--[[
	Hidden Doors - Adds various wood, stone, etc. doors.
	Copyright © 2017, 2019 Hamlet <hamlatmesehub@riseup.net>,
	Napiophelios, Treer and contributors.

	Licensed under the EUPL, Version 1.2 or – as soon they will be
	approved by the European Commission – subsequent versions of the
	EUPL (the "Licence");
	You may not use this work except in compliance with the Licence.
	You may obtain a copy of the Licence at:

	https://joinup.ec.europa.eu/software/page/eupl
	https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863

	Unless required by applicable law or agreed to in writing,
	software distributed under the Licence is distributed on an
	"AS IS" basis,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
	implied.
	See the Licence for the specific language governing permissions
	and limitations under the Licence.

--]]

--
-- Global mod namespace
--

hidden_doors = {}

--
-- Variables
--

local s_ModPath = minetest.get_modpath(minetest.get_current_modname())

-- Used for localization, choose either built-in or intllib.

local S, NS = nil

if (minetest.get_modpath("intllib") == nil) then
	S = minetest.get_translator("hidden_doors")

else
	-- internationalization boilerplate
	S, NS = dofile(s_ModPath.."/intllib.lua")

end

local s_Description1 = S("Concealed ")
local s_Description2 = S(" Door")

-- 'painted' doors are not fully concealed,
-- they are wooden doors painted to blend in
local b_DoorsArePainted = minetest.settings:get_bool("hidden_doors_painted", false)

if b_DoorsArePainted then
	 s_Description1 = S("Painted ")
end

-- Hidden Doors' sounds
local f_HiddenDoorsVolume = tonumber(minetest.settings:get("hidden_doors_vol"))

if (f_HiddenDoorsVolume == nil) then
	f_HiddenDoorsVolume = 5.0
end

t_StoneDefault = default.node_sound_stone_defaults()
t_StoneOpen = {
	name = "hidden_doors_stone_door_open",
	gain = f_HiddenDoorsVolume
}
t_StoneClose = {
	name = "hidden_doors_stone_door_close",
	gain = f_HiddenDoorsVolume
}

t_WoodDefault = default.node_sound_wood_defaults()
s_WoodOpen = "doors_door_open"
s_WoodClose = "doors_door_close"

t_MetalDefault = default.node_sound_metal_defaults()
s_MetalOpen = "doors_steel_door_open"
s_MetalClose = "doors_steel_door_close"

t_GemDefault = default.node_sound_glass_defaults()
s_GemOpen = "doors_glass_door_open"
s_GemClose = "doors_glass_door_close"

-- Hidden door's base recipe item
s_RecipeItem1 = "doors:door_wood"

-- Hidden door's texture variables
local i_Resolution = 16 -- Default textures' resolution.
local i_NodeWidth = 0
local i_NodeHeight = 0
local s_ImageSize = ""

-- Composed texture's images' offsets.
local i_Y1 = 0	local i_X1 = 0
local i_Y2 = 0	local i_X2 = 0
local i_Y3 = 0	local i_X3 = 0
local i_Y4 = 0	local i_X4 = 0

local i_HiddenDoorsRes = tonumber(minetest.settings:get("i_HiddenDoorsRes"))

if (i_HiddenDoorsRes == nil) then
	i_HiddenDoorsRes = i_Resolution
end

if i_HiddenDoorsRes == 16 then

	-- Item's inventory texture dimensions
	i_InventoryWidth = i_Resolution * 2
	i_InventoryHeight = i_Resolution * 2
	s_InventorySize = i_InventoryWidth .. "x" .. i_InventoryHeight

	-- Node's texture dimensions
	i_NodeWidth = (i_Resolution * 2) + 6
	i_NodeHeight = (i_Resolution * 2)
	s_ImageSize = i_NodeWidth .. "x" .. i_NodeHeight

	-- Composed texture's dimensions
	i_Y1 = i_Resolution	i_X1 = 8
	i_Y2 = 6			i_X2 = 6
	i_Y3 = i_Resolution	i_X3 = i_Resolution
	i_Y4 = i_Resolution	i_X4 = 22

elseif i_HiddenDoorsRes == 32 then

	-- Item's inventory texture dimensions
	i_InventoryWidth = (i_Resolution * 4)
	i_InventoryHeight = (i_Resolution * 4)
	s_InventorySize = i_InventoryWidth .. "x" .. i_InventoryHeight

	-- Node's texture dimensions
	i_NodeWidth = ((i_Resolution * 2) + 6) * 2
	i_NodeHeight = (i_Resolution * 4)
	s_ImageSize = i_NodeWidth .. "x" .. i_NodeHeight

	-- Composed texture's dimensions
	i_Y1 = 32					i_X1 = 16
	i_Y2 = 12					i_X2 = 12
	i_Y3 = (i_Resolution * 2)	i_X3 = (i_Resolution * 2)
	i_Y4 = (i_Resolution * 2)	i_X4 = 44

elseif i_HiddenDoorsRes == 64 then

	-- Item's inventory texture dimensions
	i_InventoryWidth = (i_Resolution * 8)
	i_InventoryHeight = (i_Resolution * 8)
	s_InventorySize = i_InventoryWidth .. "x" .. i_InventoryHeight

	-- Node's texture dimensions
	i_NodeWidth = ((i_Resolution * 2) + 6) * 4
	i_NodeHeight = (i_Resolution * 8)
	s_ImageSize = i_NodeWidth .. "x" .. i_NodeHeight

	-- Composed texture's dimensions
	i_Y1 = 64					i_X1 = 32
	i_Y2 = 24					i_X2 = 24
	i_Y3 = (i_Resolution * 4)	i_X3 = (i_Resolution * 4)
	i_Y4 = (i_Resolution * 4)	i_X4 = 88

elseif i_HiddenDoorsRes == 128 then

	-- Item's inventory texture dimensions
	i_InventoryWidth = (i_Resolution * 16)
	i_InventoryHeight = (i_Resolution * 16)
	s_InventorySize = i_InventoryWidth .. "x" .. i_InventoryHeight

	-- Node's texture dimensions dimensions
	i_NodeWidth = ((i_Resolution * 2) + 6) * 8
	i_NodeHeight = (i_Resolution * 16)
	s_ImageSize = i_NodeWidth .. "x" .. i_NodeHeight

	-- Composed texture's dimensions
	i_Y1 = 128					i_X1 = 64
	i_Y2 = 48					i_X2 = 48
	i_Y3 = (i_Resolution * 8)	i_X3 = (i_Resolution * 8)
	i_Y4 = (i_Resolution * 8)	i_X4 = 176

else

	-- If the setting is not valid then set it to 16px and use that resolution
	i_HiddenDoorsRes = i_Resolution
	minetest.settings:set("i_HiddenDoorsRes", i_HiddenDoorsRes)

	-- Item's inventory texture dimensions
	i_InventoryWidth = (i_Resolution * 2)
	i_InventoryHeight = (i_Resolution * 2)
	s_InventorySize = i_InventoryWidth .. "x" .. i_InventoryHeight

	-- Node's texture dimensions
	i_NodeWidth = (i_Resolution * 2) + 6
	i_NodeHeight = (i_Resolution * 2)
	s_ImageSize = i_NodeWidth .. "x" .. i_NodeHeight

	-- Composed texture's dimensions
	i_Y1 = i_Resolution		i_X1 = 8
	i_Y2 = 6				i_X2 = 6
	i_Y3 = i_Resolution		i_X3 = i_Resolution
	i_Y4 = i_Resolution		i_X4 = 22

end

hidden_doors.GetPaintedTextureSuffix = function(b_UseDefault16pxResolution)

	local s_TextureSuffix = ""
	local s_TextureSuffixIntentory = ""

	if (b_DoorsArePainted == true) then

		local i_PaintOpacity = 35
		local i_PaintOpacityInventory = (i_PaintOpacity + 15)

		if (b_UseDefault16pxResolution == true) then
			s_TextureSuffix =
				"^((hidden_doors_painted_overlay.png^[opacity:" ..
				i_PaintOpacity ..
				"^hidden_doors_hinges_overlay.png)^[resize:38x32)"
			s_TextureSuffixIntentory =
				":8,0=hidden_doors_painted_overlay.png\\^[opacity\\:" ..
				i_PaintOpacityInventory .. "\\^[resize\\:38x32"

		else
			s_TextureSuffix =
				"^((hidden_doors_painted_overlay.png^[opacity:" ..
				i_PaintOpacity ..
				"^hidden_doors_hinges_overlay.png)^[resize:" ..
				s_ImageSize .. ")"
			s_TextureSuffixIntentory =
				": " .. i_X1 ..
				",0=hidden_doors_painted_overlay.png\\^[opacity\\:" ..
				i_PaintOpacityInventory .. "\\^[resize\\:" .. s_ImageSize
		end
	end

	return s_TextureSuffix, s_TextureSuffixIntentory
end

hidden_doors.RegisterHiddenDoors = function(a_s_ModName, a_s_SubName,
	s_RecipeItem1, s_RecipeItem2, s_RecipeItem3, a_s_Description,
	a_t_Sounds, a_s_SoundOpen, a_s_SoundClose)

	local s_TextureName = a_s_ModName .. "_" .. a_s_SubName .. ".png"

	-- If the door uses textures from Darkage then use the default 16px res.
	-- Do the same for Moreblocks.
	if (a_s_ModName ~= "darkage") and (a_s_ModName ~= "moreblocks") then

		local s_NewTexture = "[combine:" .. s_ImageSize .. ": 0," ..
			"0=" .. s_TextureName .. ": 0," ..
			i_Y3 .. "=" .. s_TextureName .. ":" .. i_X2 .. "," ..
			"0=" .. s_TextureName .. ":" .. i_X2 .. "," ..
			i_Y3 .. "=" .. s_TextureName .. ":" .. i_X4 .. "," ..
			"0=" .. s_TextureName .. ":" .. i_X4 .. "," ..
			i_Y3 .. "=" .. s_TextureName

		local s_PaintedTextureSuffix, s_PaintedTextureSuffixInventory =
			hidden_doors.GetPaintedTextureSuffix(false)

		doors.register("hidden_door_" .. a_s_SubName, {
			description = s_Description1 .. a_s_Description .. s_Description2,

			tiles = {
				{
					name = "(" .. s_NewTexture ..
						"^[transformFX)^([combine:" .. s_ImageSize ..
						":" ..i_X3.. "," .. "0=" .. s_TextureName ..
						":" .. i_X3 .. "," .. i_Y3 .. "=" ..
						s_TextureName .. ")" .. s_PaintedTextureSuffix,

					backface_culling = true
				}
			},

			inventory_image = "[combine:" .. s_InventorySize .. ":" ..
				i_X1 .. "," .. "0=" .. s_TextureName .. ":" .. i_X1 ..
				"," .. i_Y1 .. "=" ..s_TextureName ..
				s_PaintedTextureSuffixInventory,

			groups = {cracky = 1, level = 2},
			sounds = a_t_Sounds,
			sound_open = a_s_SoundOpen,
			sound_close = a_s_SoundClose,

			recipe = {
				{
					s_RecipeItem1, s_RecipeItem2, s_RecipeItem3
				},
			}
		})

	else

		local s_NewTexture = "[combine:" .. "38x32" .. ": 0," ..
			"0=" .. s_TextureName .. ": 0," ..
			"16=" .. s_TextureName .. ": 6," ..
			"0=" .. s_TextureName .. ": 6," ..
			"16=" .. s_TextureName .. ": 22," ..
			"0=" .. s_TextureName .. ": 22," ..
			"16=" .. s_TextureName

		local s_PaintedTextureSuffix, s_PaintedTextureSuffixInventory =
			hidden_doors.GetPaintedTextureSuffix(true)

		doors.register("hidden_door_" .. a_s_SubName, {

			description = s_Description1 .. a_s_Description .. s_Description2,

			tiles = {
				{
					name = "(" .. s_NewTexture .. "^[transformFX)^([combine:"
					.. "38x32" .. ": 16," .. "0=" .. s_TextureName .. ": 16,"
					.. "16=" .. s_TextureName .. ")" .. s_PaintedTextureSuffix,

					backface_culling = true
				}
			},

			inventory_image = "[combine:" .. "32x32" .. ": 8," ..
				"0=" .. s_TextureName .. ": 8," .. "16=" .. s_TextureName ..
				s_PaintedTextureSuffixInventory,

			groups = {cracky = 1, level = 2},
			sounds = a_t_Sounds,
			sound_open = a_s_SoundOpen,
			sound_close = a_s_SoundClose,

			recipe = {
				{
					s_RecipeItem1,
					s_RecipeItem2,
					s_RecipeItem3
				},
			}
		})
	end
end

--
-- Minetest Game's based hidden doors
--

dofile(s_ModPath .. "/minetest_game.lua")

--
-- Compatible modules' based hidden doors
--

if minetest.get_modpath("darkage") then
	dofile(s_ModPath .. "/darkage.lua")
end

if minetest.get_modpath("moreblocks") then
	dofile(s_ModPath .. "/moreblocks.lua")
end


code:
--[[
	Hidden Doors - Adds various wood, stone, etc. doors.
	Copyright © 2017, 2019 Hamlet <hamlatmesehub@riseup.net>,
	Napiophelios, and contributors.

	Licensed under the EUPL, Version 1.2 or – as soon they will be
	approved by the European Commission – subsequent versions of the
	EUPL (the "Licence");
	You may not use this work except in compliance with the Licence.
	You may obtain a copy of the Licence at:

	https://joinup.ec.europa.eu/software/page/eupl
	https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863

	Unless required by applicable law or agreed to in writing,
	software distributed under the Licence is distributed on an
	"AS IS" basis,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
	implied.
	See the Licence for the specific language governing permissions
	and limitations under the Licence.

--]]

--
-- Variables
--

-- Used for localization, choose either built-in or intllib.

local s_ModPath, S, NS = nil

if (minetest.get_modpath("intllib") == nil) then
	S = minetest.get_translator("hidden_doors")

else
	-- internationalization boilerplate
	s_ModPath = minetest.get_modpath(minetest.get_current_modname())
	S, NS = dofile(s_ModPath.."/intllib.lua")

end

--[[

	Stone based doors
	-----------------
	(1. Material 2. Cobble variant 3. Brick variant 4. Modified forms)

]]--

hidden_doors.RegisterHiddenDoors("default", "stone", s_RecipeItem1,
	"stairs:slab_stone", "stairs:slab_stone", S("Stone"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "cobble", s_RecipeItem1,
	"stairs:slab_cobble", "stairs:slab_cobble", S("Cobble"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "stone_brick", s_RecipeItem1,
	"stairs:slab_stonebrick", "stairs:slab_stonebrick", S("Stone Brick"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "stone_block", s_RecipeItem1,
	"stairs:slab_stone_block", "stairs:slab_stone_block",
	S("Stone Block"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "mossycobble", s_RecipeItem1,
	"stairs:slab_mossycobble", "stairs:slab_mossycobble",
	S("Mossy Cobble"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "desert_stone", s_RecipeItem1,
	"stairs:slab_desert_stone", "stairs:slab_desert_stone",
	S("Desert Stone"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "desert_cobble", s_RecipeItem1,
	"stairs:slab_desert_cobble", "stairs:slab_desert_cobble",
	S("Desert Cobble"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "desert_stone_brick",
	s_RecipeItem1, "stairs:slab_desert_stonebrick",
	"stairs:slab_desert_stonebrick", S("Desert Stone Brick"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "desert_stone_block",
	s_RecipeItem1, "stairs:slab_desert_stone_block",
	"stairs:slab_desert_stone_block", S("Desert Stone Block"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "sandstone", s_RecipeItem1,
	"stairs:slab_sandstone", "stairs:slab_sandstone", S("Sandstone"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "sandstone_brick", s_RecipeItem1,
	"stairs:slab_sandstonebrick", "stairs:slab_sandstonebrick",
	S("Sandstone Brick"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "sandstone_block", s_RecipeItem1,
	"stairs:slab_sandstone_block", "stairs:slab_sandstone_block",
	S("Sandstone Block"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "desert_sandstone", s_RecipeItem1,
	"stairs:slab_desert_sandstone", "stairs:slab_desert_sandstone",
	S("Desert Sandstone"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "desert_sandstone_brick",
	s_RecipeItem1, "stairs:slab_desert_sandstone_brick",
	"stairs:slab_desert_sandstone_brick", S("Desert Sandstone Brick"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "desert_sandstone_block",
	s_RecipeItem1, "stairs:slab_desert_sandstone_block",
	"stairs:slab_desert_sandstone_block", S("Desert Sandstone Block"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "silver_sandstone", s_RecipeItem1,
	"stairs:slab_silver_sandstone", "stairs:slab_silver_sandstone",
	S("Silver Sandstone"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "silver_sandstone_brick",
	s_RecipeItem1, "stairs:slab_silver_sandstone_brick",
	"stairs:slab_silver_sandstone_brick", S("Silver Sandstone Brick"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "silver_sandstone_block",
	s_RecipeItem1, "stairs:slab_silver_sandstone_block",
	"stairs:slab_silver_sandstone_block", S("Silver Sandstone Block"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "obsidian", s_RecipeItem1,
	"stairs:slab_obsidian", "stairs:slab_obsidian", S("Obsidian"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "obsidian_brick", s_RecipeItem1,
	"stairs:slab_obsidianbrick", "stairs:slab_obsidianbrick",
	S("Obsidian Brick"), t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "obsidian_block", s_RecipeItem1,
	"stairs:slab_obsidian_block", "stairs:slab_obsidian_block",
	S("Obsidian Block"), t_StoneDefault, t_StoneOpen, t_StoneClose)

--[[

	Tree based doors
	-----------------
	(1. Trunk 2. Fabricated trunk)

]]--

hidden_doors.RegisterHiddenDoors("default", "tree", s_RecipeItem1,
	"default:tree", nil, S("Tree"), t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "jungletree", s_RecipeItem1,
	"default:jungletree", nil, S("Jungle Tree"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "pine_tree", s_RecipeItem1,
	"default:pine_tree", nil, S("Pine Tree"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "acacia_tree", s_RecipeItem1,
	"default:acacia_tree", nil, S("Acacia Tree"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "aspen_tree", s_RecipeItem1,
	"default:aspen_tree", nil, S("Aspen Tree"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "wood", s_RecipeItem1,
	"stairs:slab_wood", "stairs:slab_wood", S("Wood"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "junglewood", s_RecipeItem1,
	"stairs:slab_junglewood", "stairs:slab_junglewood", S("Jungle Wood"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "pine_wood", s_RecipeItem1,
	"stairs:slab_pine_wood", "stairs:slab_pine_wood", S("Pine Wood"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "acacia_wood", s_RecipeItem1,
	"stairs:slab_acacia_wood", "stairs:slab_acacia_wood", S("Acacia Wood"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "aspen_wood", s_RecipeItem1,
	"stairs:slab_aspen_wood", "stairs:slab_aspen_wood", S("Aspen Wood"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

--[[

	Metal based doors
	-----------------

]]--

hidden_doors.RegisterHiddenDoors("default", "bronze_block", s_RecipeItem1,
	"stairs:slab_bronzeblock", "stairs:slab_bronzeblock",
	S("Bronze Block"), t_MetalDefault, s_MetalOpen, s_MetalClose)

hidden_doors.RegisterHiddenDoors("default", "copper_block", s_RecipeItem1,
	"stairs:slab_copperblock", "stairs:slab_copperblock",
	S("Copper Block"), t_MetalDefault, s_MetalOpen, s_MetalClose)

hidden_doors.RegisterHiddenDoors("default", "gold_block", s_RecipeItem1,
	"stairs:slab_goldblock", "stairs:slab_goldblock", S("Gold Block"),
	t_MetalDefault, s_MetalOpen, s_MetalClose)

hidden_doors.RegisterHiddenDoors("default", "steel_block", s_RecipeItem1,
	"stairs:slab_steelblock", "stairs:slab_steelblock",
	S("Steel Block"), t_MetalDefault, s_MetalOpen, s_MetalClose)

hidden_doors.RegisterHiddenDoors("default", "tin_block", s_RecipeItem1,
	"stairs:slab_tinblock", "stairs:slab_tinblock",
	S("Tin Block"), t_MetalDefault, s_MetalOpen, s_MetalClose)

--[[

	Other kinds of materials
	------------------------

]]--

hidden_doors.RegisterHiddenDoors("default", "dirt", s_RecipeItem1,
	"default:dirt", nil, S("Dirt"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "brick", s_RecipeItem1,
	"stairs:slab_brick", "stairs:slab_brick", S("Brick"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "ice", s_RecipeItem1,
	"stairs:slab_ice", "stairs:slab_ice", S("Ice"),
	t_GemDefault, s_GemOpen, s_GemClose)

hidden_doors.RegisterHiddenDoors("default", "diamond_block", s_RecipeItem1,
	"default:diamondblock", nil, S("Diamond Block"),
	t_GemDefault, s_GemOpen, s_GemClose)

hidden_doors.RegisterHiddenDoors("default", "mese_block", s_RecipeItem1,
	"default:mese", nil, S("Mese Block"),
	t_GemDefault, s_GemOpen, s_GemClose)

hidden_doors.RegisterHiddenDoors("default", "bookshelf", s_RecipeItem1,
	"default:bookshelf", nil, S("Bookshelf"),
	t_WoodDefault, s_WoodOpen, s_WoodClose)

hidden_doors.RegisterHiddenDoors("default", "sand", s_RecipeItem1,
	"default:sand", nil, S("Sand"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "silver_sand", s_RecipeItem1,
	"default:silver_sand", nil, S("Silver Sand"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

hidden_doors.RegisterHiddenDoors("default", "desert_sand", s_RecipeItem1,
	"default:desert_sand", nil, S("Desert Sand"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)

--
-- Support for Minetest Game v5.x node(s)
--

-- Scan for the new node(s)
local t_NodesFound = minetest.registered_nodes
local b_PermafrostAvailable = false

for _, value in pairs(t_NodesFound) do
	if (value.name == "default:permafrost") then
		b_PermafrostAvailable = true
	end
end

if (b_PermafrostAvailable == true) then
	hidden_doors.RegisterHiddenDoors("default", "permafrost", s_RecipeItem1,
	"default:permafrost", nil, S("Permafrost"),
	t_StoneDefault, t_StoneOpen, t_StoneClose)
end

--
-- Flush the variables
--

t_NodesFound = nil
b_PermafrostAvailable = nil


code:
name = hidden_doors
description = Adds various wood, stone, etc. doors.
depends = default, doors, stairs, vessels
optional_depends = intllib, darkage, moreblocks