mesecons converter added
This commit is contained in:
parent
516d3186b3
commit
56c84fcbd2
@ -35,7 +35,7 @@ Textures: CC BY-SA 3.0
|
||||
### Dependencies
|
||||
Required: default, doors, bucket, stairs, screwdriver, basic_materials, tubelib2, minecart, lcdlib, safer_lua
|
||||
Recommended: signs_bot, hyperloop, compost, techpack_stairway, autobahn
|
||||
Optional: unified_inventory, wielded_light, unifieddyes, lua-mashal, lsqlite3, moreores
|
||||
Optional: unified_inventory, wielded_light, unifieddyes, lua-mashal, lsqlite3, moreores, ethereal, mesecon
|
||||
|
||||
|
||||
The mods `default`, `doors`, `bucket`, `stairs`, and `screwdriver` are part of Minetest Game.
|
||||
@ -87,7 +87,8 @@ to 'lsqlite3' and 'lua-marshal', but there is no way back, so:
|
||||
- 2020-04-26 V0.07 * English translation added
|
||||
- 2020-05-22 V0.08 * Support for 'lua-marshal' and 'lsqlite3' added
|
||||
- 2020-05-31 V0.09 * TA4 tubes upgraded, manuals updated
|
||||
- 2020-06-04 V0.10 * minor changes and bugfixes
|
||||
- 2020-06-14 V0.11 * cart commands added for both controllers, support for moreores added
|
||||
- 2020-06-17 V0.12 * Ethereal support added, manual correction, tin ingot recipe bugfix
|
||||
- 2020-06-04 V0.10 * minor changes and bugfixes
|
||||
- 2020-06-14 V0.11 * cart commands added for both controllers, support for moreores added
|
||||
- 2020-06-17 V0.12 * Ethereal support added, manual correction, tin ingot recipe bugfix
|
||||
- 2020-06-19 V0.13 * Mesecons Converter added
|
||||
|
||||
|
@ -111,6 +111,7 @@ techage.Items = {
|
||||
ta3_drill_pipe_wrench = "techage:ta3_drill_pipe_wrench",
|
||||
ta3_pipe = "techage:ta3_pipeS",
|
||||
ta3_pipe_wall_entry = "techage:ta3_pipe_wall_entry",
|
||||
ta3_mesecons_converter = "techage:ta3_mesecons_converter",
|
||||
----------------------------
|
||||
techage_ta4 = "techage_ta4.png",
|
||||
ta4_windturbine = "techage:ta4_wind_turbine",
|
||||
|
@ -99,6 +99,7 @@ techage.manual_DE.aTitel = {
|
||||
"3,TechAge Signallampe / Signal Lamp",
|
||||
"3,Tür/Tor Blöcke / Door/Gate Blocks",
|
||||
"3,TA3 Tür Controller / Door Controller",
|
||||
"3,TA3 Mesecons Umsetzer / TA3 Mesecons Converter",
|
||||
"2,Detektoren",
|
||||
"3,TA3 Detektor / Detector",
|
||||
"3,TA3 Wagen Detektor / Cart Detector",
|
||||
@ -934,6 +935,13 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Der Mesecons Umsetzer dient zur Umwandlung von Techage on/off Kommandos in Mesecons Signale und umgekehrt.\n"..
|
||||
"Dazu müssen eine oder mehrere Knotennummern eingegeben und der Konverter mit Mesecons Blöcken \n"..
|
||||
"über Mesecons Leitungen verbunden werden. Den Mesecons Umsetzer kann man auch mit dem Programmer konfigurieren.\n"..
|
||||
"Der Mesecons Umsetzer akzeptiert bis zu 5 Kommandos pro Sekunde\\, bei höherer Belastung schaltet er sich ab.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Detektoren scannen ihre Umgebung ab und senden ein 'on'-Kommando\\, wenn das Gesuchte erkannt wurde.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
@ -1566,6 +1574,7 @@ techage.manual_DE.aItemName = {
|
||||
"ta3_signallamp",
|
||||
"ta3_doorblock",
|
||||
"ta3_doorcontroller",
|
||||
"ta3_mesecons_converter",
|
||||
"ta3_nodedetector",
|
||||
"ta3_detector",
|
||||
"ta3_cartdetector",
|
||||
@ -1771,6 +1780,7 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta4_windturbine",
|
||||
"",
|
||||
"",
|
||||
|
@ -99,6 +99,7 @@ techage.manual_EN.aTitel = {
|
||||
"3,TechAge Signal Lamp",
|
||||
"3,Door/Gate Blocks",
|
||||
"3,TA3 Door Controller",
|
||||
"3,TA3 Mesecons Converter",
|
||||
"2,Detectors",
|
||||
"3,TA3 Detector",
|
||||
"3,TA3 Cart Detector",
|
||||
@ -932,6 +933,13 @@ techage.manual_EN.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"The Mesecons converter is used to convert Techage on/off commands into Mesecons signals and vice versa.\n"..
|
||||
"To do this\\, one or more node numbers must be entered and the converter with Mesecons blocks\n"..
|
||||
"has to be connected via Mesecons cables. The Mesecons converter can also be configured with the programmer.\n"..
|
||||
"The Mesecons converter accepts up to 5 commands per second\\; it switches itself off at higher loads.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Detectors scan their surroundings and send an 'on' command when the search is recognized.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
@ -1556,6 +1564,7 @@ techage.manual_EN.aItemName = {
|
||||
"ta3_signallamp",
|
||||
"ta3_doorblock",
|
||||
"ta3_doorcontroller",
|
||||
"ta3_mesecons_converter",
|
||||
"ta3_nodedetector",
|
||||
"ta3_detector",
|
||||
"ta3_cartdetector",
|
||||
@ -1761,6 +1770,7 @@ techage.manual_EN.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta4_windturbine",
|
||||
"",
|
||||
"",
|
||||
|
5
init.lua
5
init.lua
@ -13,7 +13,7 @@
|
||||
techage = {}
|
||||
|
||||
-- Version for compatibility checks, see readme.md/history
|
||||
techage.version = 0.12
|
||||
techage.version = 0.13
|
||||
|
||||
if minetest.global_exists("tubelib") then
|
||||
minetest.log("error", "[techage] Techage can't be used together with the mod tubelib!")
|
||||
@ -223,6 +223,9 @@ dofile(MP.."/logic/gateblock.lua")
|
||||
dofile(MP.."/logic/doorblock.lua")
|
||||
dofile(MP.."/logic/doorcontroller.lua")
|
||||
dofile(MP.."/logic/collector.lua")
|
||||
if minetest.global_exists("mesecon") then
|
||||
dofile(MP.."/logic/mesecons_converter.lua")
|
||||
end
|
||||
|
||||
-- Test
|
||||
dofile(MP.."/recipe_checker.lua")
|
||||
|
@ -215,6 +215,7 @@ TA1 Melting Pot=TA1 Schmelztiegel
|
||||
TA1 Meridium Hammer (smash stone to gravel)=TA1 Meridiumhammer (zerschlage Stein zu Kies)
|
||||
TA1 Mese Hammer (smash stone to gravel)=TA1 Mesehammer (zerschlage Stein zu Kies)
|
||||
TA1 Steel Hammer (smash stone to gravel)=TA1 Stahlhammer (zerschlage Stein zu Kies)
|
||||
TA1 Stone Hammer (smash stone to gravel)=TA1 Steinhammer (zerschlage Stein zu Kies)
|
||||
TA2 Boiler Base=TA2 Boiler unten
|
||||
TA2 Boiler Top=TA2 Boiler oben
|
||||
TA2 Cylinder=TA2 Zylinder
|
||||
@ -261,6 +262,7 @@ TA3 Generator=TA3 Generator
|
||||
TA3 Gravel Sieve=TA3 Kiessieb
|
||||
TA3 Logic Block=TA3 Logikblock
|
||||
TA3 Melting=TA3 Schmelzen
|
||||
TA3 Mesecons Converter=TA3 Mesecons Konverter
|
||||
TA3 Naphtha=TA3 Naphtha
|
||||
TA3 Naphtha Barrel=TA3 Naphtha-Fass
|
||||
TA3 Naphtha Canister=TA3 Naphtha-Kanister
|
||||
|
@ -213,6 +213,7 @@ TA1 Melting Pot=
|
||||
TA1 Meridium Hammer (smash stone to gravel)=
|
||||
TA1 Mese Hammer (smash stone to gravel)=
|
||||
TA1 Steel Hammer (smash stone to gravel)=
|
||||
TA1 Stone Hammer (smash stone to gravel)=
|
||||
TA2 Boiler Base=
|
||||
TA2 Boiler Top=
|
||||
TA2 Cylinder=
|
||||
@ -259,6 +260,7 @@ TA3 Generator=
|
||||
TA3 Gravel Sieve=
|
||||
TA3 Logic Block=
|
||||
TA3 Melting=
|
||||
TA3 Mesecons Converter=
|
||||
TA3 Naphtha=
|
||||
TA3 Naphtha Barrel=
|
||||
TA3 Naphtha Canister=
|
||||
|
147
logic/mesecons_converter.lua
Normal file
147
logic/mesecons_converter.lua
Normal file
@ -0,0 +1,147 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2017-2020 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Mesecons converter
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local logic = techage.logic
|
||||
local OVER_LOAD_MAX = 10
|
||||
local CYCLE_TIME = 2
|
||||
|
||||
local function formspec(meta)
|
||||
local numbers = meta:get_string("numbers") or ""
|
||||
return "size[7.5,3]"..
|
||||
"field[0.5,1;7,1;numbers;"..S("Insert destination node number(s)")..";"..numbers.."]" ..
|
||||
"button_exit[2,2;3,1;exit;"..S("Save").."]"
|
||||
end
|
||||
|
||||
local function send_message(pos, topic)
|
||||
local meta = M(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.overload_cnt = (mem.overload_cnt or 0) + 1
|
||||
if mem.overload_cnt > OVER_LOAD_MAX then
|
||||
logic.infotext(M(pos), S("TA3 Mesecons Converter"), "fault (overloaded)")
|
||||
minetest.get_node_timer(pos):stop()
|
||||
return false
|
||||
end
|
||||
local own_num = meta:get_string("node_number")
|
||||
local numbers = meta:get_string("numbers")
|
||||
techage.send_multi(own_num, numbers, topic)
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta3_mesecons_converter", {
|
||||
description = S("TA3 Mesecons Converter"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta3.png^techage_frame_ta3_top.png",
|
||||
"techage_filling_ta3.png^techage_frame_ta3_top.png",
|
||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_mesecons_converter.png",
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = M(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
logic.after_place_node(pos, placer, "techage:ta3_mesecons_converter", S("TA3 Mesecons Converter"))
|
||||
logic.infotext(meta, S("TA3 Mesecons Converter"))
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
mem.overload_cnt = 0
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
mesecon.on_placenode(pos, minetest.get_node(pos))
|
||||
end,
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local meta = M(pos)
|
||||
if techage.check_numbers(fields.numbers, player:get_player_name()) then
|
||||
meta:set_string("numbers", fields.numbers)
|
||||
logic.infotext(M(pos), S("TA3 Mesecons Converter"))
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end,
|
||||
|
||||
on_timer = function(pos,elapsed)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.overload_cnt = 0
|
||||
return true
|
||||
end,
|
||||
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
local meta = M(pos)
|
||||
local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Mesecons Converter"))
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
return res
|
||||
end,
|
||||
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = mesecon.state.off,
|
||||
rules = mesecon.rules.default,
|
||||
},
|
||||
effector = {
|
||||
rules = mesecon.rules.default,
|
||||
action_on = function(pos, node)
|
||||
send_message(pos, "on")
|
||||
end,
|
||||
action_off = function(pos, node)
|
||||
send_message(pos, "off")
|
||||
end,
|
||||
action_change = function(pos, node)
|
||||
send_message(pos, "change")
|
||||
end,
|
||||
}
|
||||
},
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
mesecon.on_dignode(pos, oldnode)
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta3_mesecons_converter",
|
||||
recipe = {
|
||||
{"techage:ta3_repeater", "mesecons:wire_00000000_off"},
|
||||
},
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta3_mesecons_converter"}, {
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.overload_cnt = (mem.overload_cnt or 0) + 1
|
||||
if mem.overload_cnt > OVER_LOAD_MAX then
|
||||
logic.infotext(M(pos), S("TA3 Mesecons Converter"), "fault (overloaded)")
|
||||
minetest.get_node_timer(pos):stop()
|
||||
return false
|
||||
elseif topic == "on" then
|
||||
mesecon.receptor_on(pos, mesecon.rules.default)
|
||||
elseif topic == "off" then
|
||||
mesecon.receptor_off(pos, mesecon.rules.default)
|
||||
end
|
||||
end,
|
||||
on_node_load = function(pos)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end,
|
||||
})
|
@ -592,6 +592,14 @@ Der Tür Controller dient zur Ansteuerung der TA3 Tür/Tor Blöcke. Beim Tür Co
|
||||
|
||||
[ta3_doorcontroller|image]
|
||||
|
||||
### TA3 Mesecons Umsetzer / TA3 Mesecons Converter
|
||||
|
||||
Der Mesecons Umsetzer dient zur Umwandlung von Techage on/off Kommandos in Mesecons Signale und umgekehrt.
|
||||
Dazu müssen eine oder mehrere Knotennummern eingegeben und der Konverter mit Mesecons Blöcken
|
||||
über Mesecons Leitungen verbunden werden. Den Mesecons Umsetzer kann man auch mit dem Programmer konfigurieren.
|
||||
Der Mesecons Umsetzer akzeptiert bis zu 5 Kommandos pro Sekunde, bei höherer Belastung schaltet er sich ab.
|
||||
|
||||
[ta3_mesecons_converter|image]
|
||||
|
||||
|
||||
## Detektoren
|
||||
|
@ -590,6 +590,16 @@ The door controller is used to control the TA3 door/gate blocks. With the door c
|
||||
[ta3_doorcontroller|image]
|
||||
|
||||
|
||||
### TA3 Mesecons Converter
|
||||
|
||||
The Mesecons converter is used to convert Techage on/off commands into Mesecons signals and vice versa.
|
||||
To do this, one or more node numbers must be entered and the converter with Mesecons blocks
|
||||
has to be connected via Mesecons cables. The Mesecons converter can also be configured with the programmer.
|
||||
The Mesecons converter accepts up to 5 commands per second; it switches itself off at higher loads.
|
||||
|
||||
[ta3_mesecons_converter|image]
|
||||
|
||||
|
||||
|
||||
## Detectors
|
||||
|
||||
|
@ -98,6 +98,7 @@
|
||||
- [TechAge Signallampe / Signal Lamp](./manual_ta3_DE.md#techage-signallampe--signal-lamp)
|
||||
- [Tür/Tor Blöcke / Door/Gate Blocks](./manual_ta3_DE.md#türtor-blöcke--doorgate-blocks)
|
||||
- [TA3 Tür Controller / Door Controller](./manual_ta3_DE.md#ta3-tür-controller--door-controller)
|
||||
- [TA3 Mesecons Umsetzer / TA3 Mesecons Converter](./manual_ta3_DE.md#ta3-mesecons-umsetzer--ta3-mesecons-converter)
|
||||
- [Detektoren](./manual_ta3_DE.md#detektoren)
|
||||
- [TA3 Detektor / Detector](./manual_ta3_DE.md#ta3-detektor--detector)
|
||||
- [TA3 Wagen Detektor / Cart Detector](./manual_ta3_DE.md#ta3-wagen-detektor--cart-detector)
|
||||
|
@ -98,6 +98,7 @@
|
||||
- [TechAge Signal Lamp](./manual_ta3_EN.md#techage-signal-lamp)
|
||||
- [Door/Gate Blocks](./manual_ta3_EN.md#doorgate-blocks)
|
||||
- [TA3 Door Controller](./manual_ta3_EN.md#ta3-door-controller)
|
||||
- [TA3 Mesecons Converter](./manual_ta3_EN.md#ta3-mesecons-converter)
|
||||
- [Detectors](./manual_ta3_EN.md#detectors)
|
||||
- [TA3 Detector](./manual_ta3_EN.md#ta3-detector)
|
||||
- [TA3 Cart Detector](./manual_ta3_EN.md#ta3-cart-detector)
|
||||
|
2
mod.conf
2
mod.conf
@ -1,4 +1,4 @@
|
||||
name = techage
|
||||
depends = default,doors,tubelib2,basic_materials,bucket,stairs,screwdriver,minecart,lcdlib,safer_lua
|
||||
optional_depends = unified_inventory,wielded_light,unifieddyes,moreores, ethereal
|
||||
optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecon
|
||||
description = Techage, go through 4 tech ages in search of wealth and power!
|
||||
|
BIN
textures/techage_appl_mesecons_converter.png
Normal file
BIN
textures/techage_appl_mesecons_converter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 301 B |
Loading…
Reference in New Issue
Block a user