From d7ecb4818e9b8d18ddffe3aab12a4f7f213d57bc Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Tue, 25 Jun 2019 20:35:51 +0200 Subject: [PATCH] some bugfixes --- basic_machines/generator.lua | 4 +- basic_machines/gravelrinser.lua | 6 +- basis/command.lua | 4 +- basis/consumer.lua | 4 ++ basis/guide.lua | 6 +- basis/junction.lua | 86 --------------------------- intllib.sh | 3 - lamps/lib.lua | 8 ++- lamps/streetlamp.lua | 3 + oil/drillbox.lua | 4 +- textures/techage_appl_hopper_top.png | Bin 273 -> 203 bytes 11 files changed, 26 insertions(+), 102 deletions(-) delete mode 100644 basis/junction.lua delete mode 100755 intllib.sh diff --git a/basic_machines/generator.lua b/basic_machines/generator.lua index 6b14378..f1c5439 100644 --- a/basic_machines/generator.lua +++ b/basic_machines/generator.lua @@ -61,7 +61,7 @@ local function start_node(pos, mem, state) minetest.sound_play("techage_generator", { pos = pos, gain = 1, - max_hear_distance = 7}) + max_hear_distance = 10}) end local function stop_node(pos, mem, state) @@ -107,7 +107,7 @@ local function node_timer(pos, elapsed) minetest.sound_play("techage_generator", { pos = pos, gain = 1, - max_hear_distance = 7}) + max_hear_distance = 10}) return true else mem.provided = 0 diff --git a/basic_machines/gravelrinser.lua b/basic_machines/gravelrinser.lua index af5956a..457fc0f 100644 --- a/basic_machines/gravelrinser.lua +++ b/basic_machines/gravelrinser.lua @@ -107,8 +107,10 @@ end local function set_velocity(obj, pos, vel) obj:set_acceleration({x = 0, y = 0, z = 0}) local p = obj:get_pos() - obj:set_pos({x=p.x, y=p.y-0.3, z=p.z}) - obj:set_velocity(vel) + if p then + obj:set_pos({x=p.x, y=p.y-0.3, z=p.z}) + obj:set_velocity(vel) + end end local function add_object(pos, name) diff --git a/basis/command.lua b/basis/command.lua index 13dff01..add2eb0 100644 --- a/basis/command.lua +++ b/basis/command.lua @@ -285,7 +285,7 @@ function techage.send_multi(numbers, placer_name, clicker_name, topic, payload) for _,num in ipairs(string_split(numbers, " ")) do if Number2Pos[num] and Number2Pos[num].name then local data = Number2Pos[num] - if not_protected(data.pos, placer_name, clicker_name) then + if data.pos and not_protected(data.pos, placer_name, clicker_name) then if NodeDef[data.name] and NodeDef[data.name].on_recv_message then NodeDef[data.name].on_recv_message(data.pos, topic, payload) end @@ -297,7 +297,7 @@ end function techage.send_single(number, topic, payload) if Number2Pos[number] and Number2Pos[number].name then local data = Number2Pos[number] - if NodeDef[data.name] and NodeDef[data.name].on_recv_message then + if data.pos and NodeDef[data.name] and NodeDef[data.name].on_recv_message then return NodeDef[data.name].on_recv_message(data.pos, topic, payload) end end diff --git a/basis/consumer.lua b/basis/consumer.lua index 53005c6..a5358a3 100644 --- a/basis/consumer.lua +++ b/basis/consumer.lua @@ -61,6 +61,10 @@ local function node_timer(pos, elapsed) elseif state ~= techage.NOPOWER and got < crd.power_consumption then crd.State:nopower(pos, mem) end + elseif state == techage.STANDBY then + if not power_available(pos, 0) then + crd.State:nopower(pos, mem) + end end -- call the secondary timer routine with the requested frequency local res diff --git a/basis/guide.lua b/basis/guide.lua index d86d3f8..5e4eadc 100644 --- a/basis/guide.lua +++ b/basis/guide.lua @@ -42,12 +42,13 @@ end local function formspec_help(idx) local bttn + local box = "box[7.5,0.9;1,1.1;#BBBBBB]" if ItemNames[idx] == "-" then bttn = "" elseif ItemNames[idx] == "plan" then bttn = "button[7.6,1;1,1;plan;"..S("Plan").."]" else - bttn = "item_image[7.6,1;1,1;"..ItemNames[idx].."]" + bttn = box.."item_image[7.6,1;1,1;"..ItemNames[idx].."]" end return "size[9,9]".. default.gui_bg.. @@ -56,7 +57,8 @@ local function formspec_help(idx) "item_image[7.6,0;1,1;techage:construction_board]".. bttn.. "table[0.1,0;7,3;page;"..NamesAsStr..";"..idx.."]".. - "textarea[0.3,3.7;9,6.2;help;"..S("Help")..":;"..Recipes[idx].."]" + "textarea[0.3,3.7;9,6.2;help;"..S("Help")..":;"..Recipes[idx].."]".. + "box[0,3.7;8.775,5.25;#000000]" end local function formspec_plan(idx) diff --git a/basis/junction.lua b/basis/junction.lua deleted file mode 100644 index d7a3db4..0000000 --- a/basis/junction.lua +++ /dev/null @@ -1,86 +0,0 @@ ---[[ - - TechAge - ======= - - Copyright (C) 2019 Joachim Stolberg - - LGPLv2.1+ - See LICENSE.txt for more information - - Junction for power distribution - -]]-- - --- for lazy programmers -local S = function(pos) if pos then return minetest.pos_to_string(pos) end end -local P = minetest.string_to_pos -local M = minetest.get_meta - - -local function bit(p) - return 2 ^ (p - 1) -- 1-based indexing -end - --- Typical call: if hasbit(x, bit(3)) then ... -local function hasbit(x, p) - return x % (p + p) >= p -end - -local function setbit(x, p) - return hasbit(x, p) and x or x + p -end - -local function get_node_box(val, size, boxes) - local fixed = {{-size, -size, -size, size, size, size}} - for i = 1,6 do - if hasbit(val, bit(i)) then - for _,box in ipairs(boxes[i]) do - table.insert(fixed, box) - end - end - end - return { - type = "fixed", - fixed = fixed, - } -end - --- 'size' is the size of the junction cube without any connection, e.g. 1/8 --- 'boxes' is a table with 6 table elements for the 6 possible connection arms --- 'network' is the tubelib2 instance --- 'node' is the node definition with tiles, callback functions, and so on -function techage.register_junction(name, size, boxes, network, node) - for idx = 0,63 do - local ndef = table.copy(node) - if idx == 0 then - ndef.groups.not_in_creative_inventory = 0 - else - ndef.groups.not_in_creative_inventory = 1 - end - ndef.groups.techage_trowel = 1 - ndef.drawtype = "nodebox" - ndef.node_box = get_node_box(idx, size, boxes) - ndef.paramtype2 = "facedir" - ndef.on_rotate = screwdriver.disallow - ndef.paramtype = "light" - ndef.sunlight_propagates = true - ndef.is_ground_content = false - ndef.drop = name.."0" - -- use the original techage table!!! - ndef.techage = node.techage - minetest.register_node(name..idx, ndef) - network:add_secondary_node_names({name..idx}) - end -end - -function techage.junction_type(conn) - local val = 0 - for idx = 1,6 do - if conn[idx] then - val = setbit(val, bit(idx)) - end - end - return val -end - diff --git a/intllib.sh b/intllib.sh deleted file mode 100755 index 5b9294f..0000000 --- a/intllib.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -../intllib/tools/xgettext.sh ./tube_api.lua ./internal1.lua ./internal2.lua \ No newline at end of file diff --git a/lamps/lib.lua b/lamps/lib.lua index 7857b2e..1e2046a 100644 --- a/lamps/lib.lua +++ b/lamps/lib.lua @@ -90,9 +90,11 @@ end function techage.register_lamp(basename, ndef_off, ndef_on) ndef_off.on_construct = tubelib2.init_mem ndef_off.on_rightclick = lamp_on_rightclick - ndef_off.on_rotate = on_rotate + if not ndef_off.on_rotate then + ndef_off.on_place = on_place + end + ndef_off.on_rotate = ndef_off.on_rotate or on_rotate ndef_off.on_timer = node_timer - ndef_off.on_place = on_place ndef_off.paramtype = "light" ndef_off.light_source = 0 ndef_off.sunlight_propagates = true @@ -103,7 +105,7 @@ function techage.register_lamp(basename, ndef_off, ndef_on) ndef_on.on_construct = tubelib2.init_mem ndef_on.on_rightclick = lamp_on_rightclick - ndef_on.on_rotate = on_rotate + ndef_on.on_rotate = ndef_on.on_rotate or on_rotate ndef_on.on_timer = node_timer ndef_on.paramtype = "light" ndef_on.light_source = minetest.LIGHT_MAX diff --git a/lamps/streetlamp.lua b/lamps/streetlamp.lua index a986a2e..9025e09 100644 --- a/lamps/streetlamp.lua +++ b/lamps/streetlamp.lua @@ -39,6 +39,8 @@ techage.register_lamp("techage:streetlamp", { type = "fixed", fixed = {-8/16, -8/16, -8/16, 8/16, 8/16, 8/16}, }, + on_rotate = screwdriver.disallow, + conn_sides = {"U", "D"}, },{ description = "TA Street Lamp", tiles = { @@ -60,6 +62,7 @@ techage.register_lamp("techage:streetlamp", { type = "fixed", fixed = {-8/16, -8/16, -8/16, 8/16, 8/16, 8/16}, }, + on_rotate = screwdriver.disallow, }) minetest.register_craft({ diff --git a/oil/drillbox.lua b/oil/drillbox.lua index 265c743..77d1e57 100644 --- a/oil/drillbox.lua +++ b/oil/drillbox.lua @@ -25,7 +25,7 @@ local I,_ = dofile(MP.."/intllib.lua") local STANDBY_TICKS = 4 local COUNTDOWN_TICKS = 6 -local CYCLE_TIME = 8 +local CYCLE_TIME = 16 local formspec0 = "size[5,4]".. default.gui_bg.. @@ -306,7 +306,7 @@ derrick when you press the button. 5: Press the start button 6: Remove the excavated material with Tubes/Pusher 7: The drill stops when oil is found - (drill speed is 1m/8s) + (drill speed is 1m/16s) 8: Replace the drill with the Pumpjack]]), node_name_ta3) minetest.register_lbm({ diff --git a/textures/techage_appl_hopper_top.png b/textures/techage_appl_hopper_top.png index e940938c72290de56d924a5c17afa91c8065fa85..97ce3c2aaba5ce873f4559e7959790461ec5c07b 100644 GIT binary patch delta 187 zcmbQpbeeI3L_HHT0|Nt}$fR^2#ggvm>&U>cv7h@-A}f&3SRCZ;#IWw1%u67Lv%n*= zn1O*?7=#%aX3dcR2?qFtxcX!kDyb-0+gVSVaC!$wTS<^#FoVOh8)-m}ou`Xqh{WaO zgauM3qPAwK&Jf(1bv4L9Ip^xCl?iSyOjd<16krojkYF-k`9og| z^oLYyr7vTmk0SsAAOPl`U_bVnx9r+niqLgl>2(LBh%5P!BVcA?W)p-IdDacR0~!cx zw`Q%dRntqLsXCrv00e*=M*zSOjcX3H==nmM69C3dLI4DSG^UidtWIt^0*fPBw3DWK nj~y@TqSB@K7X&~6{2t&20