Add xdecor candle

master
BrunoMine 2019-09-05 13:04:34 -03:00
parent ccf24e2c60
commit 91ebdbe845
5 changed files with 71 additions and 2 deletions

View File

@ -1,2 +1,3 @@
default
fire
xdecor?

View File

@ -60,9 +60,10 @@ dofile(modpath.."/node.lua")
dofile(modpath.."/lighter.lua")
dofile(modpath.."/fuel.lua")
dofile(modpath.."/api.lua")
dofile(modpath.."/torch.lua")
dofile(modpath.."/oil.lua")
dofile(modpath.."/lamp.lua")
dofile(modpath.."/torchs/torch.lua")
dofile(modpath.."/torchs/lamp.lua")
dofile(modpath.."/torchs/candle.lua")
notificar("[OK]!")

67
torchs/candle.lua Normal file
View File

@ -0,0 +1,67 @@
--[[
Mod HardTorch para Minetest
Copyright (C) 2019 BrunoMine (https://github.com/BrunoMine)
Recebeste uma cópia da GNU Lesser General
Public License junto com esse software,
se não, veja em <http://www.gnu.org/licenses/>.
Registro de Candieiro (candle) do mod xdecor
]]
if minetest.registered_nodes["xdecor:candle"] == nil then return end
-- Luminosidade da lamparina
local candle_light_source = hardtorch.check_light_number(minetest.settings:get("hardtorch_candle_light_source") or 7)
-- Noites de durabilidade da tocha
local candle_nights = math.abs(tonumber(minetest.settings:get("hardtorch_candle_nights") or 0.8))
if candle_nights <= 0 then candle_nights = 0.8 end
-- Ajuste no candieiro padrão
do
minetest.override_item("xdecor:candle", {
-- Muda imagem para jogador saber que tem que acendela
inventory_image = "xdecor_candle_wield.png",
wield_image = "xdecor_candle_wield.png",
light_source = candle_light_source
})
end
-- Registra a tocha acessa como um combustivel
hardtorch.register_fuel("hardtorch:xdecor_candle_on", {
turns = candle_nights,
})
-- Registrar ferramentas
minetest.register_tool("hardtorch:xdecor_candle", {
description = "Candle (used)",
inventory_image = "xdecor_candle_wield.png",
wield_image = "xdecor_candle_wield.png",
groups = {not_in_creative_inventory = 1},
})
-- Versao acessa da ferramenta
minetest.register_tool("hardtorch:xdecor_candle_on", {
inventory_image = "xdecor_candle_inv.png",
wield_image = "xdecor_candle_inv.png",
groups = {not_in_creative_inventory = 1},
})
-- Registrar tocha
hardtorch.register_torch("hardtorch:xdecor_candle", {
light_source = minetest.registered_nodes["xdecor:candle"].light_source,
fuel = {"hardtorch:xdecor_candle_on"},
nodes = {
node = "xdecor:candle",
node_ceiling = "xdecor:candle",
node_wall = "xdecor:candle"
},
sounds = {
turn_on = {name="hardtorch_acendendo_tocha", gain=0.2},
turn_off = {name="hardtorch_apagando_tocha", gain=0.2},
water_turn_off = {name="hardtorch_apagando_tocha", gain=0.2},
},
})