Pumpjack: Add load command and other minor improvements

This commit is contained in:
Joachim Stolberg 2021-03-01 20:56:58 +01:00
parent bc059bc234
commit 9b11fee8d2
3 changed files with 13 additions and 3 deletions

View File

@ -71,7 +71,7 @@ function techage.fuel.formspec(nvm)
end end
function techage.fuel.can_dig(pos, player) function techage.fuel.can_dig(pos, player)
if minetest.is_protected(pos, player:get_player_name()) then if not player or minetest.is_protected(pos, player:get_player_name()) then
return false return false
end end
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)

View File

@ -174,7 +174,17 @@ tiles.act = {
local tubing = { local tubing = {
on_recv_message = function(pos, src, topic, payload) on_recv_message = function(pos, src, topic, payload)
if topic == "load" then
local storage_pos = M(pos):get_string("storage_pos")
if storage_pos ~= "" then
local amount, capa = techage.explore.get_oil_amount(P(storage_pos))
if amount and capa and capa > 0 then
return techage.power.percent(capa or 0, amount or 0), amount or 0
end
end
else
return CRD(pos).State:on_receive_message(pos, topic, payload) return CRD(pos).State:on_receive_message(pos, topic, payload)
end
end, end,
on_node_load = function(pos, node) on_node_load = function(pos, node)
CRD(pos).State:on_node_load(pos) CRD(pos).State:on_node_load(pos)

View File

@ -167,7 +167,7 @@ minetest.register_node("techage:ta3_akku", {
description = S("TA3 Accu Box"), description = S("TA3 Accu Box"),
tiles = { tiles = {
-- up, down, right, left, back, front -- up, down, right, left, back, front
"techage_filling_ta3.png^techage_frame_ta3_top.png", "techage_filling_ta3.png^techage_frame_ta3_top.png^techage_appl_arrow.png",
"techage_filling_ta3.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_hole_electric.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_hole_electric.png",
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_source.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_source.png",