mover: fuel costs tweaks for water,lava

grinder: recipe: obsidian shard -> lava, very expensive in fuel cost
    grinder now uses power depending on what item is grinded
This commit is contained in:
rnd1 2016-03-28 20:38:46 +02:00
parent 5b0e5f7a8c
commit 8c2f355dee
3 changed files with 27 additions and 18 deletions

View File

@ -12,6 +12,7 @@ basic_machines.grinder_recipes = {
["es:ruby_crystal"] = {4,"es:ruby_dust"},
["es:emerald_crystal"] = {4,"es:emerald_dust"},
["es:purpellium_lump"] = {4,"es:purpellium_dust"},
["default:obsidian_shard"] = {400,"default:lava_source"},
};
@ -47,11 +48,11 @@ local grinder_process = function(pos)
local supply=0;
if fueladd.time == 0 then -- no fuel inserted, try look for outlet
-- No valid fuel in fuel list
supply = basic_machines.check_power({x=pos.x,y=pos.y-1,z=pos.z},1) or 0;
supply = basic_machines.check_power({x=pos.x,y=pos.y-1,z=pos.z} , def[1]/4) or 0; -- tweaked so 1 coal = 1 energy
if supply>0 then
fueladd.time = 4*supply -- same as 10 coal
else
meta:set_string("infotext", "Please insert fuel.");
meta:set_string("infotext", "Please insert fuel");
return;
end
else
@ -66,7 +67,7 @@ local grinder_process = function(pos)
meta:set_string("infotext", "added fuel furnace burn time " .. fueladd.time .. ", fuel status " .. fuel);
end
if fuel-def[1]<0 then
meta:set_string("infotext", "need at least " .. -fuel .. " fuel to complete operation "); return
meta:set_string("infotext", "need at least " .. def[1]-fuel .. " fuel to complete operation "); return
end
end

View File

@ -12,21 +12,20 @@ local max_range = 10; -- machines normal range of operation
local machines_operations = 10; -- 1 coal will provide 10 mover basic operations ( moving dirt 1 block distance)
local machines_timer = 5 -- main timestep
local machines_TTL = 16; -- time to live for signals
local MOVER_FUEL_STORAGE_CAPACITY = 5; -- how many operations from one coal lump - base unit
--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}
-- how hard it is to move blocks, default factor 1
-- how hard it is to move blocks, default factor 1, note fuel cost is this multiplied by distance and divided by machine_operations..
basic_machines.hardness = {
["default:stone"]=4,["default:tree"]=2,["default:jungletree"]=2,["default:pinetree"]=2,["default:acacia_tree"]=2,
["default:lava_source"]=10000,["default:water_source"]=10000,["default:obsidian"]=20,["bedrock2:bedrock"]=999999};
["default:lava_source"]=21890,["default:water_source"]=11000,["default:obsidian"]=20,["bedrock2:bedrock"]=999999};
basic_machines.hardness["basic_machines:mover"]=0.;
basic_machines.hardness["es:toxic_water_source"]=10000.;basic_machines.hardness["es:toxic_water_flowing"]=1000.;
basic_machines.hardness["es:toxic_water_source"]=21890.;basic_machines.hardness["es:toxic_water_flowing"]=11000;
basic_machines.hardness["default:river_water_source"]=21890.;
-- farming operations are much cheaper
basic_machines.hardness["farming:wheat_8"]=0.1;basic_machines.hardness["farming:cotton_8"]=0.1;
basic_machines.hardness["farming:seed_wheat"]=0.05;basic_machines.hardness["farming:seed_cotton"]=0.05;
basic_machines.hardness["farming:wheat_8"]=1;basic_machines.hardness["farming:cotton_8"]=1;
basic_machines.hardness["farming:seed_wheat"]=0.5;basic_machines.hardness["farming:seed_cotton"]=0.5;
-- define which nodes are dug up completely, like a tree
@ -45,6 +44,9 @@ basic_machines.plant_table = {["farming:seed_barley"]="farming:barley_1",["farm
["farming:raspberries"]="farming:raspberry_1",["farming:rhubarb"]="farming:rhubarb_1",["farming:tomato"]="farming:tomato_1",
["farming:seed_wheat"]="farming:wheat_1"}
--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 *** --
@ -445,7 +447,7 @@ minetest.register_node("basic_machines:mover", {
for _, pos3 in ipairs(positions) do
-- dont take coal from source or target location to avoid chest/fuel confusion isssues
if count>15 then break end
if count>16 then break end
minetest.set_node(pos3,{name="air"}); count = count+1;
end

View File

@ -16,11 +16,12 @@ local battery_update_meta = function(pos)
local meta = minetest.get_meta(pos);
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
local capacity = meta:get_float("capacity");
local maxpower = meta:get_float("maxpower");
local energy = math.ceil(10*meta:get_float("energy"))/10;
local form =
"size[8,6.5]" .. -- width, height
"label[0,0;FUEL] ".."label[6,0;UPGRADE] "..
"label[1,0;ENERGY ".. energy .."/ ".. capacity..", maximum power output ".. (capacity*0.1) .."]"..
"label[1,0;ENERGY ".. energy .."/ ".. capacity..", maximum power output ".. maxpower .."]"..
"label[1,1;UPGRADE LEVEL ".. meta:get_int("upgrade") .. " (mese and diamond block)]"..
"list["..list_name..";fuel;0.,0.5;1,1;]".. "list["..list_name..";upgrade;6.,0.5;2,1;]" ..
"list[current_player;main;0,2.5;8,4;]"..
@ -94,10 +95,13 @@ battery_upgrade = function(pos)
meta:set_int("upgrade",count);
-- adjust capacity
local capacity = 10+20*count;
if count == 99 then capacity = 10000 end -- ultimate upgrade for ultimate capacity
--if count == 99 then capacity = 10000 end -- ultimate upgrade for ultimate capacity
local maxpower = capacity*0.1;
capacity = math.ceil(capacity*10)/10;
local energy = 0;
meta:set_float("capacity",capacity)
meta:set_float("maxpower",maxpower)
meta:set_float("energy",0)
meta:set_string("infotext", "energy: " .. math.ceil(energy*10)/10 .. " / ".. capacity);
end
@ -114,7 +118,7 @@ minetest.register_node("basic_machines:battery", {
local inv = meta:get_inventory();inv:set_size("fuel", 1*1); -- place to put crystals
inv:set_size("upgrade", 2*1);
meta:set_int("upgrade",0); -- upgrade level determines energy storage capacity and max energy output
meta:set_float("capacity",10);
meta:set_float("capacity",10);meta:set_float("maxpower",1);
meta:set_float("energy",0);
end,
@ -383,8 +387,10 @@ function basic_machines.check_power(pos, power_draw) -- mover checks power sourc
local meta = minetest.get_meta(pos);
local energy = meta:get_float("energy");
local capacity = meta:get_float("capacity");
if power_draw>capacity*0.1 then
meta:set_string("infotext", "Power draw required : " .. power_draw .. " maximum power output " .. capacity*0.1 .. ". Please upgrade battery")
local maxpower = meta:get_float("maxpower");
if power_draw>maxpower then
meta:set_string("infotext", "Power draw required : " .. power_draw .. " maximum power output " .. maxpower .. ". Please upgrade battery")
return 0;
end