Ajuste no esgotamento de tochas
parent
856ca07a17
commit
a4252445c5
23
node.lua
23
node.lua
|
@ -96,12 +96,12 @@ hardtorch.register_node = function(torchname, def)
|
|||
|
||||
-- Caso tenha sobra tenta colocar no inventario, ou joga no chão (com aviso sonoro e textual)
|
||||
if sobra > 0 then
|
||||
if inv:room_for_item("main", nodes.node.." "..sobra) then
|
||||
if inv:room_for_item("main", def.nodes.node.." "..sobra) then
|
||||
-- Coloca no inventario
|
||||
inv:add_item("main", nodes.node.." "..sobra)
|
||||
inv:add_item("main", def.nodes.node.." "..sobra)
|
||||
else
|
||||
-- Coloca a tocha no inventario para poder dropa-la
|
||||
inv:set_stack(list, i, nodes.node" "..sobra)
|
||||
inv:set_stack(list, i, def.nodes.node" "..sobra)
|
||||
minetest.item_drop(inv:get_stack(list, i), player, player:getpos())
|
||||
-- Recoloca tocha
|
||||
inv:set_stack(list, i, itemstack)
|
||||
|
@ -135,8 +135,21 @@ hardtorch.register_node = function(torchname, def)
|
|||
|
||||
-- Remove tocha quando fogo acabar
|
||||
local on_timer = function(pos, elapsed)
|
||||
-- remove bloco
|
||||
minetest.remove_node(pos)
|
||||
|
||||
if def.nodes_off then
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if node.name == def.nodes.node then
|
||||
node.name=def.nodes_off.node
|
||||
elseif node.name == def.nodes.node_ceiling then
|
||||
node.name=def.nodes_off.node_ceiling
|
||||
elseif node.name == def.nodes.node_wall then
|
||||
node.name=def.nodes_off.node_wall
|
||||
end
|
||||
minetest.set_node(pos, node)
|
||||
else
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end
|
||||
|
||||
local node_torch_def = {
|
||||
|
|
1
oil.lua
1
oil.lua
|
@ -19,7 +19,6 @@ if oil_nights <= 0 then oil_nights = 1.2 end
|
|||
minetest.register_tool("hardtorch:oil", {
|
||||
description = "Oleo",
|
||||
inventory_image = "hardtorch_oil.png",
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
# Configurações aplicaveis para o menu gráfico
|
||||
|
||||
|
||||
# Quantidade de noites que uma tocha perdura acessa.
|
||||
# Numero de noites que uma Tocha perdura acesa.
|
||||
# Number of nights a Torch remains lit.
|
||||
# (Precisao de 2 segundos)
|
||||
hardtorch_torch_nights (Durabilidade da Tocha em noites) float 1
|
||||
hardtorch_torch_nights (Durabilidade - Tocha) float 0.1
|
||||
|
||||
|
||||
# Isso obriga o jogador a ter algum acendedor no inventario para ligar a tocha.
|
||||
# Bater a tocha em fontes de fogo tambem acendem a tocha
|
||||
# Numero de noites que uma porção de Oleo perdura acesa.
|
||||
# Number of nights a portion of Oil remains lit.
|
||||
# (Precisao de 2 segundos)
|
||||
hardtorch_torch_lighter (Acendedor de Tocha) bool false
|
||||
hardtorch_lamp_nights (Durabilidade - Oil) float 1.2
|
||||
|
||||
|
||||
# É necessario acendedor ou fonte de fogo para acender uma tocha.
|
||||
# Lighter or fire source is needed to light a torch.
|
||||
hardtorch_torch_lighter (Acendedor/lighter) bool false
|
||||
|
||||
|
||||
|
||||
|
|
4
tool.lua
4
tool.lua
|
@ -43,9 +43,9 @@ hardtorch.apagar_tocha = function(player, torchname)
|
|||
local list, i, itemstack = hardtorch.find_and_get_item(player, torchname.."_on")
|
||||
if list then
|
||||
local inv = player:get_inventory()
|
||||
|
||||
-- Coloca no lugar
|
||||
itemstack:set_name(torchname)
|
||||
inv:set_stack(list, i, torchname)
|
||||
inv:set_stack(list, i, itemstack)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
10
torch.lua
10
torch.lua
|
@ -21,9 +21,10 @@ hardtorch.register_fuel("hardtorch:torch_on", {
|
|||
|
||||
-- Registrar ferramentas
|
||||
minetest.register_tool("hardtorch:torch", {
|
||||
description = "Torch",
|
||||
description = "Torch (used)",
|
||||
inventory_image = "hardtorch_torch_tool_off.png",
|
||||
wield_image = "hardtorch_torch_tool_off.png",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
-- Versao acessa da ferramenta
|
||||
|
@ -71,11 +72,10 @@ minetest.register_lbm({
|
|||
|
||||
-- Ajuste na tocha padrão
|
||||
do
|
||||
-- Remove receita de nodes de tochas
|
||||
minetest.clear_craft({output = 'default:torch'})
|
||||
minetest.registered_nodes["default:torch"].groups.not_in_creative_inventory = 1
|
||||
minetest.override_item("default:torch", {
|
||||
groups = minetest.registered_nodes["default:torch"].groups
|
||||
-- Muda imagem para jogador saber que tem que acendela
|
||||
inventory_image = "hardtorch_torch_tool_off.png",
|
||||
wield_image = "hardtorch_torch_tool_off.png",
|
||||
})
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue