Adapt mod for techage v1
This commit is contained in:
parent
ddb610b1df
commit
4cc7385cda
10
init.lua
10
init.lua
@ -13,6 +13,8 @@
|
|||||||
-- Load support for I18n.
|
-- Load support for I18n.
|
||||||
local S = minetest.get_translator("ta4_jetpack")
|
local S = minetest.get_translator("ta4_jetpack")
|
||||||
|
|
||||||
|
local liquid = networks.liquid
|
||||||
|
|
||||||
local ta4_jetpack = {}
|
local ta4_jetpack = {}
|
||||||
|
|
||||||
local Players = {}
|
local Players = {}
|
||||||
@ -321,25 +323,27 @@ local function load_fuel(itemstack, user, pointed_thing)
|
|||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
if pos then
|
if pos then
|
||||||
local name = user:get_player_name()
|
local name = user:get_player_name()
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
-- check jetpack
|
-- check jetpack
|
||||||
if not Jetpacks[name] then
|
if not Jetpacks[name] then
|
||||||
minetest.chat_send_player(name, S("[Jetpack] You don't have your jetpack on your back!"))
|
minetest.chat_send_player(name, S("[Jetpack] You don't have your jetpack on your back!"))
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
if techage.liquid.srv_peek(pos, 5) == "techage:hydrogen" then
|
if name and liquid.srv_peek(nvm) == "techage:hydrogen" then
|
||||||
local value = get_fuel_value(name)
|
local value = get_fuel_value(name)
|
||||||
local newvalue
|
local newvalue
|
||||||
|
|
||||||
if user:get_player_control().sneak then -- back to tank?
|
if user:get_player_control().sneak then -- back to tank?
|
||||||
local amount = math.min(value, FUEL_UNIT)
|
local amount = math.min(value, FUEL_UNIT)
|
||||||
local rest = techage.liquid.srv_put(pos, 5, "techage:hydrogen", amount)
|
local rest = liquid.srv_put(nvm, "techage:hydrogen", amount, MAX_FUEL)
|
||||||
newvalue = value - amount + rest
|
newvalue = value - amount + rest
|
||||||
else
|
else
|
||||||
local amount = math.min(FUEL_UNIT, MAX_FUEL - value)
|
local amount = math.min(FUEL_UNIT, MAX_FUEL - value)
|
||||||
local taken = techage.liquid.srv_take(pos, 5, "techage:hydrogen", amount)
|
local taken = liquid.srv_take(nvm, "techage:hydrogen", amount)
|
||||||
newvalue = value + taken
|
newvalue = value + taken
|
||||||
end
|
end
|
||||||
set_fuel_value(name, newvalue)
|
set_fuel_value(name, newvalue)
|
||||||
|
minetest.chat_send_player(name, S("[Jetpack]") .. ": " .. newvalue .. "/" .. MAX_FUEL)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
Loading…
x
Reference in New Issue
Block a user