bugfixes for pump, fuelcell, oil drillbox, Lua server, ICTA controller, Lua controller, Door controller. lamp holder added
This commit is contained in:
parent
0815c6b485
commit
5191d74f5f
@ -48,19 +48,19 @@ local function formspec(self, pos, nvm)
|
||||
"image[2,1.5;1,1;techage_form_arrow_fg.png^[transformR270]"..
|
||||
"image_button[2,2.5;1,1;".. self:get_state_button_image(nvm) ..";state_button;]"..
|
||||
"tooltip[2,2.5;1,1;"..self:get_state_tooltip(nvm).."]"..
|
||||
techage.power.formspec_label_bar(3.5, 0.8, S("Electricity"), PWR_CAPA, nvm.provided)
|
||||
techage.power.formspec_label_bar(3.5, 0.8, S("Electricity"), PWR_CAPA, nvm.given)
|
||||
end
|
||||
|
||||
local function start_node(pos, nvm, state)
|
||||
nvm.running = true
|
||||
nvm.provided = 0
|
||||
nvm.given = 0
|
||||
local outdir = M(pos):get_int("outdir")
|
||||
power.generator_start(pos, Cable, CYCLE_TIME, outdir)
|
||||
end
|
||||
|
||||
local function stop_node(pos, nvm, state)
|
||||
nvm.running = false
|
||||
nvm.provided = 0
|
||||
nvm.given = 0
|
||||
local outdir = M(pos):get_int("outdir")
|
||||
power.generator_stop(pos, Cable, outdir)
|
||||
end
|
||||
|
@ -502,8 +502,8 @@ techage.register_node({"techage:ta4_icta_controller"}, {
|
||||
elseif state == techage.RUNNING and topic == "off" then
|
||||
set_input(pos, number, src, topic)
|
||||
elseif topic == "state" then
|
||||
local state = meta:get_int("state")
|
||||
return techage.StateStrings(state)
|
||||
local state = meta:get_int("state") or 0
|
||||
return techage.StateStrings[state] or "stopped"
|
||||
else
|
||||
return "unsupported"
|
||||
end
|
||||
|
1
init.lua
1
init.lua
@ -150,6 +150,7 @@ else
|
||||
dofile(MP.."/lamps/industriallamp3.lua")
|
||||
dofile(MP.."/lamps/industriallamp4.lua")
|
||||
dofile(MP.."/lamps/growlight.lua")
|
||||
dofile(MP.."/lamps/lampholder.lua")
|
||||
|
||||
-- Oil
|
||||
dofile(MP.."/oil/explore.lua")
|
||||
|
115
lamps/lampholder.lua
Normal file
115
lamps/lampholder.lua
Normal file
@ -0,0 +1,115 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2020 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA3/4 Lamp Holder
|
||||
|
||||
]]--
|
||||
|
||||
local S = techage.S
|
||||
|
||||
local function register_holder(name, description, png)
|
||||
minetest.register_node(name, {
|
||||
description = description,
|
||||
tiles = {png},
|
||||
paramtype2 = "facedir", -- important!
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "connected",
|
||||
fixed = {{ -4/32, -4/32, -4/32, 4/32, 4/32, 4/32}},
|
||||
|
||||
connect_top = {{ -3/32, -3/32, -3/32, 3/32, 16/32, 3/32}},
|
||||
connect_bottom = {{ -3/32, -16/32, -3/32, 3/32, 3/32, 3/32}},
|
||||
connect_left = {{-16/32, -3/32, -3/32, 3/32, 3/32, 3/32}},
|
||||
connect_right = {{ -3/32, -3/32, -3/32, 16/32, 3/32, 3/32}},
|
||||
connect_back = {{ -3/32, -3/32, -3/32, 3/32, 3/32, 16/32}},
|
||||
connect_front = {{ -3/32, -3/32, -16/32, 3/32, 3/32, 3/32}},
|
||||
},
|
||||
connects_to = {
|
||||
"techage:ceilinglamp_off", "techage:ceilinglamp_on",
|
||||
"techage:growlight_off", "techage:growlight_on",
|
||||
"techage:industriallamp1_off", "techage:industriallamp1_on",
|
||||
"techage:industriallamp2_off", "techage:industriallamp2_on",
|
||||
"techage:industriallamp3_off", "techage:industriallamp3_on",
|
||||
"techage:industriallamp4_off", "techage:industriallamp4_on",
|
||||
"techage:simplelamp_off", "techage:simplelamp_on",
|
||||
"techage:streetlamp_off", "techage:streetlamp_on",
|
||||
"techage:streetlamp2_off", "techage:streetlamp2_on",
|
||||
"techage:streetlamp_arm", "techage:streetlamp_pole",
|
||||
"techage:streetlamp2_off", "techage:streetlamp2_on",
|
||||
"techage:power_line", "techage:power_lineS", "techage:power_lineA"
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
register_holder("techage:lampholder1", S("TA Lamp Holder White"), "techage_streetlamp2_housing.png")
|
||||
register_holder("techage:lampholder2", S("TA Lamp Holder Aspen"), "default_aspen_wood.png")
|
||||
register_holder("techage:lampholder3", S("TA Lamp Holder Acacia"), "default_acacia_wood.png")
|
||||
register_holder("techage:lampholder4", S("TA Lamp Holder Apple"), "default_wood.png")
|
||||
register_holder("techage:lampholder5", S("TA Lamp Holder Copper"), "default_copper_block.png")
|
||||
register_holder("techage:lampholder6", S("TA Lamp Holder Gold"), "default_gold_block.png")
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:lampholder1 2",
|
||||
recipe = {
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
{"", "dye:white", ""},
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:lampholder2 2",
|
||||
recipe = {
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
{"", "default:fence_aspen_wood", ""},
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:lampholder3 2",
|
||||
recipe = {
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
{"", "default:fence_acacia_wood", ""},
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:lampholder4 2",
|
||||
recipe = {
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
{"", "default:fence_wood", ""},
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "techage:lampholder5 2",
|
||||
recipe = {
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
{"", "default:copper_ingot", ""},
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "techage:lampholder6 2",
|
||||
recipe = {
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
{"", "default:gold_ingot", ""},
|
||||
{"basic_materials:steel_bar", "", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
@ -109,6 +109,10 @@ local function node_timer4(pos, elapsed)
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
if minetest.is_protected(pos, clicker:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if node.name == "techage:t3_pump" then
|
||||
set_starter_name(pos, clicker)
|
||||
|
@ -42,14 +42,14 @@ local function swap_door_nodes(pos, open)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
for _,item in ipairs(nvm.door_blocks or {}) do
|
||||
if item.pos and item.name and item.param2 then
|
||||
local node = techage.get_node_lvm(item.pos)
|
||||
if open then
|
||||
local node = techage.get_node_lvm(item.pos)
|
||||
if node.name == item.name then
|
||||
minetest.remove_node(item.pos)
|
||||
else
|
||||
item.name = nil
|
||||
end
|
||||
else
|
||||
elseif node.name == "air" then
|
||||
minetest.add_node(item.pos, {name = item.name, param2 = item.param2})
|
||||
end
|
||||
end
|
||||
@ -98,6 +98,7 @@ minetest.register_node("techage:ta3_doorcontroller", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
swap_door_nodes(pos, false)
|
||||
techage.remove_node(pos)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
@ -621,7 +621,7 @@ techage.register_node({"techage:ta4_lua_controller"}, {
|
||||
set_input(pos, number, "msg", payload)
|
||||
elseif topic == "state" then
|
||||
local running = meta:get_int("running") or STATE_STOPPED
|
||||
return techage.StateStrings(running)
|
||||
return techage.StateStrings[running] or "stopped"
|
||||
else
|
||||
return "unsupported"
|
||||
end
|
||||
|
@ -86,6 +86,7 @@ minetest.register_node("techage:ta4_server", {
|
||||
return
|
||||
end
|
||||
techage.del_mem(pos)
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
techage.remove_node(pos)
|
||||
end,
|
||||
|
||||
|
@ -56,7 +56,7 @@ local function formspec(self, pos, nvm)
|
||||
if not nvm.assemble_build then
|
||||
return formspec0
|
||||
end
|
||||
local depth = M(pos):get_int("depth") - 7 -- oil bubble
|
||||
local depth = M(pos):get_int("depth")
|
||||
local curr_depth = pos.y - (nvm.drill_pos or pos).y
|
||||
return "size[8,8]"..
|
||||
default.gui_bg..
|
||||
@ -134,8 +134,8 @@ local function drilling(pos, crd, nvm, inv)
|
||||
if not inv:contains_item("src", ItemStack("techage:oil_drillbit")) then
|
||||
crd.State:idle(pos, nvm, S("Drill bits missing"))
|
||||
elseif curr_depth >= depth then
|
||||
M(pos):set_string("oil_found", "false")
|
||||
crd.State:blocked(pos, nvm, S("No oil found"))
|
||||
M(pos):set_string("oil_found", "true")
|
||||
crd.State:stop(pos, nvm)
|
||||
elseif node.name == "techage:oilstorage" then -- old oil bubble node?
|
||||
nvm.drill_pos.y = nvm.drill_pos.y-1
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
@ -278,7 +278,7 @@ local _, node_name_ta3, _ =
|
||||
inv:set_size("src", 1)
|
||||
inv:set_size("dst", 1)
|
||||
local info = techage.explore.get_oil_info(pos)
|
||||
M(pos):set_int("depth", info.depth)
|
||||
M(pos):set_int("depth", info.depth - 5) -- oil bubble
|
||||
M(pos):set_int("amount", info.amount)
|
||||
M(pos):set_string("oil_found", "false")
|
||||
M(pos):set_string("owner", placer:get_player_name())
|
||||
|
Loading…
Reference in New Issue
Block a user