built on 05/03/2023 11:54:37

This commit is contained in:
Joachim Stolberg 2023-03-05 11:54:37 +01:00
parent c84701ecc8
commit f3478e3269
77 changed files with 1175 additions and 534 deletions

View File

@ -46,7 +46,7 @@ local function set_player_privs(player)
meta:set_int("player_physics_locked", 1)
if meta and physics then
-- store the player privs default values
meta:set_int("autobahn_speed", physics.speed)
meta:set_float("autobahn_speed", physics.speed)
-- set operator privs
meta:set_int("autobahn_isactive", 1)
physics.speed = 3.5
@ -67,7 +67,7 @@ local function reset_player_privs(player)
if meta and physics then
-- restore the player privs default values
meta:set_int("autobahn_isactive", 0)
physics.speed = meta:get_int("autobahn_speed")
physics.speed = meta:get_float("autobahn_speed")
if physics.speed == 0 then physics.speed = 1 end
-- delete stored default values
meta:set_string("autobahn_speed", "")

View File

@ -43,7 +43,7 @@ The mod features are:
- Extra Minecart privs for rail workers
- Ingame documentation (German and English), based on the mod "doc"
- API to register carts from other mods
- chat command '/mycart <num>' to output cart state and location
- chat command `/mycart <num>` to output cart state and location
- Command interface for Techage (Lua and ICTA) and for Beduino Controllers
@ -74,50 +74,20 @@ Introduction
at least every 16 nodes/meters)
9. Place a Minecart in front of the buffer and check whether it starts after the
configured time
10. Check the cart state via the chat command: /mycart <num>
'<num>' is the cart number, or get a list of carts with /mycart
10. Check the cart state via the chat command: `/mycart <num>`
`<num>` is the cart number, or get a list of carts with `/mycart`
11. Drop items into the Minecart and punch the cart to start it, or "sneak+click" the
Minecart to get cart and items back
12. Dig the cart with 'sneak+click' (as usual). The items will be drop down.
13. To retrieve lost carts, use the chat command: /stopcart <num>
Hopper
------
![hopper](https://github.com/joe7575/minecart/blob/master/hopper.png)
The Hopper is used to load/unload Minecarts.
The Hopper can pull and push items into/out off chests and can drop/pick up items
to/from Minecarts. To unload a Minecart place the hopper below the rail.
To load the Minecart, place the hopper right next to the Minecart.
Cart Pusher
-----------
## Manual
Used to push a cart if the cart does not stop directly at a buffer.
The block has to be placed below the rail.
see [Wiki](https://github.com/joe7575/minecart/wiki)
Cart Speed / Speed Limit Signs
------------------------------
As before, the speed of the carts is also influenced by power rails.
Brake rails are irrelevant, the cart does not brake here.
The maximum speed is 8 m/s. This assumes a ratio of power rails
to normal rails of 1 to 4 on a flat section of rail. A rail section is a
series of rail nodes without a change of direction. After every curve / kink,
the speed for the next section of the route is newly determined,
taking into account the swing of the cart. This means that a cart can
roll over short rail sections without power rails.
In order to additionally brake the cart at certain points
(at switches or in front of a buffer), speed limit signs can be placed
on the track. With these signs the speed can be reduced to 4, 2, or 1 m / s.
The "No speed limit" sign can be used to remove the speed limit.
The speed limit signs must be placed next to the track so that they can
be read from the cart. This allows different speeds in each direction of travel.
## Command Interface
@ -159,14 +129,6 @@ The Cart Terminal has a Beduino command interface with the commands:
Migration to v2
---------------
The way how carts are monitored and the cart speed is calculated has changed.
Therefore, it is necessary that all carts are repositioned and the
recording is repeated.
Rails and buffers are not affected and can be kept unchanged.
History
-------
@ -194,3 +156,4 @@ History
2021-09-02 V2.01 Chat command /stopcart added
2021-10-18 V2.02 Cart reproduction bug fixed
2023-01-04 V2.03 Techage and Beduino command interface added
2023-02-05 V2.04 New API functions added, EOL blanks removed

View File

@ -46,3 +46,38 @@ function minecart.punch_cart(pos, param2, radius, punch_dir)
return true
end
end
--------------------------------------------------------------------------------------------
-- API functions for other mods to add/remove carts
--------------------------------------------------------------------------------------------
function minecart.is_cart(name)
return minecart.tNodeNames[name] ~= nil
end
-- Remove a cart, available as node
function minecart.remove_cart(pos)
local node = minecart.get_node_lvm(pos)
local cargo, owner, userID = minecart.remove_nodecart(pos, node)
minecart.monitoring_remove_cart(owner, userID)
local cartdef = {cargo = cargo, owner = owner, userID = userID}
return cartdef
end
-- Place and start the cart
function minecart.place_and_start_cart(pos, node, cartdef, player)
local name = minecart.get_node_lvm(pos).name
if minecart.is_rail(pos, name) or minecart.is_cart(name) then
local vel = {x = 0, y = 0, z = 0}
local entity_name = minecart.tNodeNames[node.name]
local obj = minecart.add_entitycart(pos, node.name, entity_name, vel,
cartdef.cargo, cartdef.owner, cartdef.userID)
local entity = obj:get_luaentity()
minecart.monitoring_add_cart(cartdef.owner, cartdef.userID, pos, node.name, entity_name)
if player then
minecart.manage_attachment(player, entity, true)
end
minecart.start_entitycart(entity, pos, 0)
else
minecart.add_nodecart(pos, node.name, node.param2, cartdef.cargo, cartdef.owner, cartdef.userID, true)
end
end

View File

@ -254,10 +254,12 @@ function minecart.register_cart_names(node_name, entity_name, cart_type)
minecart.tCartTypes[node_name] = cart_type
end
function minecart.add_nodecart(pos, node_name, param2, cargo, owner, userID)
function minecart.add_nodecart(pos, node_name, param2, cargo, owner, userID, force)
if pos and node_name and param2 and cargo and owner and userID then
local pos2
if not minecart.is_rail(pos) then
if force then
pos2 = pos
elseif not minecart.is_rail(pos) then
pos2 = minetest.find_node_near(pos, 1, minecart.lRails)
if not pos2 or not minecart.is_rail(pos2) then
-- If no rail is around, use an available cart as new search center
@ -273,10 +275,10 @@ function minecart.add_nodecart(pos, node_name, param2, cargo, owner, userID)
if pos2 then
local node = minetest.get_node(pos2)
local ndef = minetest.registered_nodes[node_name]
local rail = node.name
minetest.swap_node(pos2, {name = node_name, param2 = param2})
local meta = M(pos2)
meta:set_string("removed_rail", rail)
meta:set_string("removed_rail", node.name)
meta:set_string("removed_rail_param2", node.param2)
meta:set_string("owner", owner)
meta:set_int("userID", userID)
meta:set_string("infotext", owner .. ": " .. userID)
@ -329,21 +331,28 @@ function minecart.start_entitycart(self, pos, facedir)
end
end
function minecart.remove_nodecart(pos)
local node = minetest.get_node(pos)
function minecart.remove_nodecart(pos, node)
node = node or minetest.get_node(pos)
local ndef = minetest.registered_nodes[node.name]
local meta = M(pos)
local rail = meta:get_string("removed_rail")
local param2 = meta:get_int("removed_rail_param2")
if rail == "" then rail = "air" end
local userID = meta:get_int("userID")
local owner = meta:get_string("owner")
meta:set_string("infotext", "")
meta:set_string("formspec", "")
local cargo = ndef.get_cargo and ndef.get_cargo(pos) or {}
minetest.swap_node(pos, {name = rail})
minetest.swap_node(pos, {name = rail, param2 = param2})
return cargo, owner, userID
end
function minecart.is_usable_cart(pos, node)
-- cart needs a rail bwelow
local rail = M(pos):get_string("removed_rail")
return minecart.is_rail(pos, rail)
end
function minecart.node_to_entity(pos, node_name, entity_name)
-- Remove node
local cargo, owner, userID = minecart.remove_nodecart(pos)

View File

@ -25,11 +25,12 @@ local player_ctrl = minecart.player_ctrl
local tEntityNames = minecart.tEntityNames
local function stop_cart(self, cart_pos)
local player
self.is_running = false
self.arrival_time = 0
if self.driver then
local player = minetest.get_player_by_name(self.driver)
player = minetest.get_player_by_name(self.driver)
if player then
minecart.stop_recording(self, cart_pos)
minecart.manage_attachment(player, self, false)
@ -40,6 +41,9 @@ local function stop_cart(self, cart_pos)
minecart.delete_cart_waypoint(cart_pos)
end
minecart.entity_to_node(cart_pos, self)
if player then
player:set_pos(cart_pos)
end
end
local function get_ctrl(self, pos)

View File

@ -13,7 +13,7 @@
minecart = {}
-- Version for compatibility checks, see readme.md/history
minecart.version = 2.03
minecart.version = 2.04
minecart.hopper_enabled = minetest.settings:get_bool("minecart_hopper_enabled") ~= false
minecart.teleport_enabled = minetest.settings:get_bool("minecart_teleport_enabled") == true

View File

@ -3,6 +3,7 @@ Station name=Stationsname
Waiting time/sec=Wartezeit/s
connected to=verbunden mit
Not connected!=Nicht verbunden!
Minecart Railway Buffer=Minecart Prellbock
Summary=Zusammenfassung
1. Place your rails and build a route with two endpoints. Junctions are allowed as long as each route has its own start and endpoint.=1. Baue eine Schienenstrecke mit zwei Enden. Kreuzungen sind zulässig, solange jede Route ihre eigenen Start- und Endpunkte hat.
2. Place a Railway Buffer at both endpoints (buffers are always needed, they store the route and timing information).=2. Platziere einen Prellbock an beide Schienenenden (Prellböcke sind zwingend notwendig, sie speichern die Routen- und Zeit-Informationen).
@ -27,21 +28,20 @@ Minecart Cart=Wagen
Minecart Speed Signs=Geschwindigkeitsbegrenzungszeichen
If several carts are running on one route,@nit can happen that a buffer position is already occupied and one cart therefore stops earlier.@nIn this case, the cart pusher is used to push the cart towards the buffer again.@nThis block must be placed under the rail at a distance of 2 m in front of the buffer.=Wenn mehrere Wagen auf einer Route fahren, kann es vorkommen,@ndass eine Prellbock Position bereits belegt ist und ein Wagen daher früher anhält.@nDer Cart Anschieber dient in diesem Fall dazu, die Wagen wieder in Richtung Prellbock anzuschieben.@nDieser Block muss unter der Schiene mit 2 m Abstand vor dem Prellbock platziert werden.
Limit the cart speed with speed limit signs.@n@nAs before, the speed of the carts is also influenced by power rails.@nBrake rails are irrelevant, the cart does not brake here.@nThe maximum speed is 8 m/s. This assumes a ratio of power rails@nto normal rails of 1 to 4 on a flat section of rail. A rail section is a@nseries of rail nodes without a change of direction. After every curve / kink,@nthe speed for the next section of the route is newly determined,@ntaking into account the swing of the cart. This means that a cart can@nroll over short rail sections without power rails.@n@nIn order to additionally brake the cart at certain points@n(at switches or in front of a buffer), speed limit signs can be placed@non the track. With these signs the speed can be reduced to 4, 2, or 1 m / s.@nThe "No speed limit" sign can be used to remove the speed limit.@n@nThe speed limit signs must be placed next to the track so that they can@nbe read from the cart. This allows different speeds in each direction of travel.=Begrenze die Geschwindigkeit der Wagen mit Geschwindigkeitsbegrenzungszeichen@n@nDie Geschwindigkeit der Carts wird wie bisher auch über "power rails" beeinflusst. "Brake rails" sind ohne Bedeutung, das Cart bremst hier nicht. Die maximale Geschwindigkeit beträgt 8 m/s. Dies setzt eine Verhältnis von "power rails" zu "normal rails" von 1 zu 4 auf einem ebenen Streckenabschnitt voraus. Ein Streckenabschnitt ist dabei ein Reihe von Schienenblöcken ohne Richtungsänderung. Nach jeder Kurve/Knick wird die Geschwindigkeit für den nächsten Streckenabschnitt neu bestimmt, wobei hier der Schwung des Carts mit berücksichtigt wird. So kann ein Cart auch über kurze Streckenabschnitt ohne "power rails" rollen.@n@nUm das Cart zusätzlich an bestimmten Stellen abzubremsen (an Weichen oder vor einen Puffer), können Geschwindigkeitsbegrenzungszeichen an der Strecke platziert werden. Durch diese Zeichen kann die Geschwindigkeit auf 4, 2, oder 1 m/s reduziert werden. Durch das Aufhebungszeichen kann die Geschwindigkeitsbegrenzung wieder aufgehoben werden.@n@nDie Geschwindigkeitsbegrenzungszeichen müssen so neben die Strecke platziert werden, dass sie vom Cart ablesbar sind. Dies erlaubt damit unterschiedliche Geschwindigkeiten pro Fahrtrichtung.
Minecart Railway Buffer=Minecart Prellbock
Minecart Hopper=Minecart Hopper
Minecart Landmark=Minecart Meilenstein
Cart Pusher=Wagen Anschieber
Minecart (Sneak+Click to pick up)=Minecart (Shift+Klick zum Entfernen des Carts)
Output cart state and position, or a list of carts, if no cart number is given.=Gibt Status und Position des Wagens, oder eine Liste aller Wagen aus, wenn keine Wagennummer angegeben ist.
List of carts=Liste aller Wagen
Stop amd return a missing/running cart.=Stoppe und hole einen vermissten Wagen zurück.
Stop and return/drop a missing/running cart.=Stoppe und hole einen vermissten Wagen zurück.
Cart=Wagen
stopped=gestoppt
dropped=fallen gelassen
is not existing!=existiert nicht!
Enter cart number=Gebe Cart Nummer ein
Save=Speichern
[minecart] Area is protected!=[minecart] Bereich ist geschützt!
Allow to dig/place rails in Minecart Landmark areas=Erlaubt dir, Schienen in Meilensteinbereichen zu setzen/zu entfernen
Minecart Landmark=Minecart Meilenstein
Cart Pusher=Wagen Anschieber
left=links
right=rechts
straight=geradeaus
@ -49,6 +49,7 @@ Recording=Aufzeichnung
speed=Tempo
next junction=nächste Weiche
Travel time=Fahrzeit
[minecart] Recording canceled!=
[minecart] Route stored!=[minecart] Strecke gespeichert
[minecart] Speed @= %u m/s, Time @= %u s, Route length @= %u m=[minecart] Geschw. @= %u m/s, Zeit @= %u s, Routenlänge @= %u m
[minecart] Your route is too short to record!=[minecart] Deine Strecke ist zu kurz für eine Aufzeichnung!
@ -58,3 +59,9 @@ Speed "4"=Tempo "4"
No speed limit=Keine Geschwindigkeitsbegrenzung
Cart List=Cart Liste
Cart Terminal=Cart Terminal
##### not used anymore #####
Stop amd return a missing/running cart.=Stoppe und hole einen vermissten Wagen zurück.
stopped=gestoppt

View File

@ -3,6 +3,7 @@ Station name=
Waiting time/sec=
connected to=
Not connected!=
Minecart Railway Buffer=
Summary=
1. Place your rails and build a route with two endpoints. Junctions are allowed as long as each route has its own start and endpoint.=
2. Place a Railway Buffer at both endpoints (buffers are always needed, they store the route and timing information).=
@ -27,21 +28,20 @@ Minecart Cart=
Minecart Speed Signs=
If several carts are running on one route,@nit can happen that a buffer position is already occupied and one cart therefore stops earlier.@nIn this case, the cart pusher is used to push the cart towards the buffer again.@nThis block must be placed under the rail at a distance of 2 m in front of the buffer.=
Limit the cart speed with speed limit signs.@n@nAs before, the speed of the carts is also influenced by power rails.@nBrake rails are irrelevant, the cart does not brake here.@nThe maximum speed is 8 m/s. This assumes a ratio of power rails@nto normal rails of 1 to 4 on a flat section of rail. A rail section is a@nseries of rail nodes without a change of direction. After every curve / kink,@nthe speed for the next section of the route is newly determined,@ntaking into account the swing of the cart. This means that a cart can@nroll over short rail sections without power rails.@n@nIn order to additionally brake the cart at certain points@n(at switches or in front of a buffer), speed limit signs can be placed@non the track. With these signs the speed can be reduced to 4, 2, or 1 m / s.@nThe "No speed limit" sign can be used to remove the speed limit.@n@nThe speed limit signs must be placed next to the track so that they can@nbe read from the cart. This allows different speeds in each direction of travel.=
Minecart Railway Buffer=
Minecart Hopper=
Minecart Landmark=
Cart Pusher=
Minecart (Sneak+Click to pick up)=
Output cart state and position, or a list of carts, if no cart number is given.=
List of carts=
Stop amd return a missing/running cart.=
Stop and return/drop a missing/running cart.=
Cart=
stopped=
dropped=
is not existing!=
Enter cart number=
Save=
[minecart] Area is protected!=
Allow to dig/place rails in Minecart Landmark areas=
Minecart Landmark=
Cart Pusher=
left=
right=
straight=
@ -49,6 +49,7 @@ Recording=
speed=
next junction=
Travel time=
[minecart] Recording canceled!=
[minecart] Route stored!=
[minecart] Speed @= %u m/s, Time @= %u s, Route length @= %u m=
[minecart] Your route is too short to record!=

View File

@ -57,8 +57,10 @@ minetest.register_node("minecart:cart", {
if clicker and clicker:is_player() then
if M(pos):get_int("userID") ~= 0 then
-- enter the cart
if minecart.is_usable_cart(pos, node) then
local object = minecart.node_to_entity(pos, "minecart:cart", "minecart:cart_entity")
minecart.manage_attachment(clicker, object:get_luaentity(), true)
end
else
minecart.show_formspec(pos, clicker)
end

View File

@ -28,6 +28,19 @@ local function is_fuel(stack)
return CacheForFuelNodeNames[name]
end
------------------------------------------------------------------------------
-- Signs Bot
------------------------------------------------------------------------------
minecart.register_inventory({"signs_bot:box"}, {
put = {
listname = "main",
},
take = {
listname = "main",
},
})
------------------------------------------------------------------------------
-- default
------------------------------------------------------------------------------

View File

@ -108,14 +108,13 @@ end
-- Start the node cart (or dig by shift+leftclick)
function minecart.on_nodecart_punch(pos, node, puncher, pointed_thing)
--print("on_nodecart_punch")
local owner = M(pos):get_string("owner")
local userID = M(pos):get_int("userID")
local rail = M(pos):get_string("removed_rail")
if minecart.is_owner(puncher, owner) then
if puncher:get_player_control().sneak then
if puncher:get_player_control().sneak or not minecart.is_rail(pos, rail) then
local ndef = minetest.registered_nodes[node.name]
if not ndef.has_cargo or not ndef.has_cargo(pos) then
minecart.remove_nodecart(pos)
local _, owner, userID = minecart.remove_nodecart(pos, node)
minecart.add_node_to_player_inventory(pos, puncher, node.name)
minecart.monitoring_remove_cart(owner, userID)
end

View File

@ -3,7 +3,7 @@
Minecart
========
Copyright (C) 2019-2021 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
MIT
See license.txt for more information
@ -95,8 +95,10 @@ minetest.register_node("minecart:landmark", {
minecart.set_land_marker(pos, RANGE, 20)
end,
paramtype2 = "facedir",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
use_texture_alpha = minecart.CLIP,
groups = {cracky = 3, stone = 1},
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
@ -135,7 +137,10 @@ minetest.register_node("minecart:ballast_slope", {
type = "fixed",
fixed = {-8/16, -8/16, -8/16, 8/16, 8/16, 8/16},
},
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
use_texture_alpha = minecart.CLIP,
groups = {crumbly = 1, cracky = 3},
sounds = default.node_sound_stone_defaults(),
})
@ -157,7 +162,10 @@ minetest.register_node("minecart:ballast_ramp", {
type = "fixed",
fixed = {-8/16, -8/16, -8/16, 8/16, 8/16, 8/16},
},
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
use_texture_alpha = minecart.CLIP,
groups = {crumbly = 1, cracky = 3},
sounds = default.node_sound_stone_defaults(),
})

View File

@ -572,8 +572,8 @@ function minecart.delete_signs_waypoint(pos)
end
end
function minecart.is_rail(pos)
return tRails[get_node_lvm(pos).name] ~= nil
function minecart.is_rail(pos, name)
return tRails[name or get_node_lvm(pos).name] ~= nil
end
-- To register node cart names

View File

@ -80,7 +80,7 @@ All this testing nodes can be enabled via mod settings `networks_test_enabled =
### License
Copyright (C) 2021-2022 Joachim Stolberg
Copyright (C) 2021-2023 Joachim Stolberg
Code: Licensed under the GNU AGPL version 3 or later. See LICENSE.txt
Textures: CC BY-SA 3.0
@ -131,3 +131,6 @@ Required: tubelib2
**2022-09-10 V0.12**
- New API function `networks.liquid.get_liquids` added
**2023-02-19 V0.13**
- New API function `networks.power.get_storage_percent` added

View File

@ -3,7 +3,7 @@
Networks
========
Copyright (C) 2021 Joachim Stolberg
Copyright (C) 2021-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -13,7 +13,7 @@
networks = {}
-- Version for compatibility checks, see readme.md/history
networks.version = 0.12
networks.version = 0.13
if not minetest.global_exists("tubelib2") or tubelib2.version < 2.2 then
minetest.log("error", "[networks] Networks requires tubelib2 version 2.2 or newer!")

View File

@ -190,8 +190,9 @@ function networks.liquid.srv_put(nvm, name, amount, capa)
assert(capa and capa > 0)
amount = math.floor((amount or 0) + 0.5)
nvm.liquid = nvm.liquid or {}
nvm.liquid.amount = nvm.liquid.amount or 0
if not nvm.liquid.name then
if nvm.liquid.amount == 0 or not nvm.liquid.name then
nvm.liquid.name = name
nvm.liquid.amount = amount
return 0

View File

@ -3,7 +3,7 @@
Networks
========
Copyright (C) 2021 Joachim Stolberg
Copyright (C) 2021-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -439,3 +439,13 @@ function networks.power.get_network_data(pos, tlib2, outdir)
end
return DEFAULT_DATA
end
function networks.power.get_storage_percent(pos, tlib2, outdir)
assert(outdir)
local netID = networks.determine_netID(pos, tlib2, outdir)
if netID then
local pwr = Power[netID] or get_power_data(pos, tlib2, outdir, netID)
return (pwr.curr_load or 0) * 100 / (pwr.max_capa or 1)
end
return 0
end

View File

@ -85,6 +85,7 @@ For all Inventory commands applies: If the bot inventory stack specified by `<sl
dig_below <slot> - dig block under the robot
dig_above <slot> - dig block above the robot
rotate_item <lvl> <steps> - rotate a block in front of the robot
set_param2 <lvl> <param2> - set param2 of the block in front of the robot
place_sign <slot> - set sign
place_sign_behind <slot> - put a sign behind the bot
dig_sign <slot> - remove the sign

View File

@ -395,6 +395,42 @@ signs_bot.register_botcommand("rotate_item", {
end,
})
local function set_param2(base_pos, robot_pos, bot_param2, route, level, block_param2)
local pos1 = lib.dest_pos(robot_pos, bot_param2, route)
pos1.y = pos1.y + level
local node = tubelib2.get_node_lvm(pos1)
if not lib.not_protected(base_pos, pos1) then
return signs_bot.ERROR, S("Error: Position protected")
end
if lib.is_simple_node(node) then
if block_param2 then
minetest.swap_node(pos1, {name=node.name, param2=block_param2})
end
end
return signs_bot.DONE
end
signs_bot.register_botcommand("set_param2", {
mod = "place",
params = "<lvl> <param2>",
num_param = 2,
description = S("Set param2 of the block in front of the robot\n"..
"<lvl> is one of: -1 0 +1\n"..
"<param2> is: 0 - 23"),
check = function(lvl, param2)
param2 = tonumber(param2) or 0
if not param2 or param2 < 0 or param2 > 23 then
return false
end
return tValidLevels[lvl] ~= nil
end,
cmnd = function(base_pos, mem, lvl, param2)
local level = tValidLevels[lvl]
param2 = tonumber(param2) or 0
return set_param2(base_pos, mem.robot_pos, mem.robot_param2, {0}, level, param2)
end,
})
-- Simplified torch which can be placed w/o a fake player
minetest.register_node("signs_bot:torch", {
description = S("Bot torch"),

View File

@ -27,7 +27,7 @@ In the worst case, the server crashes.**
### License
Copyright (C) 2019-2022 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
Code: Licensed under the GNU AGPL version 3 or later. See LICENSE.txt
Textures: CC BY-SA 3.0
@ -89,6 +89,24 @@ Available worlds will be converted to 'lsqlite3', but there is no way back, so:
### History
**2023-03-05 V1.11**
- Reduce the number of necessary exp points for TA5 Hyperloop Chest,
TA5 Hyperloop Tank, and TA5 AI Chip II
- Fix possible kernel crashes with TA5 Hyperloop Chest and autocrafter
- Rework doorcontroller (menu changed)
- Increase tank cart storage size to 200 units
- Fix several paramtype/use_texture_alpha issues
- Add command 'load' to the TA4 power terminal
- Add beduino tank commands
- Fix power consumption bug for a stopped collider
- Fix electrolyzer formspec bug
- Add Rack and pinion node
- Expand ta4 sequencer wrench menu
- Accept mincart carts for the move controller
- movecontroller: Allow to move objects 'without' a move block
- Add empty_spool as fab output
- Fix doser goes blocked bug
**2023-02-04 V1.10**
- Improve flycontroller
- Remove handover for movecontroller

View File

@ -266,6 +266,9 @@ end
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if listname == "output" then
return 0
end
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
@ -285,6 +288,9 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
end
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
if listname == "output" then
return 0
end
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
@ -302,6 +308,9 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
end
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
if from_list == "output" or "to_list" == "output" then
return 0
end
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end

View File

@ -78,7 +78,8 @@ local function making(pos, crd, nvm, inv)
local rtype = RecipeType[crd.stage]
local recipe = recipes.get(nvm, rtype, owner)
local output = ItemStack(recipe.output.name .. " " .. recipe.output.num)
if inv:room_for_item("dst", output) then
local waste = recipe.waste and ItemStack(recipe.waste.name .. " " .. recipe.waste.num)
if inv:room_for_item("dst", output) and (not waste or inv:room_for_item("dst", waste)) then
for _,item in ipairs(recipe.input) do
local input = ItemStack(item.name.." "..item.num)
if not inv:contains_item("src", input) then
@ -91,6 +92,9 @@ local function making(pos, crd, nvm, inv)
inv:remove_item("src", input)
end
inv:add_item("dst", output)
if waste then
inv:add_item("dst", waste)
end
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
return
end

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2019-2022 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -22,6 +22,7 @@ local STACK_SIZE = 2000
local function gen_stack(inv, idx)
inv[idx] = {name = "", count = 0}
return inv[idx]
end
local function gen_inv(nvm)
@ -377,7 +378,7 @@ local function search_chest_in_front(pos, node)
pos1 = tubelib2.get_pos(pos1, dir)
cnt = cnt + 1
end
if node.name == "techage:ta4_chest" then
if node.name == "techage:ta4_chest" and node.param2 == param2 then
minetest.after(1, count_number_of_chests, pos1)
local nvm = techage.get_nvm(pos)
nvm.front_chest_pos = pos1

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2019-2022 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -19,7 +19,7 @@ local M = minetest.get_meta
local S = techage.S
local TA4_INV_SIZE = 32
local EX_POINTS = 20
local EX_POINTS = 15
local hyperloop = techage.hyperloop
local remote_pos = techage.hyperloop.remote_pos
@ -49,7 +49,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
end
shared_inv.before_inv_access(pos, listname)
local inv = minetest.get_inventory({type="node", pos=pos})
if inv:room_for_item(listname, stack) then
if inv and inv:room_for_item(listname, stack) then
return stack:get_count()
end
return 0
@ -61,7 +61,7 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
end
shared_inv.before_inv_access(pos, listname)
local inv = minetest.get_inventory({type="node", pos=pos})
if inv:contains_item(listname, stack) then
if inv and inv:contains_item(listname, stack) then
return stack:get_count()
end
return 0
@ -141,36 +141,64 @@ minetest.register_node("techage:ta5_hl_chest", {
techage.register_node({"techage:ta5_hl_chest"}, {
on_inv_request = function(pos, in_dir, access_type)
pos = remote_pos(pos)
if pos then
local meta = minetest.get_meta(pos)
if meta then
return meta:get_inventory(), "main"
end
end
end,
on_pull_item = function(pos, in_dir, num, item_name)
pos = remote_pos(pos)
if pos then
local meta = minetest.get_meta(pos)
if meta then
local inv = meta:get_inventory()
if inv then
return techage.get_items(pos, inv, "main", num)
end
end
end
return false
end,
on_push_item = function(pos, in_dir, stack)
if techage.hyperloop.is_paired(pos) then
pos = remote_pos(pos)
if pos then
local meta = minetest.get_meta(pos)
if meta then
local inv = meta:get_inventory()
if inv then
return techage.put_items(inv, "main", stack)
end
end
end
end
return false
end,
on_unpull_item = function(pos, in_dir, stack)
pos = remote_pos(pos)
if pos then
local meta = minetest.get_meta(pos)
if meta then
local inv = meta:get_inventory()
if inv then
return techage.put_items(inv, "main", stack)
end
end
end
return false
end,
on_recv_message = function(pos, src, topic, payload)
if topic == "state" then
pos = remote_pos(pos)
local meta = minetest.get_meta(pos)
if meta then
local inv = meta:get_inventory()
if inv then
return techage.get_inv_state(inv, "main")
end
end
return "error"
else
return "unsupported"
end
@ -178,8 +206,12 @@ techage.register_node({"techage:ta5_hl_chest"}, {
on_beduino_request_data = function(pos, src, topic, payload)
if topic == 131 then -- Chest State
local meta = minetest.get_meta(pos)
if meta then
local inv = meta:get_inventory()
if inv then
return 0, {techage.get_inv_state_num(inv, "main")}
end
end
else
return 2, ""
end

View File

@ -37,7 +37,8 @@ local function rotate(v, yaw)
return {x = v.x * cosyaw - v.z * sinyaw, y = v.y, z = v.x * sinyaw + v.z * cosyaw}
end
local function set_node(item)
-- playername is needed for carts, to attach the player to the cart entity
local function set_node(item, playername)
local dest_pos = item.dest_pos
local name = item.name or "air"
local param2 = item.param2 or 0
@ -49,12 +50,18 @@ local function set_node(item)
nvm.running = false
M(item.base_pos):set_string("status", S("Stopped"))
if ndef1 and ndef2 then
if ndef2.buildable_to then
if minecart.is_cart(name) and (minecart.is_rail(dest_pos, node.name) or minecart.is_cart(name)) then
local player = playername and minetest.get_player_by_name(playername)
minecart.place_and_start_cart(dest_pos, {name = name, param2 = param2}, item.cartdef, player)
return
elseif ndef2.buildable_to then
local meta = M(dest_pos)
if name ~= "techage:moveblock" then
minetest.set_node(dest_pos, {name=name, param2=param2})
meta:from_table(item.metadata or {})
meta:set_string("ta_move_block", "")
meta:set_int("ta_door_locked", 1)
end
return
end
local meta = M(dest_pos)
@ -63,9 +70,11 @@ local function set_node(item)
return
end
elseif ndef1 then
if name ~= "techage:moveblock" then
minetest.add_item(dest_pos, ItemStack(name))
end
end
end
-------------------------------------------------------------------------------
-- Entity monitoring
@ -294,7 +303,7 @@ local function detach_player(player)
end
-- Attach player/mob to given parent object (block)
local function attach_single_object(parent, obj, dir)
local function attach_single_object(parent, obj, distance)
local self = parent:get_luaentity()
local res = obj:get_attach()
if not res then -- not already attached
@ -305,20 +314,20 @@ local function attach_single_object(parent, obj, dir)
yaw = obj:get_rotation().y
end
-- store for later use
local offs = table.copy(dir)
local offs = table.copy(distance)
-- Calc entity rotation, which is relative to the parent's rotation
local rot = parent:get_rotation()
if self.param2 >= 20 then
dir = rotate(dir, 2 * math.pi - rot.y)
dir.y = -dir.y
dir.x = -dir.x
distance = rotate(distance, 2 * math.pi - rot.y)
distance.y = -distance.y
distance.x = -distance.x
rot.y = rot.y - yaw
elseif self.param2 < 4 then
dir = rotate(dir, 2 * math.pi - rot.y)
distance = rotate(distance, 2 * math.pi - rot.y)
rot.y = rot.y - yaw
end
dir = vector.multiply(dir, 29)
obj:set_attach(parent, "", dir, vector.multiply(rot, 180 / math.pi))
distance = vector.multiply(distance, 29)
obj:set_attach(parent, "", distance, vector.multiply(rot, 180 / math.pi))
obj:set_properties({visual_size = {x=2.9, y=2.9}})
if obj:is_player() then
if lock_player(obj) then
@ -332,19 +341,21 @@ end
-- Attach all objects around to the parent object
-- offs is the search/attach position offset
local function attach_objects(pos, offs, parent, yoffs)
-- distance (optional) is the attach distance to the center of the entity
local function attach_objects(pos, offs, parent, yoffs, distance)
local pos1 = vector.add(pos, offs)
for _, obj in pairs(minetest.get_objects_inside_radius(pos1, 0.9)) do
local dir = vector.subtract(obj:get_pos(), pos)
-- keep relative object position
distance = distance or vector.subtract(obj:get_pos(), pos)
local entity = obj:get_luaentity()
if entity then
local mod = entity.name:gmatch("(.-):")()
if techage.RegisteredMobsMods[mod] then
dir.y = dir.y + yoffs
attach_single_object(parent, obj, dir)
distance.y = distance.y + yoffs
attach_single_object(parent, obj, distance)
end
elseif obj:is_player() then
attach_single_object(parent, obj, dir)
attach_single_object(parent, obj, distance)
end
end
end
@ -380,10 +391,11 @@ end
local function entity_to_node(pos, obj)
local self = obj:get_luaentity()
if self and self.item then
local playername = self.players and self.players[1] and self.players[1].name
detach_objects(pos, self)
monitoring_del_entity(self.item)
minetest.after(0.1, obj.remove, obj)
set_node(self.item)
set_node(self.item, playername)
end
end
@ -392,9 +404,12 @@ end
-- * start_pos and dest_pos are entity positions
local function node_to_entity(base_pos, start_pos, dest_pos)
local meta = M(start_pos)
local node, metadata
local node, metadata, cartdef
if meta:contains("ta_move_block") then
node = techage.get_node_lvm(start_pos)
if minecart.is_cart(node.name) then
cartdef = minecart.remove_cart(start_pos)
elseif meta:contains("ta_move_block") then
-- Move-block stored as metadata
node = minetest.deserialize(meta:get_string("ta_move_block"))
metadata = {}
@ -424,6 +439,7 @@ local function node_to_entity(base_pos, start_pos, dest_pos)
metadata = metadata or {},
dest_pos = dest_pos,
base_pos = base_pos,
cartdef = cartdef,
}
monitoring_add_entity(self.item)
@ -432,7 +448,7 @@ local function node_to_entity(base_pos, start_pos, dest_pos)
self.entities = {}
-- Prepare for path walk
self.path_idx = 1
return obj
return obj, self.item.cartdef ~= nil
end
end
@ -536,6 +552,9 @@ local function is_valid_dest(pos)
if techage.is_air_like(node.name) then
return true
end
if minecart.is_rail(pos, node.name) or minecart.is_cart(node.name) then
return true
end
if not M(pos):contains("ta_move_block") then
return true
end
@ -544,8 +563,14 @@ end
local function is_simple_node(pos)
local node = techage.get_node_lvm(pos)
if not minecart.is_rail(pos, node.name) then
if node.name == "air" then
minetest.swap_node(pos, {name = "techage:moveblock", param2 = 0})
return true
end
local ndef = minetest.registered_nodes[node.name]
return not techage.is_air_like(node.name) and techage.can_dig_node(node.name, ndef)
return not techage.is_air_like(node.name) and techage.can_dig_node(node.name, ndef) or minecart.is_cart(node.name)
end
end
-- Move node from 'pos1' to the destination, calculated by means of 'lmove'
@ -562,9 +587,12 @@ local function move_node(pos, meta, pos1, lmove, max_speed, height)
if pos2 then
local dir = determine_dir(pos1, pos2)
local obj = node_to_entity(pos, pos1, dest_pos)
local obj, is_cart = node_to_entity(pos, pos1, dest_pos)
if obj then
if is_cart then
attach_objects(pos1, 0, obj, yoffs, {x = 0, y = -0.4, z = 0})
else
local offs = {x=0, y=height or 1, z=0}
attach_objects(pos1, offs, obj, yoffs)
if dir.y == 0 then
@ -572,6 +600,7 @@ local function move_node(pos, meta, pos1, lmove, max_speed, height)
attach_objects(pos1, dir, obj, yoffs)
end
end
end
local self = obj:get_luaentity()
self.path_idx = 2
self.lmove = lmove
@ -801,6 +830,21 @@ function flylib.remove_node(pos)
end
end
minetest.register_node("techage:moveblock", {
description = "Techage Move Block",
drawtype = "normal",
tiles = {"techage_invisible.png"},
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
floodable = true,
is_ground_content = false,
groups = {not_in_creative_inventory=1},
drop = "",
})
minetest.register_on_joinplayer(function(player)
unlock_player(player)
end)

View File

@ -184,7 +184,7 @@ function techage.hyperloop.remote_pos(pos)
local nvm = techage.get_nvm(pos)
if Stations:get(nvm.rmt_pos) then
if M(pos):contains("remote_name") then
return nvm.rmt_pos
return nvm.rmt_pos or pos
end
end
end

View File

@ -75,6 +75,24 @@ techage.liquid.recv_message = {
return "unsupported"
end
end,
on_beduino_request_data = function(pos, src, topic, payload)
local nvm = techage.get_nvm(pos)
if topic == 128 then
return 0, techage.get_node_lvm(pos).name
elseif topic == 134 then
local nvm = techage.get_nvm(pos)
nvm.liquid = nvm.liquid or {}
nvm.liquid.amount = nvm.liquid.amount or 0
if payload[1] == 1 then
local value = techage.power.percent(LQD(pos).capa, nvm.liquid.amount)
return 0, {math.floor(value + 0.5)}
else
return 0, {nvm.liquid.amount}
end
else
return 2, ""
end
end,
}
-- like: register_liquid("techage:ta3_barrel_oil", "techage:ta3_barrel_empty", 10, "techage:oil")

View File

@ -159,8 +159,10 @@ function techage.recipes.on_receive_fields(pos, formname, fields, player)
if not nvm.running then
if fields.next == ">>" then
nvm.recipe_idx = nvm.recipe_idx + 1
return true
elseif fields.priv == "<<" then
nvm.recipe_idx = nvm.recipe_idx - 1
return true
end
end
end

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2019-2022 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -31,7 +31,7 @@ end
function techage.shared_inv.node_timer(pos, elapsed)
local rmt_pos = remote_pos(pos)
if techage.is_activeformspec(pos) then
if rmt_pos and techage.is_activeformspec(pos) then
copy_inventory_list(rmt_pos, pos, "main")
return true
end
@ -42,9 +42,11 @@ end
function techage.shared_inv.before_inv_access(pos, listname)
if hyperloop.is_client(pos) then
local rmt_pos = remote_pos(pos)
if rmt_pos then
copy_inventory_list(rmt_pos, pos, listname)
return true
end
end
return false
end
@ -52,17 +54,21 @@ end
function techage.shared_inv.after_inv_access(pos, listname)
if hyperloop.is_client(pos) then
local rmt_pos = remote_pos(pos)
if rmt_pos then
copy_inventory_list(pos, rmt_pos, listname)
return true
end
end
return false
end
function techage.shared_inv.on_rightclick(pos, clicker, listname)
if hyperloop.is_client(pos) then
local rmt_pos = remote_pos(pos)
if rmt_pos then
copy_inventory_list(rmt_pos, pos, listname)
techage.set_activeformspec(pos, clicker)
minetest.get_node_timer(pos):start(2)
end
end
end

View File

@ -21,7 +21,7 @@ local Pipe = techage.LiquidPipe
local MP = minetest.get_modpath("minecart")
local liquid = networks.liquid
local CAPACITY = 100
local CAPACITY = 200
local function on_rightclick(pos, node, clicker)
if clicker and clicker:is_player() then

View File

@ -272,7 +272,11 @@ local function on_receive_fields(pos, formname, fields, player)
local nvm = techage.get_nvm(pos)
if not nvm.running then
recipes.on_receive_fields(pos, formname, fields, player)
if recipes.on_receive_fields(pos, formname, fields, player) then
local mem = techage.get_mem(pos)
mem.waste_leftover = nil
mem.output_leftover = nil
end
end
local mem = techage.get_mem(pos)
mem.dbg_cycles = 5

View File

@ -82,7 +82,7 @@ minetest.register_node("techage:turbine", {
"techage_filling_ta3.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_appl_open.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
"techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png^[transformFX",
"techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png",
},
@ -105,7 +105,7 @@ minetest.register_node("techage:turbine_on", {
"techage_filling_ta3.png^techage_appl_open.png^techage_frame_ta3.png",
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
{
image = "techage_filling4_ta3.png^techage_appl_turbine4.png^techage_frame4_ta3.png",
image = "techage_filling4_ta3.png^techage_appl_turbine4.png^techage_frame4_ta3.png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2019-2021 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -157,7 +157,7 @@ local function create_task(pos, task)
end
-- Call on_cyclic_check of all magents so that the magnets don't need a FLB.
local function magnet_on_cyclic_check(pos, nvm)
local function magnets_on_cyclic_check(pos, nvm)
local ndef = minetest.registered_nodes["techage:ta4_magnet"]
for idx,pos2 in ipairs(nvm.magnet_positions or {}) do
local res = ndef.on_cyclic_check(pos2)
@ -173,6 +173,29 @@ local function magnet_on_cyclic_check(pos, nvm)
return true
end
-- Turn off all magnets so that they don't consume power
local function magnets_turn_off(pos, nvm)
local ndef = minetest.registered_nodes["techage:ta4_magnet"]
for idx,pos2 in ipairs(nvm.magnet_positions or {}) do
ndef.on_turn_off(pos2)
end
end
local function cable_inlets_turn_on_off(pos, on)
local turn_on_off = function(pos, param2, item)
local pos2 = getpos(pos, param2, item.route, item.yoffs)
local node2 = minetest.get_node(pos2)
if item.name == node2.name then
local nvm = techage.get_nvm(pos2)
techage.power_inlet_turn_on_off(pos2, nvm, on)
end
end
local param2 = minetest.get_node(pos).param2
turn_on_off(pos, param2, Schedule[2])
turn_on_off(pos, param2, Schedule[3])
end
minetest.register_node("techage:ta4_detector_core", {
description = S("TA4 Collider Detector Core"),
tiles = {
@ -202,14 +225,15 @@ minetest.register_node("techage:ta4_detector_core", {
on_timer = function(pos, elapsed)
local nvm = techage.get_nvm(pos)
if not magnet_on_cyclic_check(pos, nvm) then
techage.del_laser(pos)
if nvm.running then
if not magnets_on_cyclic_check(pos, nvm) then
techage.del_laser(pos)
terminal_message(pos, "Detector stopped.")
magnets_turn_off(pos, nvm)
cable_inlets_turn_on_off(pos, false)
nvm.running = false
end
nvm.magnet_positions = nil
elseif nvm.running then
else
local res = check_state(pos)
if res == true then
experience_points(pos)
@ -219,6 +243,8 @@ minetest.register_node("techage:ta4_detector_core", {
end
elseif res == false then
techage.del_laser(pos)
magnets_turn_off(pos, nvm)
cable_inlets_turn_on_off(pos, false)
nvm.running = false
nvm.magnet_positions = nil
terminal_message(pos, "Detector stopped.")
@ -227,6 +253,7 @@ minetest.register_node("techage:ta4_detector_core", {
play_sound(pos)
end
end
end
return true
end,
@ -287,6 +314,7 @@ local function start_task(pos)
end
nvm.magnet_positions = t
techage.send_single(own_num, term_num, "append", "ok")
cable_inlets_turn_on_off(pos, true)
coroutine.yield()
techage.send_single(own_num, term_num, "text", "- Check magnets...")
@ -310,6 +338,7 @@ local function start_task(pos)
techage.send_single(own_num, term_num, "append", err .. "!!!")
nvm.magnet_positions = nil
nvm.locked = false
cable_inlets_turn_on_off(pos, false)
return
end
else
@ -323,12 +352,14 @@ local function start_task(pos)
techage.send_single(own_num, term_num, "append", err .. "!!!")
nvm.magnet_positions = nil
nvm.locked = false
cable_inlets_turn_on_off(pos, false)
return
end
else
techage.send_single(own_num, term_num, "append", "defect!!!")
nvm.magnet_positions = nil
nvm.locked = false
cable_inlets_turn_on_off(pos, false)
return
end
coroutine.yield()
@ -337,7 +368,7 @@ local function start_task(pos)
techage.send_single(own_num, term_num, "append", "ok")
coroutine.yield()
techage.send_single(own_num, term_num, "text", "Collider started.")
techage.send_single(own_num, term_num, "text", "Collider starting...")
nvm.ticks = 0
nvm.running = true
end
@ -372,6 +403,9 @@ techage.register_node({"techage:ta4_detector_core"}, {
nvm.running = false
techage.del_laser(pos)
nvm.locked = false
magnets_turn_off(pos, nvm)
cable_inlets_turn_on_off(pos, false)
nvm.magnet_positions = nil
return "Detector stopped."
elseif topic == "status" then
if nvm.running == true then

View File

@ -328,7 +328,11 @@ minetest.register_node("techage:ta4_collider_cable_inlet", {
on_timer = function(pos, elapsed)
local nvm = techage.get_nvm(pos)
if nvm.running then
nvm.consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
else
nvm.consumed = 0
end
return true
end,
@ -346,6 +350,11 @@ function techage.power_inlet_check(pos, node, meta, nvm)
return false, "no power"
end
-- Used by the detector to turn on/off the node
function techage.power_inlet_turn_on_off(pos, nvm, on)
nvm.running = on
end
power.register_nodes({"techage:ta4_collider_cable_inlet"}, Cable, "con", {"F"})
techage.register_node({"techage:ta4_collider_cable_inlet"}, {

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2019-2021 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -93,6 +93,8 @@ minetest.register_node("techage:ta4_magnet", {
},
wield_scale = {x = 0.8, y = 0.8, z = 0.8},
paramtype2 = "facedir",
paramtype = "light",
use_texture_alpha = techage.CLIP,
groups = {cracky = 1},
on_rotate = screwdriver.disallow,
is_ground_content = false,
@ -119,15 +121,23 @@ minetest.register_node("techage:ta4_magnet", {
nvm.consumed = power.consume_power(pos, Cable, 6, PWR_NEEDED)
if nvm.tube_damage then
nvm.tube_damage = nil
nvm.running = nil
return -1
elseif nvm.liquid.amount == CAPACITY and
nvm.liquid.name == "techage:isobutane" and
nvm.consumed == PWR_NEEDED then
nvm.running = true
return 0
end
nvm.running = nil
return -2
end,
on_turn_off = function(pos)
local nvm = techage.get_nvm(pos)
nvm.running = nil
end,
tubelib2_on_update2 = function(pos, outdir, tlib2, node)
if tlib2.tube_type == "vtube" then
local nvm = techage.get_nvm(pos)

View File

@ -21,7 +21,6 @@ techage.manual_DE.aTitel = {
"3,TA1 Schleusengriff / TA1 Sluice Handle",
"3,TA1 Apfelholzbrett / TA1 Apple Wood Board",
"3,TA1 Apfel Mühlbachbrett / TA1 Apple Millrace Board",
"2, ",
"2,Erze und Werkzeuge",
"3,Hammer",
"3,Kiessieb / Gravel Sieve",
@ -432,7 +431,6 @@ techage.manual_DE.aText = {
"\n"..
"\n"..
"\n",
"",
"TA1 hat seine eigenen Werkzeuge wie Hammer und Kiessieb\\, aber auch der Minecart Hopper kann genutzt werden.\n"..
"\n"..
"\n"..
@ -981,7 +979,7 @@ techage.manual_DE.aText = {
"\n",
"Der Tankwagen dient zum Transport von Flüssigkeiten. Es kann wie Tanks mit Pumpen gefüllt bzw. geleert werden. In beiden Fällen muss die gelbe Röhre von oben mit dem Tankwagen verbunden werden.\n"..
"\n"..
"In den Tankwagen passen 100 Einheiten.\n"..
"In den Tankwagen passen 200 Einheiten.\n"..
"\n"..
"\n"..
"\n",
@ -1726,7 +1724,6 @@ techage.manual_DE.aText = {
" - mit den Menü-Tasten \"Bewege A-B\" sowie \"Bewege B-A\" kann die Bewegung getestet werden\n"..
" - man kann auch durch Wände oder andere Blöcke fliegen\n"..
" - auch die Zielposition für die Blöcke kann belegt sein. Die Blöcke werden in diesem Falle \"unsichtbar\" gespeichert. Dies ist für Schiebetüren und ähnliches gedacht\n"..
" - Über das Gabelschlüssel-Menü kann im Controller auch ein \"handover\" programmiert werden. Durch Eingabe einer Blocknummer werden die Blöcke dann an den nächsten Move Controller übergeben. So lassen sich auch zusammenhängende Bewegungen über mehrere Move Controller realisieren.\n"..
"\n"..
"Der Move Controller unterstützt folgende techage Kommandos:\n"..
"\n"..
@ -2112,7 +2109,7 @@ techage.manual_DE.aText = {
"\n"..
"Für das Pairing musst du zuerst auf der einen Seite einen Namen für die Kiste eingeben\\, dann kannst du bei der anderen Kiste diesen Namen auswählen und so die beiden Blöcke verbinden.\n"..
"\n"..
"Die Nutzung der TA5 Hyperloop Kiste benötigt 20 Erfahrungspunkte.\n"..
"Die Nutzung der TA5 Hyperloop Kiste benötigt 15 Erfahrungspunkte.\n"..
"\n"..
"\n"..
"\n",
@ -2122,7 +2119,7 @@ techage.manual_DE.aText = {
"\n"..
"Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Tank eingeben\\, dann kannst du bei dem anderen Tank diesen Namen auswählen und so die beiden Blöcke verbinden.\n"..
"\n"..
"Die Nutzung des TA5 Hyperloop Tanks benötigt 20 Erfahrungspunkte.\n"..
"Die Nutzung des TA5 Hyperloop Tanks benötigt 15 Erfahrungspunkte.\n"..
"\n"..
"\n"..
"\n",
@ -2134,25 +2131,25 @@ techage.manual_DE.aText = {
"\n"..
"\n"..
"\n",
"Diese Teleport-Blöcke erlauben die Übertragung von Gegenständen und ersetzen somit eine Röhre. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.\n"..
"Diese Teleport-Blöcke erlauben die Übertragung von Gegenständen und ersetzen somit eine Röhre. Dabei können Entfernungen von bis zu 500 Blöcken überbrückt werden.\n"..
"\n"..
"Ein Teleport-Block benötigt 12 ku Strom.\n"..
"\n"..
"Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.\n"..
"Für die Nutzung der Teleport-Blöcke werden 30 Erfahrungspunkte benötigt.\n"..
"\n"..
"\n"..
"\n",
"Diese Teleport-Blöcke erlauben die Übertragung von Flüssigkeiten und ersetzen somit eine gelbe Leitung. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.\n"..
"Diese Teleport-Blöcke erlauben die Übertragung von Flüssigkeiten und ersetzen somit eine gelbe Leitung. Dabei können Entfernungen von bis zu 500 Blöcken überbrückt werden.\n"..
"\n"..
"Ein Teleport-Block benötigt 12 ku Strom.\n"..
"\n"..
"Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.\n"..
"Für die Nutzung der Teleport-Blöcke werden 30 Erfahrungspunkte benötigt.\n"..
"\n"..
"\n"..
"\n",
"Die Hyperloop Teleport Blöcke erlauben den Aufbau von Hyperloop Netzwerk ohne Hyperloop-Röhren.\n"..
"\n"..
"Die Nutzung der Hyperloop Teleport Blöcke benötigt 120 Erfahrungspunkte.\n"..
"Die Nutzung der Hyperloop Teleport Blöcke benötigt 60 Erfahrungspunkte.\n"..
"\n",
"",
"Der TA5 Container erlaubt Techage Anlagen ein- und an einer anderen Stelle wieder auszupacken.\n"..
@ -2163,7 +2160,7 @@ techage.manual_DE.aText = {
"\n"..
"\n"..
"\n",
"Der TA5 KI Chip II wird zur Herstellung des TA5 Fusionsreaktors benötigt. Der TA5 KI Chip II kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 50 Erfahrungspunkte benötigt.\n"..
"Der TA5 KI Chip II wird zur Herstellung des TA5 Fusionsreaktors benötigt. Der TA5 KI Chip II kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 25 Erfahrungspunkte benötigt.\n"..
"\n"..
"\n"..
"\n",
@ -2190,7 +2187,6 @@ techage.manual_DE.aItemName = {
"ta1_sluice_handle",
"ta1_board1",
"ta1_board2",
"",
"ta1_gravelsieve",
"hammer",
"ta1_gravelsieve",
@ -2451,7 +2447,6 @@ techage.manual_DE.aPlanTable = {
"",
"",
"",
"",
"hoppersieve",
"",
"",

View File

@ -983,7 +983,7 @@ techage.manual_EN.aText = {
"\n",
"The tank truck is used to transport liquids. Like tanks\\, it can be filled with pumps or emptied. In both cases\\, the yellow tube must be connected to the tank truck from above.\n"..
"\n"..
"100 units fit in the tank truck.\n"..
"200 units fit in the tank truck.\n"..
"\n"..
"\n"..
"\n",
@ -1731,7 +1731,6 @@ techage.manual_EN.aText = {
" - The movement can be tested with the menu buttons \"Move A-B\" and \"Move B-A\"\n"..
" - you can also fly through walls or other blocks\n"..
" - The target position for the blocks can also be occupied. In this case\\, the blocks are saved \"invisibly\". This is intended for sliding doors and the like\n"..
" - A \"handover\" can also be programmed in the controller via the open-ended wrench menu. By entering a block number\\, the blocks are then transferred to the next move controller. In this way\\, connected movements can also be implemented using several Move Controllers.\n"..
"\n"..
"The Move Controller supports the following techage commands:\n"..
"\n"..
@ -2118,7 +2117,7 @@ techage.manual_EN.aText = {
"\n"..
"For pairing you first have to enter a name for the chest on one side\\, then you can select this name for the other chest and thus connect the two blocks.\n"..
"\n"..
"The use of the TA5 Hyperloop Chest requires 20 experience points.\n"..
"The use of the TA5 Hyperloop Chest requires 15 experience points.\n"..
"\n"..
"\n"..
"\n",
@ -2128,7 +2127,7 @@ techage.manual_EN.aText = {
"\n"..
"For pairing you first have to enter a name for the tank on one side\\, then you can select this name for the other tank and thus connect the two blocks.\n"..
"\n"..
"The use of the TA5 Hyperloop Tank requires 20 experience points.\n"..
"The use of the TA5 Hyperloop Tank requires 15 experience points.\n"..
"\n"..
"\n"..
"\n",
@ -2138,25 +2137,25 @@ techage.manual_EN.aText = {
"\n"..
"\n"..
"\n",
"These teleport blocks allow the transfer of items and thus replace a tube. Distances of up to 200 blocks can be bridged.\n"..
"These teleport blocks allow the transfer of items and thus replace a tube. Distances of up to 500 blocks can be bridged.\n"..
"\n"..
"Each Teleport blocks requires 12 ku of electricity.\n"..
"\n"..
"60 experience points are required to use the teleport blocks. \n"..
"30 experience points are required to use the teleport blocks. \n"..
"\n"..
"\n"..
"\n",
"These teleport blocks allow the transfer of liquids and thus replace a pipe. Distances of up to 200 blocks can be bridged.\n"..
"These teleport blocks allow the transfer of liquids and thus replace a pipe. Distances of up to 500 blocks can be bridged.\n"..
"\n"..
"Each Teleport blocks requires 12 ku of electricity.\n"..
"\n"..
"60 experience points are required to use the teleport blocks. \n"..
"30 experience points are required to use the teleport blocks. \n"..
"\n"..
"\n"..
"\n",
"The Hyperloop Teleport Blocks allow the construction of a Hyperloop network without Hyperloop tubes.\n"..
"\n"..
"The use of the Hyperloop Teleport Blocks requires 120 experience points.\n"..
"The use of the Hyperloop Teleport Blocks requires 60 experience points.\n"..
"\n",
"",
"The TA5 container allows Techage systems to be packed and unpacked at another location.\n"..
@ -2167,7 +2166,7 @@ techage.manual_EN.aText = {
"\n"..
"\n"..
"\n",
"The TA5 AI Chip II is required to build the TA5 Fusion Reactor. The TA5 AI Chip II can only be manufactured at the TA4 Electronics Fab. This requires 50 experience points.\n"..
"The TA5 AI Chip II is required to build the TA5 Fusion Reactor. The TA5 AI Chip II can only be manufactured at the TA4 Electronics Fab. This requires 25 experience points.\n"..
"\n"..
"\n"..
"\n",

View File

@ -347,10 +347,10 @@ techage.register_node({"techage:heatexchanger2"}, {
elseif topic == "load" then
return techage.power.percent(nvm.capa_max, nvm.capa)
elseif topic == "on" then
start_node(pos, techage.get_nvm(pos))
State:start(pos, nvm)
return true
elseif topic == "off" then
stop_node(pos, techage.get_nvm(pos))
State:stop(pos, nvm)
return true
else
return "unsupported"
@ -359,10 +359,10 @@ techage.register_node({"techage:heatexchanger2"}, {
on_beduino_receive_cmnd = function(pos, src, topic, payload)
local nvm = techage.get_nvm(pos)
if topic == 1 and payload[1] == 1 then
start_node(pos, techage.get_nvm(pos))
State:start(pos, nvm)
return 0
elseif topic == 1 and payload[1] == 0 then
stop_node(pos, techage.get_nvm(pos))
State:stop(pos, nvm)
return 0
else
return 2, ""
@ -382,7 +382,8 @@ techage.register_node({"techage:heatexchanger2"}, {
local data = power.get_network_data(pos, Cable, DOWN)
return 0, {data.consumed - data.provided}
elseif topic == 134 then -- Tank Load Percent
return 0, {techage.power.percent(nvm.capa_max, nvm.capa)}
local value = techage.power.percent(nvm.capa_max, nvm.capa)
return 0, {math.floor(value + 0.5)}
else
return 2, ""
end

View File

@ -26,6 +26,7 @@ local STANDBY_TICKS = 3
local PWR_NEEDED = 35
local PWR_UNITS_PER_HYDROGEN_ITEM = 80
local CAPACITY = 200
local TURNOFF_THRESHOLD = "40%"
local function evaluate_percent(s)
return (tonumber(s:sub(1, -2)) or 0) / 100
@ -124,11 +125,14 @@ local function node_timer(pos, elapsed)
State:keep_running(pos, nvm, 1)
end
elseif curr_load == 0 then
nvm.taken = 0
State:nopower(pos, nvm)
else
nvm.taken = 0
State:standby(pos, nvm, S("Turnoff point reached"))
end
else
nvm.taken = 0
State:blocked(pos, nvm, S("Storage full"))
end
if techage.is_activeformspec(pos) then
@ -161,6 +165,8 @@ local function after_place_node(pos)
State:node_init(pos, nvm, number)
local node = minetest.get_node(pos)
M(pos):set_int("in_dir", techage.side_to_indir("R", node.param2))
M(pos):set_string("reduction", "100%")
M(pos):set_string("turnoff", TURNOFF_THRESHOLD)
Pipe:after_place_node(pos)
Cable:after_place_node(pos)
end
@ -201,7 +207,7 @@ local tool_config = {
name = "turnoff",
label = S("Turnoff point"),
tooltip = S("If the charge of the storage\nsystem falls below the configured value,\nthe block switches off"),
default = "98%",
default = TURNOFF_THRESHOLD,
},
}
@ -349,7 +355,7 @@ techage.register_node({"techage:ta4_electrolyzer", "techage:ta4_electrolyzer_on"
local meta = M(pos)
if not meta:contains("reduction") then
meta:set_string("reduction", "100%")
meta:set_string("turnoff", "100%")
meta:set_string("turnoff", TURNOFF_THRESHOLD)
end
end,
})

View File

@ -219,7 +219,7 @@ function techage.display.write_row(pos, payload, cycle_time, beduino)
nvm.text = nvm.text or {}
mem.ticks = mem.ticks or 0
if beduino then
if beduino or type(payload) == "string" then
row = tonumber(payload:sub(1,1) or "1") or 1
str = payload:sub(2) or "oops"
else

View File

@ -13,7 +13,7 @@
techage = {}
-- Version for compatibility checks, see readme.md/history
techage.version = 1.10
techage.version = 1.11
if minetest.global_exists("tubelib") then
minetest.log("error", "[techage] Techage can't be used together with the mod tubelib!")
@ -27,8 +27,8 @@ elseif minetest.global_exists("techpack") then
elseif minetest.global_exists("tubelib2") and tubelib2.version < 2.2 then
minetest.log("error", "[techage] Techage requires tubelib2 version 2.2 or newer!")
return
elseif minetest.global_exists("minecart") and minecart.version < 2.03 then
minetest.log("error", "[techage] Techage requires minecart version 2.03 or newer!")
elseif minetest.global_exists("minecart") and minecart.version < 2.04 then
minetest.log("error", "[techage] Techage requires minecart version 2.04 or newer!")
return
elseif minetest.global_exists("lcdlib") and lcdlib.version < 1.01 then
minetest.log("error", "[techage] Techage requires lcdlib version 1.01 or newer!")
@ -36,8 +36,8 @@ elseif minetest.global_exists("lcdlib") and lcdlib.version < 1.01 then
elseif minetest.global_exists("safer_lua") and safer_lua.version < 1.01 then
minetest.log("error", "[techage] Techage requires safer_lua version 1.01 or newer!")
return
elseif minetest.global_exists("networks") and networks.version < 0.12 then
minetest.log("error", "[techage] Techage requires networks version 0.12 or newer!")
elseif minetest.global_exists("networks") and networks.version < 0.13 then
minetest.log("error", "[techage] Techage requires networks version 0.13 or newer!")
return
elseif minetest.global_exists("hyperloop") and hyperloop.version < 2.07 then
minetest.log("error", "[techage] Techage requires hyperloop version 2.07 or newer!")

View File

@ -395,6 +395,8 @@ minetest.register_node("techage:meltingpot_active", {
can_dig = can_dig,
paramtype = "light",
use_texture_alpha = techage.CLIP,
drop = "techage:meltingpot",
is_ground_content = false,
groups = {cracky = 3, not_in_creative_inventory=1},

View File

@ -51,11 +51,13 @@ minetest.register_craftitem("techage:ta5_aichip2", {
techage.recipes.add("ta2_electronic_fab", {
output = "techage:vacuum_tube 2",
waste = "basic_materials:empty_spool 1",
input = {"default:glass 1", "basic_materials:copper_wire 1", "basic_materials:plastic_sheet 1", "techage:usmium_nuggets 1"}
})
techage.recipes.add("ta3_electronic_fab", {
output = "techage:vacuum_tube 2",
waste = "basic_materials:empty_spool 1",
input = {"default:glass 1", "basic_materials:copper_wire 1", "basic_materials:plastic_sheet 1", "techage:usmium_nuggets 1"}
})
@ -81,17 +83,20 @@ techage.recipes.add("ta4_electronic_fab", {
techage.recipes.add("ta4_electronic_fab", {
output = "techage:ta4_leds 8",
waste = "basic_materials:empty_spool 1",
input = {"basic_materials:plastic_sheet 4", "basic_materials:copper_wire 1", "techage:ta4_silicon_wafer 1"}
})
techage.recipes.add("ta4_electronic_fab", {
output = "techage:ta5_aichip 2",
waste = "basic_materials:empty_spool 2",
input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"},
ex_points = 10,
})
techage.recipes.add("ta4_electronic_fab", {
output = "techage:ta5_aichip2 2",
waste = "basic_materials:empty_spool 2",
input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"},
ex_points = 50,
ex_points = 25,
})

View File

@ -55,6 +55,8 @@ local NodeNames = {
"techage:basalt_glass2",
"techage:bauxite_stone",
"techage:bauxite_cobble",
"techage:cement_block",
}
if(minetest.get_modpath("moreblocks")) then

View File

@ -26,7 +26,7 @@ local shared_tank = techage.shared_tank
local menu = techage.menu
local CAPACITY = 1000
local EX_POINTS = 20
local EX_POINTS = 15
minetest.register_node("techage:ta5_hl_tank", {
description = S("TA5 Hyperloop Tank"),

View File

@ -291,6 +291,10 @@ TA2 Cylinder=TA2 Zylinder
### detector.lua ###
Countdown=Countdown
Counts down the number of items passed through@nand only triggers an 'on' command when it reaches zero.=Zählt die Anzahl der durchlaufenen Elemente herunter@nund löst nur dann einen 'ON'-Befehl aus, wenn er Null erreicht.
Current countdown=Aktueller Zähler
Current countdown value.=Aktueller Zählerwert.
TA4 Collider Detector=TA4 Collider Detektor
TA4 Collider Detector Core=TA4 Collider Detektorkern
TA4 Detector=TA4 Detektor
@ -500,8 +504,10 @@ Move=Bewege
Move A-B=Bewege A-B
Move B-A=Bewege B-A
Move block height=Move Block Höhe
Object offset=Objekt Offset
Stored=Gespeichert
Value in the range of 0.0 to 1.0=Wert im Bereich von 0.0 bis 1.0
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=Y-Offset für Nicht-Spieler Objekte wie Fahrzeuge (-0.5 bis 0.5)
### flywheel.lua ###
@ -665,7 +671,6 @@ TA4 Hydrogen=TA4 Wasserstoff
### hyperloop.lua ###
### sensorchest.lua ###
### teleport.lua ###
### terminal.lua ###
not connected=nicht verbunden
@ -746,7 +751,6 @@ Block has an@nadditional wrench menu=Block besitzt ein@nzusätzliches@nSchrauben
### lib.lua ###
### sensorchest.lua ###
### terminal.lua ###
connected with=verbunden mit
@ -888,27 +892,22 @@ TA4 Streetlamp Solar Cell=TA4 Straßenlampen-Solarzelle
### minichest.lua ###
Test Chest=
Test Chest=Testkiste
### minitank.lua ###
Test Mini Tank=
Test Mini Tank=Testminitank
### movecontroller.lua ###
Error: Invalid distance !!=Fehler: Ungültige Entfernung !!
Handover to A=Übergabe an A
Handover to B=Übergabe an B
Move distance=Entfernung
Move distance (A to B)=Entfernung (A nach B)
Number of the next movecontroller=Nummer des nächsten Move Controllers
Number of the previous movecontroller=Nummer des vorhergehenden Move Controllers
Object offset=Objekt Offset
Operational mode=Betriebsmodus
Reset=Rücksetzen
Switch to the remote controlled 'move xyz' mode=Wechseln in den ferngesteuerten 'move xyz'-Modus
TA Rack and Pinion=TA Zahnstange
TA4 Move Controller=TA4 Move Controller
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=Y-Offset für Nicht-Spieler Objekte wie Fahrzeuge (-0.5 bis 0.5)
### node_detector.lua ###
@ -1170,6 +1169,8 @@ stopped=gestoppt
Commands=Kommandos
Cycle time=Zykluszeit
Example:@n=Beispiel:
If 'yes' a received OFF command won't stop the sequencer=Bei 'yes' stoppt ein empfangener OFF-Befehl den Sequenzer nicht
Ignore OFF command=OFF-Befehl ignorieren
Invalid command!=Ungültiges Kommando!
Start=Start
Stop=Stopp
@ -1192,8 +1193,8 @@ TA5 Fusion Reactor Shell=TA5 Fusionsreaktor Hülle
### signallamp.lua ###
TA4 Wind Turbine Signal Lamp=TA4 Windkraftanlagenlampe
TechAge Signal Lamp=TechAge Signallampe
TechAge Signal Lamp 2 =TechAge Signallampe 2
TechAge Color Lamp=TechAge Farblampe
TechAge Color Lamp 2=TechAge Farblampe 2
### signallamp_2x.lua ###
@ -1401,7 +1402,6 @@ TA5 Teleport Block Items=TA5 Teleport Block Gegenstände
Syntax error, try help=Syntax Fehler, nutze help
TA3 Terminal=TA3 Terminal
TA4 Collider Terminal=TA4 Collider Terminal
TA4 Terminal=TA4 Terminal
commands like: help=Kommandos wie: help
@ -1511,4 +1511,11 @@ TA4 Collider Detector Worker=TA4 Collider Detektor Worker
##### not used anymore #####
Handover to A=Übergabe an A
Handover to B=Übergabe an B
Number of the next movecontroller=Nummer des nächsten Move Controllers
Number of the previous movecontroller=Nummer des vorhergehenden Move Controllers
TechAge Signal Lamp=TechAge Signallampe
TechAge Signal Lamp 2 =TechAge Signallampe 2
TA4 Collider Terminal=TA4 Collider Terminal
Error: Max. length of the flight route exceeded !!=Fehler: Max. Flugstreckenlänge überschritten !!

View File

@ -291,6 +291,10 @@ TA2 Cylinder=
### detector.lua ###
Countdown=
Counts down the number of items passed through@nand only triggers an 'on' command when it reaches zero.=
Current countdown=
Current countdown value.=
TA4 Collider Detector=
TA4 Collider Detector Core=
TA4 Detector=
@ -500,8 +504,10 @@ Move=
Move A-B=
Move B-A=
Move block height=
Object offset=
Stored=
Value in the range of 0.0 to 1.0=
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=
### flywheel.lua ###
@ -665,7 +671,6 @@ TA4 Hydrogen=
### hyperloop.lua ###
### sensorchest.lua ###
### teleport.lua ###
### terminal.lua ###
not connected=
@ -746,7 +751,6 @@ Block has an@nadditional wrench menu=
### lib.lua ###
### sensorchest.lua ###
### terminal.lua ###
connected with=
@ -897,18 +901,13 @@ Test Mini Tank=
### movecontroller.lua ###
Error: Invalid distance !!=
Handover to A=
Handover to B=
Move distance=
Move distance (A to B)=
Number of the next movecontroller=
Number of the previous movecontroller=
Object offset=
Operational mode=
Reset=
Switch to the remote controlled 'move xyz' mode=
TA Rack and Pinion=
TA4 Move Controller=
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=
### node_detector.lua ###
@ -1170,6 +1169,8 @@ stopped=
Commands=
Cycle time=
Example:@n=
If 'yes' a received OFF command won't stop the sequencer=
Ignore OFF command=
Invalid command!=
Start=
Stop=
@ -1192,8 +1193,8 @@ TA5 Fusion Reactor Shell=
### signallamp.lua ###
TA4 Wind Turbine Signal Lamp=
TechAge Signal Lamp=
TechAge Signal Lamp 2 =
TechAge Color Lamp=
TechAge Color Lamp 2=
### signallamp_2x.lua ###
@ -1401,7 +1402,6 @@ TA5 Teleport Block Items=
Syntax error, try help=
TA3 Terminal=
TA4 Collider Terminal=
TA4 Terminal=
commands like: help=

View File

@ -45,9 +45,18 @@ local WRENCH_MENU = {
name = "cycletime",
label = S("Cycle time"),
tooltip = S("Timer cycle time (default: 100 ms)"),
default = "1",
default = "100ms",
values = {0.1, 0.2, 0.5, 1.0, 2.0}
},
{
type = "dropdown",
choices = "no,yes",
name = "ignore_off",
label = S("Ignore OFF command"),
tooltip = S("If 'yes' a received OFF command won't stop the sequencer"),
default = "no",
values = {0, 1}
},
}
local function cycle_time(pos)
@ -171,6 +180,7 @@ local function formspec(nvm, meta)
return "size[10,8]" ..
style ..
techage.wrench_image(9.3, -0.25) ..
"tabheader[0,0;tab;edit,help;1;;true]" ..
"label[0.1,-0.2;" .. S("Commands") .. ":]" ..
textarea ..
@ -325,7 +335,7 @@ techage.register_node({"techage:ta4_sequencer"}, {
mem.idx = tonumber(payload or 1) or 1
restart_timer(pos, 1)
logic.infotext(M(pos), S("TA4 Sequencer"), S("running"))
elseif topic == "stop" or topic == "off" then
elseif topic == "stop" or (topic == "off" and M(pos):get_int("ignore_off") == 0) then
nvm.running = false
minetest.get_node_timer(pos):stop()
logic.infotext(M(pos), S("TA4 Sequencer"), S("stopped"))

View File

@ -110,12 +110,6 @@ Block in verschiedenen Holzsorten zum Bauen des Mühlbachkanals. Dieser Block ei
##
## Erze und Werkzeuge
TA1 hat seine eigenen Werkzeuge wie Hammer und Kiessieb, aber auch der Minecart Hopper kann genutzt werden.

View File

@ -440,7 +440,7 @@ Damit die Minecarts automatisch wieder starten, müssen die Prellböcke mit Stat
Der Tankwagen dient zum Transport von Flüssigkeiten. Es kann wie Tanks mit Pumpen gefüllt bzw. geleert werden. In beiden Fällen muss die gelbe Röhre von oben mit dem Tankwagen verbunden werden.
In den Tankwagen passen 100 Einheiten.
In den Tankwagen passen 200 Einheiten.
[tank_cart|image]

View File

@ -441,7 +441,7 @@ For the Minecarts to start again automatically, the bumper blocks must be config
The tank truck is used to transport liquids. Like tanks, it can be filled with pumps or emptied. In both cases, the yellow tube must be connected to the tank truck from above.
100 units fit in the tank truck.
200 units fit in the tank truck.
[tank_cart | image]

View File

@ -579,7 +579,6 @@ Anleitung:
- mit den Menü-Tasten "Bewege A-B" sowie "Bewege B-A" kann die Bewegung getestet werden
- man kann auch durch Wände oder andere Blöcke fliegen
- auch die Zielposition für die Blöcke kann belegt sein. Die Blöcke werden in diesem Falle "unsichtbar" gespeichert. Dies ist für Schiebetüren und ähnliches gedacht
- Über das Gabelschlüssel-Menü kann im Controller auch ein "handover" programmiert werden. Durch Eingabe einer Blocknummer werden die Blöcke dann an den nächsten Move Controller übergeben. So lassen sich auch zusammenhängende Bewegungen über mehrere Move Controller realisieren.
Der Move Controller unterstützt folgende techage Kommandos:

View File

@ -570,7 +570,6 @@ Instructions:
- The movement can be tested with the menu buttons "Move A-B" and "Move B-A"
- you can also fly through walls or other blocks
- The target position for the blocks can also be occupied. In this case, the blocks are saved "invisibly". This is intended for sliding doors and the like
- A "handover" can also be programmed in the controller via the open-ended wrench menu. By entering a block number, the blocks are then transferred to the next move controller. In this way, connected movements can also be implemented using several Move Controllers.
The Move Controller supports the following techage commands:

View File

@ -92,7 +92,7 @@ Die TA5 Hyperloop Kiste muss man dazu auf eine Hyperloop Junction stellen. Die K
Für das Pairing musst du zuerst auf der einen Seite einen Namen für die Kiste eingeben, dann kannst du bei der anderen Kiste diesen Namen auswählen und so die beiden Blöcke verbinden.
Die Nutzung der TA5 Hyperloop Kiste benötigt 20 Erfahrungspunkte.
Die Nutzung der TA5 Hyperloop Kiste benötigt 15 Erfahrungspunkte.
[ta5_chest|image]
@ -104,7 +104,7 @@ Den TA5 Hyperloop Tank muss man dazu auf eine Hyperloop Junction stellen. Der Ta
Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Tank eingeben, dann kannst du bei dem anderen Tank diesen Namen auswählen und so die beiden Blöcke verbinden.
Die Nutzung des TA5 Hyperloop Tanks benötigt 20 Erfahrungspunkte.
Die Nutzung des TA5 Hyperloop Tanks benötigt 15 Erfahrungspunkte.
[ta5_tank|image]
@ -122,21 +122,21 @@ Der Plan rechts zeigt, wie die Blöcke genutzt werden können.
### TA5 Teleport Block Gegenstände / TA5 Teleport Block Items
Diese Teleport-Blöcke erlauben die Übertragung von Gegenständen und ersetzen somit eine Röhre. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.
Diese Teleport-Blöcke erlauben die Übertragung von Gegenständen und ersetzen somit eine Röhre. Dabei können Entfernungen von bis zu 500 Blöcken überbrückt werden.
Ein Teleport-Block benötigt 12 ku Strom.
Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.
Für die Nutzung der Teleport-Blöcke werden 30 Erfahrungspunkte benötigt.
[ta5_tele_tube|image]
### TA5 Teleport Block Flüssigkeiten / TA5 Teleport Block Liquids
Diese Teleport-Blöcke erlauben die Übertragung von Flüssigkeiten und ersetzen somit eine gelbe Leitung. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.
Diese Teleport-Blöcke erlauben die Übertragung von Flüssigkeiten und ersetzen somit eine gelbe Leitung. Dabei können Entfernungen von bis zu 500 Blöcken überbrückt werden.
Ein Teleport-Block benötigt 12 ku Strom.
Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.
Für die Nutzung der Teleport-Blöcke werden 30 Erfahrungspunkte benötigt.
[ta5_tele_pipe|image]
@ -144,7 +144,7 @@ Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.
Die Hyperloop Teleport Blöcke erlauben den Aufbau von Hyperloop Netzwerk ohne Hyperloop-Röhren.
Die Nutzung der Hyperloop Teleport Blöcke benötigt 120 Erfahrungspunkte.
Die Nutzung der Hyperloop Teleport Blöcke benötigt 60 Erfahrungspunkte.
## Weitere TA5 Blöcke/Items
@ -162,6 +162,6 @@ Der TA5 KI Chip wird teilweise zur Herstellung von TA5 Blöcken benötigt. Der T
### TA5 KI Chip II / TA5 AI Chip II
Der TA5 KI Chip II wird zur Herstellung des TA5 Fusionsreaktors benötigt. Der TA5 KI Chip II kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 50 Erfahrungspunkte benötigt.
Der TA5 KI Chip II wird zur Herstellung des TA5 Fusionsreaktors benötigt. Der TA5 KI Chip II kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 25 Erfahrungspunkte benötigt.
[ta5_aichip2|image]

View File

@ -92,7 +92,7 @@ The TA5 Hyperloop Chest has to be placed on a Hyperloop Junction. The chest has
For pairing you first have to enter a name for the chest on one side, then you can select this name for the other chest and thus connect the two blocks.
The use of the TA5 Hyperloop Chest requires 20 experience points.
The use of the TA5 Hyperloop Chest requires 15 experience points.
[ta5_chest|image]
@ -104,7 +104,7 @@ The TA5 Hyperloop Tank has to be placed on a Hyperloop Junction.The tank has a s
For pairing you first have to enter a name for the tank on one side, then you can select this name for the other tank and thus connect the two blocks.
The use of the TA5 Hyperloop Tank requires 20 experience points.
The use of the TA5 Hyperloop Tank requires 15 experience points.
[ta5_tank|image]
@ -120,21 +120,21 @@ The map on the right shows how the blocks can be used.
### TA5 Teleport Block Items
These teleport blocks allow the transfer of items and thus replace a tube. Distances of up to 200 blocks can be bridged.
These teleport blocks allow the transfer of items and thus replace a tube. Distances of up to 500 blocks can be bridged.
Each Teleport blocks requires 12 ku of electricity.
60 experience points are required to use the teleport blocks.
30 experience points are required to use the teleport blocks.
[ta5_tele_tube|image]
### TA5 Teleport Block Liquids
These teleport blocks allow the transfer of liquids and thus replace a pipe. Distances of up to 200 blocks can be bridged.
These teleport blocks allow the transfer of liquids and thus replace a pipe. Distances of up to 500 blocks can be bridged.
Each Teleport blocks requires 12 ku of electricity.
60 experience points are required to use the teleport blocks.
30 experience points are required to use the teleport blocks.
[ta5_tele_pipe|image]
@ -142,7 +142,7 @@ Each Teleport blocks requires 12 ku of electricity.
The Hyperloop Teleport Blocks allow the construction of a Hyperloop network without Hyperloop tubes.
The use of the Hyperloop Teleport Blocks requires 120 experience points.
The use of the Hyperloop Teleport Blocks requires 60 experience points.
@ -162,6 +162,6 @@ The TA5 AI Chip is partly required for the production of TA5 blocks. The TA5 AI
### TA5 AI Chip II
The TA5 AI Chip II is required to build the TA5 Fusion Reactor. The TA5 AI Chip II can only be manufactured at the TA4 Electronics Fab. This requires 50 experience points.
The TA5 AI Chip II is required to build the TA5 Fusion Reactor. The TA5 AI Chip II can only be manufactured at the TA4 Electronics Fab. This requires 25 experience points.
[ta5_aichip2|image]

View File

@ -366,7 +366,9 @@ Please note, that this is not a technical distinction, only a logical.
| "state" | one of: "on", "off" | State of a TA4 Button |
| "fuel" | number | fuel value of a fuel consuming block |
| "depth" | number | Read the current depth value of a quarry block (1..80) |
| "load" | number | Read the load value in percent (0..100) of a tank, silo, accu, or battery block, or from the Signs Bot Box. Silo and tank return two values: The percentage value and the absolute value in units.<br /> Example: percent, absolute = $send_cmnd("223", "load") |
| "load" | number | Read the load value in percent (0..100) of a accu, or battery block. |
| "load" | number | Read the load value in percent (0..100) of a tank or silo. <br />Silo and tank return two values: <br />The percentage value and the absolute value in units.<br /> Example: percent, absolute = $send_cmnd("223", "load") |
| "load" | number | Read the grid storage amount in percent (0..100) from a TA3 Power Terminal. |
| "delivered" | number | Read the current delivered power value of a generator block. A power consuming block (accu) provides a negative value |
| "flowrate" | Total flow rate in liquid units | Only for TA4 Pumps |
| "action" | player-name, action-string | Only for Sensor Chests |

View File

@ -20,7 +20,6 @@
- [TA1 Schleusengriff / TA1 Sluice Handle](./manual_ta1_DE.md#ta1-schleusengriff--ta1-sluice-handle)
- [TA1 Apfelholzbrett / TA1 Apple Wood Board](./manual_ta1_DE.md#ta1-apfelholzbrett--ta1-apple-wood-board)
- [TA1 Apfel Mühlbachbrett / TA1 Apple Millrace Board](./manual_ta1_DE.md#ta1-apfel-mühlbachbrett--ta1-apple-millrace-board)
- [ ](./manual_ta1_DE.md#-)
- [Erze und Werkzeuge](./manual_ta1_DE.md#erze-und-werkzeuge)
- [Hammer](./manual_ta1_DE.md#hammer)
- [Kiessieb / Gravel Sieve](./manual_ta1_DE.md#kiessieb--gravel-sieve)

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2020-2022 Joachim Stolberg
Copyright (C) 2020-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -20,14 +20,68 @@ local S = techage.S
local logic = techage.logic
local fly = techage.flylib
local NUMSLOTS = 16
local MarkedNodes = {} -- t[player] = {{entity, pos},...}
local CurrentPos -- to mark punched entities
local function is_simple_node(name)
local ndef = minetest.registered_nodes[name]
return techage.can_dig_node(name, ndef)
--------------------------------------------------------------------------
-- helper functions
--------------------------------------------------------------------------
local function count_nodes(tbl, name)
if tbl[name] then
tbl[name] = tbl[name] + 1
else
tbl[name] = 1
end
end
local function take_node(tbl, name)
if tbl[name] and tbl[name] > 0 then
tbl[name] = tbl[name] - 1
return true
end
end
local function next_node(tbl)
return function(tbl)
local name, cnt = next(tbl)
if cnt and cnt > 0 then
cnt = cnt - 1
if cnt == 0 then
tbl[name] = nil
else
tbl[name] = cnt
end
return name
end
end, tbl
end
local function get_new_nodename(item)
local name = item:get_name()
if name == "" then
return "air"
end
return name
end
local function get_node_name(nvm, slot)
local pos = nvm.pos_list[slot]
if pos then
return techage.get_node_lvm(pos).name
end
return "unknown"
end
local function is_simple_node(name)
local ndef = minetest.registered_nodes[name]
return name ~= "air" and techage.can_dig_node(name, ndef)
end
--------------------------------------------------------------------------
-- Marker
--------------------------------------------------------------------------
local function unmark_position(name, pos)
pos = vector.round(pos)
for idx,item in ipairs(MarkedNodes[name] or {}) do
@ -102,6 +156,9 @@ minetest.register_entity(":techage:marker", {
end,
})
--------------------------------------------------------------------------
-- formspec
--------------------------------------------------------------------------
local function formspec1(nvm, meta)
local status = meta:get_string("status")
local play_sound = dump(nvm.play_sound or false)
@ -109,8 +166,8 @@ local function formspec1(nvm, meta)
"tabheader[0,0;tab;"..S("Ctrl,Inv")..";1;;true]"..
"button[0.7,0.2;3,1;record;"..S("Record").."]"..
"button[4.3,0.2;3,1;ready;"..S("Done").."]"..
"button[0.7,1.2;3,1;show;"..S("Set").."]"..
"button[4.3,1.2;3,1;hide;"..S("Remove").."]"..
"button[0.7,1.2;3,1;reset;"..S("Reset").."]"..
"button[4.3,1.2;3,1;exchange;"..S("Exchange").."]"..
"checkbox[4.3,2.1;play_sound;"..S("with door sound")..";"..play_sound.."]"..
"label[0.5,2.3;"..status.."]"..
"list[current_player;main;0,3.3;8,4;]"
@ -136,10 +193,102 @@ local function play_sound(pos)
max_hear_distance = 15})
end
--------------------------------------------------------------------------
-- Configuration
--------------------------------------------------------------------------
-- Store the current state of inventory and placed nodes
local function store_config(pos, nvm)
local meta = M(pos)
local inv = meta:get_inventory()
local item_list = inv:get_list("main")
local nodes = {exp_nodes = {}, inv_nodes = {}}
nvm.pos_list = nvm.pos_list or {}
nvm.param2_list = nvm.param2_list or {}
for idx = 1, NUMSLOTS do
local pos = nvm.pos_list[idx]
if pos then
local param2 = nvm.param2_list[idx] or 0
local item = item_list[idx]
if item and item:get_count() > 0 then
nodes.inv_nodes[idx] = {name = item:get_name(), param2 = param2}
end
local node = techage.get_node_lvm(pos)
if is_simple_node(node.name) or node.name == "air" then
nodes.exp_nodes[idx] = techage.get_node_lvm(pos)
end
end
end
meta:set_string("stored_config", minetest.serialize(nodes))
end
-- Generate a table of currently available inventory and placed nodes
local function available_nodes(pos, nvm, item_list)
local nodes = {}
for idx = 1, NUMSLOTS do
local item = item_list[idx]
if item and item:get_count() > 0 then
count_nodes(nodes, item:get_name())
end
local pos = nvm.pos_list[idx]
if pos then
local node = techage.get_node_lvm(pos)
if is_simple_node(node.name) then
count_nodes(nodes, node.name)
end
end
end
return nodes
end
local function restore_config(pos, nvm)
local meta = M(pos)
local inv = meta:get_inventory()
local item_list = inv:get_list("main")
local stock = available_nodes(pos, nvm, item_list)
local nodes = minetest.deserialize(meta:get_string("stored_config")) or {}
inv:set_list("main", {})
item_list = inv:get_list("main")
for idx, node in pairs(nodes.inv_nodes or {}) do
if take_node(stock, node.name) then
item_list[idx] = ItemStack(node.name)
end
end
inv:set_list("main", item_list)
for idx, node in pairs(nodes.exp_nodes or {}) do
local pos = nvm.pos_list[idx]
if take_node(stock, node.name) then
local param2 = nvm.param2_list[idx] or 0
fly.exchange_node(pos, node.name, param2)
nvm.expected_nodenames[idx] = node.name
else
fly.remove_node(pos)
nvm.expected_nodenames[idx] = "air"
end
end
for name in next_node(stock) do
inv:add_item("main", ItemStack(name))
end
return true
end
--------------------------------------------------------------------------
-- Exchange nodes
--------------------------------------------------------------------------
local function exchange_node(pos, item, param2)
local node = minetest.get_node_or_nil(pos)
if node and is_simple_node(node.name) then
if item and item:get_name() ~= "" and minetest.registered_nodes[item:get_name()] then
if node and is_simple_node(node.name) or node.name == "air" then
if item and is_simple_node(item:get_name()) then
fly.exchange_node(pos, item:get_name(), param2)
else
fly.remove_node(pos)
@ -147,30 +296,48 @@ local function exchange_node(pos, item, param2)
if not techage.is_air_like(node.name) then
return ItemStack(node.name), node.param2
else
return ItemStack(), nil
return ItemStack(), param2
end
end
return item, param2
end
local function expected_node(pos, nvm, idx, force, new_nodename)
local expected_name = force and nvm.expected_nodenames[idx] or nil
if expected_name then
local node = techage.get_node_lvm(pos)
if expected_name == node.name then
nvm.expected_nodenames[idx] = new_nodename
return true
else
return false
end
end
nvm.expected_nodenames[idx] = new_nodename
return true
end
local function exchange_nodes(pos, nvm, slot, force)
local meta = M(pos)
local inv = meta:get_inventory()
local item_list = inv:get_list("main")
local owner = meta:get_string("owner")
local res = false
nvm.pos_list = nvm.pos_list or {}
nvm.param2_list = nvm.param2_list or {}
nvm.expected_nodenames = nvm.expected_nodenames or {}
for idx = (slot or 1), (slot or 16) do
for idx = (slot or 1), (slot or NUMSLOTS) do
local pos = nvm.pos_list[idx]
local item = item_list[idx]
if pos then
if (force == nil)
or (force == "exch")
or (force == "dig" and item:get_count() == 0)
or (force == "set" and item:get_count() > 0) then
if expected_node(pos, nvm, idx, force, get_new_nodename(item)) then
item_list[idx], nvm.param2_list[idx] = exchange_node(pos, item, nvm.param2_list[idx])
end
res = true
end
end
@ -180,14 +347,6 @@ local function exchange_nodes(pos, nvm, slot, force)
return res
end
local function get_node_name(nvm, slot)
local pos = nvm.pos_list[slot]
if pos then
return techage.get_node_lvm(pos).name
end
return "unknown"
end
local function show_nodes(pos)
local nvm = techage.get_nvm(pos)
if not nvm.is_on then
@ -216,6 +375,17 @@ local function hide_nodes(pos)
end
end
local function exch_nodes(pos)
local nvm = techage.get_nvm(pos)
if nvm.play_sound then
minetest.sound_play("doors_door_open", {
pos = pos,
gain = 1,
max_hear_distance = 15})
end
return exchange_nodes(pos, nvm)
end
minetest.register_node("techage:ta3_doorcontroller2", {
description = S("TA3 Door Controller II"),
tiles = {
@ -228,7 +398,7 @@ minetest.register_node("techage:ta3_doorcontroller2", {
after_place_node = function(pos, placer, itemstack)
local meta = M(pos)
local inv = meta:get_inventory()
inv:set_size('main', 16)
inv:set_size('main', NUMSLOTS)
logic.after_place_node(pos, placer, "techage:ta3_doorcontroller2", S("TA3 Door Controller II"))
logic.infotext(meta, S("TA3 Door Controller II"))
local nvm = techage.get_nvm(pos)
@ -252,11 +422,12 @@ minetest.register_node("techage:ta3_doorcontroller2", {
elseif fields.record then
local inv = meta:get_inventory()
nvm.pos_list = nil
nvm.is_on = false
meta:set_string("status", S("Recording..."))
local name = player:get_player_name()
minetest.chat_send_player(name, S("Click on all the blocks that are part of the door/gate"))
nvm.expected_nodenames = {}
MarkedNodes[name] = {}
meta:set_string("stored_config", "")
meta:set_string("formspec", formspec1(nvm, meta))
elseif fields.ready then
local name = player:get_player_name()
@ -264,25 +435,24 @@ minetest.register_node("techage:ta3_doorcontroller2", {
local text = #pos_list.." "..S("block positions are stored.")
meta:set_string("status", text)
nvm.pos_list = pos_list
nvm.is_on = true
nvm.expected_nodenames = {}
unmark_all(name)
meta:set_string("stored_config", "")
meta:set_string("formspec", formspec1(nvm, meta))
elseif fields.show then
if show_nodes(pos) then
play_sound(pos)
meta:set_string("status", S("Blocks are back"))
elseif fields.exchange then
if exch_nodes(pos) then
store_config(pos, nvm)
meta:set_string("status", S("Blocks exchanged"))
meta:set_string("formspec", formspec1(nvm, meta))
local name = player:get_player_name()
MarkedNodes[name] = nil
end
elseif fields.hide then
if hide_nodes(pos) then
play_sound(pos)
meta:set_string("status", S("Blocks are disappeared"))
elseif fields.reset then
restore_config(pos, nvm)
meta:set_string("status", S("Blocks reset"))
meta:set_string("formspec", formspec1(nvm, meta))
local name = player:get_player_name()
MarkedNodes[name] = nil
end
elseif fields.play_sound then
nvm.play_sound = fields.play_sound == "true"
meta:set_string("formspec", formspec1(nvm, meta))
@ -340,7 +510,7 @@ techage.register_node({"techage:ta3_doorcontroller2"}, {
return show_nodes(pos)
elseif topic == "exchange" then
local nvm = techage.get_nvm(pos)
return exchange_nodes(pos, nvm, tonumber(payload))
return exchange_nodes(pos, nvm, tonumber(payload), "exch")
elseif topic == "set" then
local nvm = techage.get_nvm(pos)
return exchange_nodes(pos, nvm, tonumber(payload), "set")
@ -350,6 +520,9 @@ techage.register_node({"techage:ta3_doorcontroller2"}, {
elseif topic == "get" then
local nvm = techage.get_nvm(pos)
return get_node_name(nvm, tonumber(payload))
elseif topic == "reset" then
local nvm = techage.get_nvm(pos)
return restore_config(pos, nvm)
end
return false
end,
@ -360,13 +533,16 @@ techage.register_node({"techage:ta3_doorcontroller2"}, {
return show_nodes(pos) and 0 or 3
elseif topic == 9 and payload[1] == 0 then -- Exchange Block
local nvm = techage.get_nvm(pos)
return exchange_nodes(pos, nvm, payload[2] or 1) and 0 or 3
return exchange_nodes(pos, nvm, payload[2] or 1, "exch") and 0 or 3
elseif topic == 9 and payload[1] == 1 then -- Set Block
local nvm = techage.get_nvm(pos)
return exchange_nodes(pos, nvm, payload[2] or 1, "set") and 0 or 3
elseif topic == 9 and payload[1] == 2 then -- Dig Block
local nvm = techage.get_nvm(pos)
return exchange_nodes(pos, nvm, payload[2] or 1, "dig") and 0 or 3
elseif topic == 9 and payload[1] == 3 then -- reset
local nvm = techage.get_nvm(pos)
return restore_config(pos, nvm) and 0 or 3
end
return 2
end,

View File

@ -265,6 +265,34 @@ techage.register_node({"techage:ta4_movecontroller"}, {
end,
})
minetest.register_node("techage:rack_and_pinion", {
description = S("TA Rack and Pinion"),
tiles = {
-- up, down, right, left, back, front
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"techage_rack_and_pinion.png",
},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{ -6/32, -16/32, 14.1/32, 6/32, 16/32, 16/32},
},
},
paramtype = "light",
use_texture_alpha = techage.CLIP,
sunlight_propagates = true,
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 1, level = 2},
sounds = default.node_sound_metal_defaults(),
})
minetest.register_craft({
output = "techage:ta4_movecontroller",
recipe = {
@ -273,3 +301,12 @@ minetest.register_craft({
{"group:wood", "basic_materials:gear_steel", "group:wood"},
},
})
minetest.register_craft({
output = "techage:rack_and_pinion 10",
recipe = {
{"", "default:steel_ingot", ""},
{"basic_materials:steel_bar", "default:steel_ingot", "basic_materials:steel_bar"},
{"", "default:steel_ingot", ""},
},
})

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2019-2021 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -27,10 +27,11 @@ local control = networks.control
local HELP = S([[Commands
help . . . print this text
cls . . . . . clear screen
gen . . . . print all generators
sto . . . . . print all storage systems
con . . . . . print main consumers
cls . . . . clear screen
gen . . print generators
sto . . print storage systems
con1 . . print consumers with power consumption between 1 and 10 ku
con2 . . print consumers with power consumption with 10 ku or above
]])
local function row(num, label, data)
@ -41,7 +42,6 @@ local function row(num, label, data)
"label[8.5,"..y..";" .. data .. "]"
end
local function formspec1(pos, data)
local mem = techage.get_mem(pos)
local outdir = M(pos):get_int("outdir")
@ -94,12 +94,32 @@ local function formspec2(pos)
"button[7.9,7.4;2,1;enter;"..S("Enter").."]"
end
--------------------------------------------------------------------------------------
--Overwrite networks.power.consume_power function
--------------------------------------------------------------------------------------
local origin_consume_power = networks.power.consume_power
function networks.power.consume_power(pos, tlib2, outdir, amount)
local nvm = techage.get_nvm(pos)
nvm.power_taken = origin_consume_power(pos, tlib2, outdir, amount)
return nvm.power_taken
end
local function get_consumer_power_consumption(pos)
if pos then
local nvm = techage.get_nvm(pos)
if nvm.running or techage.needs_power(nvm) then
return nvm.power_taken or 0
end
end
return 0
end
local function generators(pos)
local tbl = {}
local outdir = M(pos):get_int("outdir")
local resp = control.request(pos, Cable, outdir, "gen", "info")
for _, item in ipairs(resp) do
local name = item.type .. " (" .. item.number .. ")"
if item.running then
local s = string.format("%s (%s): %s/%u ku (%s)",
item.type, item.number, techage.round(item.provided), item.available, item.termpoint)
@ -119,7 +139,8 @@ local function storages(pos)
local outdir = M(pos):get_int("outdir")
local resp = control.request(pos, Cable, outdir, "sto", "info")
for _, item in ipairs(resp) do
local name = item.type .. " (" .. item.number .. ")"
-- TA4/TA5 heatexchangers are no storage systems
if item.capa and item.capa > 1 then
if item.running then
local s = string.format("%s (%s): %s/%s kud",
item.type, item.number,
@ -134,11 +155,12 @@ local function storages(pos)
tbl[#tbl + 1] = s
end
end
end
table.sort(tbl)
return table.concat(tbl, "\n")
end
local function consumers(pos)
local function consumers(pos, min, max)
local tbl = {}
local outdir = M(pos):get_int("outdir")
local netw = networks.get_network_table(pos, Cable, outdir) or {}
@ -147,7 +169,17 @@ local function consumers(pos)
if number then
local name = techage.get_node_lvm(item.pos).name
name = (minetest.registered_nodes[name] or {}).description or "unknown"
tbl[#tbl + 1] = name .. " (" .. number .. ")"
local taken = techage.round(get_consumer_power_consumption(item.pos))
if taken > min and taken < max then
tbl[#tbl + 1] = string.format("%s (%s): %s ku", name, number, taken)
end
else
local name = techage.get_node_lvm(item.pos).name
name = (minetest.registered_nodes[name] or {}).description or "unknown"
local taken = techage.round(get_consumer_power_consumption(item.pos))
if taken > min and taken < max then
tbl[#tbl + 1] = string.format("%s: %s ku", name, taken)
end
end
end
table.sort(tbl)
@ -157,7 +189,7 @@ end
local function output(pos, command, text)
local meta = M(pos)
text = meta:get_string("output") .. "\n$ " .. command .. "\n" .. (text or "")
text = text:sub(-2000,-1)
text = text:sub(-5000,-1)
meta:set_string("output", text)
end
@ -177,8 +209,10 @@ local function command(pos, nvm, command)
output(pos, command, generators(pos))
elseif cmd == "sto" then
output(pos, command, storages(pos))
elseif cmd == "con" then
output(pos, command, consumers(pos))
elseif cmd == "con1" then
output(pos, command, consumers(pos, 1, 10))
elseif cmd == "con2" then
output(pos, command, consumers(pos, 9, 1000))
elseif command ~= "" then
output(pos, command, "")
end
@ -204,13 +238,18 @@ minetest.register_node("techage:ta3_power_terminal", {
},
},
after_place_node = function(pos)
after_place_node = function(pos, placer)
M(pos):set_int("outdir", networks.side_to_outdir(pos, "B"))
Cable:after_place_node(pos)
M(pos):set_string("formspec", formspec1(pos))
local number = techage.add_node(pos, "techage:ta3_power_terminal")
M(pos):set_string("node_number", number)
M(pos):set_string("owner", placer:get_player_name())
M(pos):set_string("infotext", S("TA3 Power Terminal").." "..number)
end,
after_dig_node = function(pos)
after_dig_node = function(pos, oldnode, oldmetadata, digger)
Cable:after_dig_node(pos)
techage.remove_node(pos, oldnode, oldmetadata)
techage.del_mem(pos)
end,
on_rightclick = function(pos, node, clicker)
@ -271,6 +310,28 @@ minetest.register_node("techage:ta3_power_terminal", {
power.register_nodes({"techage:ta3_power_terminal"}, Cable, "con", {"B"})
techage.register_node({"techage:ta3_power_terminal"}, {
on_recv_message = function(pos, src, topic, payload)
if topic == "load" then
local outdir = M(pos):get_int("outdir")
local value = networks.power.get_storage_percent(pos, Cable, outdir)
return techage.round(value)
else
return "unsupported"
end
end,
on_beduino_request_data = function(pos, src, topic, payload)
local nvm = techage.get_nvm(pos)
if topic == 134 then
local outdir = M(pos):get_int("outdir")
local value = networks.power.get_storage_percent(pos, Cable, outdir)
return 0, {math.floor(value + 0.5)}
else
return 2, ""
end
end,
})
minetest.register_craft({
output = "techage:ta3_power_terminal",
recipe = {

View File

@ -23,6 +23,7 @@ local PWR_CAPA = 2400 -- ticks (2s) with 1 ku ==> 80 min = 4 game days
local Cable = techage.ElectricCable
local power = networks.power
local control = networks.control
local function node_timer(pos, elapsed)
local nvm = techage.get_nvm(pos)
@ -46,7 +47,7 @@ local function node_timer(pos, elapsed)
power.start_storage_calc(pos, Cable, 5)
nvm.providing = true
else
nvm.provided = power.provide_power(pos, Cable, 5, PWR_PERF)
nvm.provided = power.provide_power(pos, Cable, 5, PWR_PERF, 0.8, 1.0)
nvm.capa = nvm.capa - nvm.provided
end
else
@ -105,6 +106,27 @@ minetest.register_node("techage:ta4_solar_minicell", {
power.register_nodes({"techage:ta4_solar_minicell"}, Cable, "gen", {"D"})
control.register_nodes({"techage:ta4_solar_minicell"}, {
on_receive = function(pos, tlib2, topic, payload)
end,
on_request = function(pos, tlib2, topic)
if topic == "info" then
local nvm = techage.get_nvm(pos)
local meta = M(pos)
return {
type = S("TA4 Streetlamp Solar Cell"),
number = meta:get_string("node_number") or "",
running = nvm.providing or false,
available = PWR_PERF,
provided = nvm.provided or 0,
termpoint = "80% - 100%",
}
end
return false
end,
}
)
techage.register_node({"techage:ta4_solar_minicell"}, {
on_recv_message = function(pos, src, topic, payload)
local nvm = techage.get_nvm(pos)

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2019-2021 Joachim Stolberg
Copyright (C) 2019-2023 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -21,6 +21,7 @@ local S2P = minetest.string_to_pos
local Cable = techage.ElectricCable
local Axle = techage.Axle
local power = networks.power
local control = networks.control
local CYCLE_TIME = 2
local PWR_PERF = 24
@ -45,9 +46,7 @@ local function node_timer_on(pos, elapsed)
nvm.buffer = nvm.buffer + taken - 1 -- some loss
if nvm.buffer >= PWR_PERF then
local tp1 = tonumber(meta:get_string("termpoint1"))
local tp2 = tonumber(meta:get_string("termpoint2"))
nvm.provided = power.provide_power(pos, Cable, outdir, PWR_PERF, tp1, tp2)
nvm.provided = power.provide_power(pos, Cable, outdir, PWR_PERF, 0.8, 1.0)
nvm.load = power.get_storage_load(pos, Cable, outdir, PWR_PERF)
nvm.buffer = nvm.buffer - nvm.provided
end
@ -172,6 +171,27 @@ techage.register_node({"techage:ta2_generator_off", "techage:ta2_generator_on"},
power.register_nodes({"techage:ta2_generator_off", "techage:ta2_generator_on"}, Axle, "con", {"L"})
power.register_nodes({"techage:ta2_generator_off", "techage:ta2_generator_on"}, Cable, "gen", {"R"})
control.register_nodes({"techage:ta2_generator_off", "techage:ta2_generator_on"}, {
on_receive = function(pos, tlib2, topic, payload)
end,
on_request = function(pos, tlib2, topic)
if topic == "info" then
local nvm = techage.get_nvm(pos)
local meta = M(pos)
return {
type = S("TA2 Power Generator"),
number = "---",
running = true,
available = PWR_PERF,
provided = nvm.provided or 0,
termpoint = "80% - 100%",
}
end
return false
end,
}
)
minetest.register_craft({
output = "techage:ta2_generator_off",
recipe = {

View File

@ -22,6 +22,7 @@ local fuel = techage.fuel
local Pipe = techage.LiquidPipe
local power = networks.power
local liquid = networks.liquid
local control = networks.control
local CYCLE_TIME = 2
local STANDBY_TICKS = 1
@ -327,6 +328,27 @@ local liquid_def = {
power.register_nodes({"techage:tiny_generator", "techage:tiny_generator_on"}, Cable, "gen", {"R"})
liquid.register_nodes({"techage:tiny_generator", "techage:tiny_generator_on"}, Pipe, "tank", nil, liquid_def)
control.register_nodes({"techage:tiny_generator", "techage:tiny_generator_on"}, {
on_receive = function(pos, tlib2, topic, payload)
end,
on_request = function(pos, tlib2, topic)
if topic == "info" then
local nvm = techage.get_nvm(pos)
local meta = M(pos)
return {
type = S("TA3 Tiny Power Generator"),
number = meta:get_string("node_number") or "",
running = techage.is_running(nvm) or false,
available = PWR_PERF,
provided = nvm.provided or 0,
termpoint = meta:get_string("termpoint"),
}
end
return false
end,
}
)
techage.register_node({"techage:tiny_generator", "techage:tiny_generator_on"}, {
on_recv_message = function(pos, src, topic, payload)
local nvm = techage.get_nvm(pos)

View File

@ -28,8 +28,8 @@ local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2
local PWR_NEEDED = 12
local EX_POINTS = 60
local MAX_DIST = 200
local EX_POINTS = 30
local MAX_DIST = 500
local DESCRIPTION = S("TA5 Teleport Block Liquids")
local function formspec(self, pos, nvm)

View File

@ -27,8 +27,8 @@ local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2
local PWR_NEEDED = 12
local EX_POINTS = 60
local MAX_DIST = 200
local EX_POINTS = 30
local MAX_DIST = 500
local DESCRIPTION = S("TA5 Teleport Block Items")
local function formspec(self, pos, nvm)

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B