some bugfixes
This commit is contained in:
parent
f4132aba02
commit
d7ecb4818e
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
../intllib/tools/xgettext.sh ./tube_api.lua ./internal1.lua ./internal2.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
|
||||
|
@ -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({
|
||||
|
@ -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({
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 203 B |
Loading…
Reference in New Issue
Block a user