rock crusher, tweaks

master
Izzy 2019-04-26 00:52:55 -06:00
parent 92892b273b
commit 75947e833f
5 changed files with 91 additions and 45 deletions

View File

@ -147,7 +147,7 @@ minetest.register_node("bitumen:cement_mixer", {
}
},
paramtype2 = "facedir",
groups = {choppy=1, petroleum_fixture=1},
groups = {cracky=1, petroleum_fixture=1},
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)

View File

@ -306,7 +306,7 @@ minetest.register_craft({
})
--
-- misc machines
minetest.register_craft({
output = "bitumen:kerosene_light",
@ -316,3 +316,12 @@ minetest.register_craft({
{"", "bitumen:drum_extractor", ""},
}
})
minetest.register_craft({
output = "bitumen:rock_crusher",
recipe = {
{"", "bitumen:galv_steel_sheet", ""},
{"bitumen:galv_steel_sheet", "bitumen:rock_crusher_blueprint", "bitumen:galv_steel_sheet"},
{"", "bitumen:galv_steel_sheet", ""},
}
})

View File

@ -104,6 +104,7 @@ dofile(modpath.."/cylinder_tank.lua")
dofile(modpath.."/sphere_tank.lua")
dofile(modpath.."/refinery.lua")
dofile(modpath.."/lights.lua")
dofile(modpath.."/rock_crusher.lua")

View File

@ -85,23 +85,25 @@ minetest.register_ore({
minetest.register_ore({
ore_type = "blob",
ore = "bitumen:chalk",
wherein = {"default:stone"},
clust_scarcity = 32 * 32 * 32,
clust_size = 6,
wherein = {"default:stone", "default:sand"},
clust_scarcity = 48 * 48 * 48,
clust_size = 14,
y_min = 2,
y_max = 30,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
spread = {x = 10, y = 5, z = 7},
seed = -343,
octaves = 1,
persist = 0.0
persist = 0.1
},
biomes = {"savanna", "savanna_shore", "savanna_ocean",
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground",
"floatland_coniferous_forest", "floatland_coniferous_forest_ocean"}
"floatland_coniferous_forest", "floatland_coniferous_forest_ocean"
-- ,"grassland", "desert", "sandstone_desert"
}
})

View File

@ -68,12 +68,12 @@ local rock_crusher_formspec =
local function take_gas(itemstack, amount)
if st:get_name() ~= "bitumen:oil_drum_filled" end
if itemstack:get_name() ~= "bitumen:oil_drum_filled" then
return false
end
local smeta = st:get_meta()
if smeta:get_float("fluid") ~= "bitumen:gasoline" then
local smeta = itemstack:get_meta()
if smeta:get_string("fluid") ~= "bitumen:gasoline" then
return false
end
@ -88,6 +88,62 @@ local function take_gas(itemstack, amount)
end
function crushtimer(pos, elapsed)
local meta = minetest.get_meta(pos)
local fuel = meta:get_float("fuel") or 0.0
if fuel <= 0 then
-- try to get some fuel
local inv = meta:get_inventory()
local st = inv:get_stack("main", 1)
if take_gas(st, 1) then
inv:set_stack("main", 1, st);
fuel = fuel + 1
else
-- out of fuel, turn off
return false
end
end
fuel = fuel - .1
meta:set_float("fuel", fuel)
-- try to grind some rocks
pos.y = pos.y + 1
-- local tnode = minetest.get_node(pos)
local tmeta = minetest.get_meta(pos)
local tinv = tmeta:get_inventory()
local cob = tinv:remove_item("main", "default:cobble 1")
if cob:get_count() <= 0 then
cob = tinv:remove_item("main", "default:desert_cobble 1")
end
if cob:get_count() > 0 then
pos.y = pos.y - 2
local bmeta = minetest.get_meta(pos)
local binv = bmeta:get_inventory()
binv:add_item("main", "default:gravel 1")
end
return true
end
minetest.register_node("bitumen:rock_crusher", {
description = "Small Gas Rock Crusher",
drawtype = "nodebox",
@ -120,40 +176,13 @@ minetest.register_node("bitumen:rock_crusher", {
on_punch = function(pos)
swap_node(pos, "bitumen:rock_crusher_on")
try_turn_on(pos)
minetest.get_node_timer(pos):start(2.0)
--try_turn_on(pos)
end,
on_timer = function(pos)
return false
end,
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
local fuel = meta:get_float("fuel") or 0.0
if fuel <= 0 then
-- try to get some fuel
local inv = meta:get_inventory()
local st = inv:get_stack("main", 1)
if take_gas(st, 1) then
inv:set_stack("main", 1, st);
fuel = fuel + 1
else
-- out of fuel, turn off
return false
end
end
fuel = fuel - .1
meta:set_float("fuel", fuel)
-- try to grind some rocks
end
})
@ -190,11 +219,16 @@ minetest.register_node("bitumen:rock_crusher_on", {
on_punch = function(pos)
swap_node(pos, "bitumen:rock_crusher")
destruct_light(pos)
-- destruct_light(pos)
end,
on_timer = crushtimer,
})
bitumen.register_blueprint({
name="bitumen:rock_crusher",
no_constructor_craft = true,
})