battery: notifies of recharge problems, will activate furnace if not already active when adding fuel

clock generator: texture update
This commit is contained in:
rnd1 2016-04-07 11:54:10 +02:00
parent ff854f0853
commit 7e194e982d
3 changed files with 10 additions and 5 deletions

View File

@ -45,18 +45,18 @@ basic_machines.plant_table = {["farming:seed_barley"]="farming:barley_1",["farm
--DEPRECATED: fuels used to power mover, now battery is used
basic_machines.fuels = {["default:coal_lump"]=30,["default:cactus"]=5,["default:tree"]=10,["default:jungletree"]=12,["default:pinetree"]=12,["default:acacia_tree"]=10,["default:coalblock"]=500,["default:lava_source"]=5000,["basic_machines:charcoal"]=20}
-- *** END OF SETTINGS *** --
local punchset = {};
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name(); if name == nil then return end
punchset[name] = {};
punchset[name].state = 0;
end
)
end)
-- MOVER --
minetest.register_node("basic_machines:mover", {

View File

@ -43,6 +43,8 @@ battery_recharge = function(pos)
if energy+add_energy<=capacity then
stack:take_item(1);
inv:set_stack("fuel", 1, stack)
else
meta:set_string("infotext", "recharge problem: capacity " .. capacity .. ", needed " .. energy+add_energy)
end
else -- try do determine caloric value
local fuellist = inv:get_list("fuel");if not fuellist then return energy end
@ -95,6 +97,8 @@ battery_upgrade = function(pos)
meta:set_string("infotext", "energy: " .. math.ceil(energy*10)/10 .. " / ".. capacity);
end
local machines_activate_furnace = minetest.registered_nodes["default:furnace"].on_metadata_inventory_put; -- this function will activate furnace
minetest.register_node("basic_machines:battery", {
description = "battery - stores energy, generates energy from fuel, can power nearby machines, or accelerate/run furnace above it. Its upgradeable.",
tiles = {"basic_machine_outlet.png","basic_machine_side.png","basic_machine_battery.png"},
@ -142,6 +146,8 @@ minetest.register_node("basic_machines:battery", {
fmeta:set_float("fuel_totaltime",60);fmeta:set_float("fuel_time",0) -- add 60 second burn time to furnace
energy=energy-1; -- use up one energy
meta:set_float("energy",energy);
-- make furnace start if not already started
if node~="default:furnace_active" then machines_activate_furnace(pos) end
-- update energy display
meta:set_string("infotext", "energy: " .. math.ceil(energy*10)/10 .. " / ".. capacity);
end
@ -230,7 +236,6 @@ minetest.register_node("basic_machines:battery", {
-- GENERATOR
local generator_update_meta = function(pos)
@ -435,7 +440,7 @@ minetest.register_craftitem("basic_machines:power_cell", {
})
minetest.register_craftitem("basic_machines:power_block", {
description = "Power block - provides 10 power",
description = "Power block - provides 11 power",
inventory_image = "power_block.png",
stack_max = 25
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 579 B

After

Width:  |  Height:  |  Size: 805 B