Skip to content

Commit

Permalink
Add xdecor candle
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoMine committed Sep 5, 2019
1 parent ccf24e2 commit 91ebdbe
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
1 change: 1 addition & 0 deletions depends.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
default
fire
xdecor?
5 changes: 3 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]!")


Expand Down
67 changes: 67 additions & 0 deletions torchs/candle.lua
Original file line number Diff line number Diff line change
@@ -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},
},
})
File renamed without changes.
File renamed without changes.

0 comments on commit 91ebdbe

Please sign in to comment.