bugfixes
This commit is contained in:
parent
e4ebfcd2d0
commit
17246c13cd
@ -86,7 +86,7 @@ function techage.firebox.on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
print(dump(fields))
|
||||
--print(dump(fields))
|
||||
if fields.update then
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
M(pos):set_string("formspec", techage.firebox.formspec(mem))
|
||||
|
@ -74,13 +74,17 @@ function techage.is_primary_node(pos, dir)
|
||||
return param2 ~= 0
|
||||
end
|
||||
|
||||
-- returns true if node can be dug
|
||||
function techage.can_node_dig(node)
|
||||
-- returns true, if node can be dug, or false
|
||||
-- Table result can be used to read the node name of the dropped node when dug
|
||||
function techage.can_node_dig(node, result)
|
||||
-- don't remove nodes with some intelligence or undiggable nodes
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
if not ndef or node.name == "air" then return false end
|
||||
if ndef.drop == "" then return false end
|
||||
if ndef.diggable == false then return false end
|
||||
if ndef.after_dig_node then return false end
|
||||
if result and type(result) == "table" then
|
||||
result.name = ndef.drop or node.name
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
@ -107,13 +107,15 @@ minetest.register_node("techage:coalfirebox", {
|
||||
end,
|
||||
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local mem = tubelib2.init_mem(pos)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
mem.running = true
|
||||
-- activate the formspec fire temporarily
|
||||
if not mem.burn_cycles or mem.burn_cycles == 0 then
|
||||
mem.burn_cycles = firebox.Burntime[stack:get_name()] / CYCLE_TIME
|
||||
mem.burn_cycles = mem.burn_cycles * 4 / (mem.power_level or 4)
|
||||
mem.burn_cycles_total = mem.burn_cycles
|
||||
M(pos):set_string("formspec", firebox.formspec(mem))
|
||||
mem.burn_cycles = 0
|
||||
end
|
||||
firehole(pos, true)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end,
|
||||
|
@ -126,7 +126,7 @@ local function drilling(pos, crd, mem, inv)
|
||||
local depth = M(pos):get_int("depth")
|
||||
local curr_depth = pos.y - (mem.drill_pos or pos).y
|
||||
local node = techage.get_node_lvm(mem.drill_pos)
|
||||
local item = ItemStack(node.name)
|
||||
local dropped_node = {}
|
||||
|
||||
if not inv:contains_item("src", ItemStack("techage:oil_drillbit")) then
|
||||
crd.State:idle(pos, mem)
|
||||
@ -138,7 +138,8 @@ local function drilling(pos, crd, mem, inv)
|
||||
elseif node.name == "techage:oil_drillbit2" then
|
||||
mem.drill_pos.y = mem.drill_pos.y-1
|
||||
crd.State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
||||
elseif techage.can_node_dig(node) then
|
||||
elseif techage.can_node_dig(node, dropped_node) then
|
||||
local item = ItemStack(dropped_node.name)
|
||||
if inv:room_for_item("dst", item) then
|
||||
inv:add_item("dst", item)
|
||||
minetest.swap_node(mem.drill_pos, {name = "techage:oil_drillbit2"})
|
||||
|
@ -178,6 +178,7 @@ minetest.register_node("techage:oilstorage", {
|
||||
tiles = {"default_stone.png"},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
diggable = false,
|
||||
drop = "",
|
||||
is_ground_content = false,
|
||||
})
|
||||
|
||||
@ -225,6 +226,8 @@ minetest.register_node("techage:oilexplorer_on", {
|
||||
|
||||
diggable = false,
|
||||
is_ground_content = false,
|
||||
paramtype = "light",
|
||||
light_source = 8,
|
||||
groups = {not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
@ -44,6 +44,28 @@ local function dec_oil_item(pos, meta)
|
||||
end
|
||||
end
|
||||
|
||||
local function formspec(self, pos, mem)
|
||||
local amount = 0
|
||||
local storage_pos = M(pos):get_string("storage_pos")
|
||||
if storage_pos ~= "" then
|
||||
amount = techage.explore.get_oil_amount(P(storage_pos))
|
||||
end
|
||||
return "size[5,3]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"image[0.5,0;1,1;techage_oil_inv.png]"..
|
||||
"image[2,0;1,1;"..techage.get_power_image(pos, mem).."]"..
|
||||
"label[0,1.3;"..I("Oil amount:")..": "..amount.."]"..
|
||||
"button[3,1.1;2,1;update;"..I("Update").."]"..
|
||||
"image_button[2,2.2;1,1;".. self:get_state_button_image(mem) ..";state_button;]"
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, mem))
|
||||
end
|
||||
|
||||
local function pumping(pos, crd, meta, mem)
|
||||
local items = has_oil_item(pos, meta)
|
||||
if items ~= nil then
|
||||
@ -65,20 +87,17 @@ local function keep_running(pos, elapsed)
|
||||
return crd.State:is_active(mem)
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if not minetest.is_protected(pos, clicker:get_player_name()) then
|
||||
if CRD(pos).State:get_state(mem) == techage.STOPPED then
|
||||
CRD(pos).State:start(pos, mem)
|
||||
else
|
||||
CRD(pos).State:stop(pos, mem)
|
||||
end
|
||||
end
|
||||
CRD(pos).State:state_button_event(pos, mem, fields)
|
||||
end
|
||||
|
||||
local tiles = {}
|
||||
|
||||
-- '#' will be replaced by the stage number
|
||||
-- '{power}' will be replaced by the power PNG
|
||||
tiles.pas = {
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png",
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
|
||||
@ -149,6 +168,7 @@ local _, node_name_ta3, _ =
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
has_item_meter = true,
|
||||
aging_factor = 10,
|
||||
formspec = formspec,
|
||||
tubing = tubing,
|
||||
after_place_node = function(pos, placer)
|
||||
local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
@ -160,6 +180,7 @@ local _, node_name_ta3, _ =
|
||||
end
|
||||
end,
|
||||
on_rightclick = on_rightclick,
|
||||
on_receive_fields = on_receive_fields,
|
||||
node_timer = keep_running,
|
||||
on_rotate = screwdriver.disallow,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user