Go to file
Joachim Stolberg 0919d44163 Prepare for use with techage 2021-06-06 15:16:38 +02:00
test Prepare for use with techage 2021-06-06 15:16:38 +02:00
textures Add liquid, bug fixes and improvements 2021-06-03 15:56:29 +02:00
README.md Add control API 2021-06-04 10:59:59 +02:00
control.lua Add control API 2021-06-04 10:59:59 +02:00
hidden.lua Prepare for use with techage 2021-06-06 15:16:38 +02:00
init.lua Prepare for use with techage 2021-06-06 15:16:38 +02:00
junction.lua Change power API 2021-05-30 22:48:25 +02:00
liquid.lua Prepare for use with techage 2021-06-06 15:16:38 +02:00
mod.conf first shot 2021-05-23 21:55:39 +02:00
networks.lua Prepare for use with techage 2021-06-06 15:16:38 +02:00
power.lua Prepare for use with techage 2021-06-06 15:16:38 +02:00
screenshot.png Add switch, tool, and hide/open feature. Bug fixes and improvements 2021-05-24 21:23:25 +02:00

README.md

Networks [networks]

A library to build and manage networks based on tubelib2 tubes, pipes, or cables.

This library is heavily under development. API changes and crashes are likely!

networks

Power Networks

Power networks consists of following node types:

  • Generators, nodes providing power
  • Consumers, nodes consuming power
  • Storage nodes, nodes storing power
  • Cables, to build power connections
  • Junctions, to connect point to point connection to networks
  • Switches, to turn on/off network segments

All storage nodes in a network form a storage system. Storage systems are required as buffers. Generators "charge" the storage system, consumers "discharge" the storage system.

Charging the storage system follows a degressive/adaptive charging curve. When the storage system is 50% full, the charging load is continuously reduced. This ensures that all generators are loaded in a balanced manner.

Cables, junctions, and switches can be hidden under blocks (plastering) and opened again with a tool. This makes power installations in buildings more realistic. The mod uses a whitelist for filling material. The function networks.register_filling_items is used to register node names.

Liquid Networks

Liquid networks consists of following node types:

  • Pumps, nodes pumping liquids from/to tanks
  • Tanks, storuing liquids
  • Junctions, to connect pipes to networks
  • Valves, to turn on/off pipe segments

Control

In addition to any network the 'control' API can be used to send commands or request data from nodes, specified via 'node_type'.

Test Nodes

The file ./test/test_power.lua contains test nodes of each kind of power nodes. It can be used to play with the features and to study the use of networks.

  • [G] a generator, which provides 20 units of power every 2 s
  • [C] a consumer, which need 5 units of power every 2 s
  • [S] a storage with 500 units capacity

All three nodes can be turned on/off by right-clicking.

  • cable node for power transportation
  • junction node for power distribution
  • a power switch to turn on/off consumers
  • a tool to hide/open cables and junctions

The file ./test/test_liquid.lua contains test nodes of each kind of liquid nodes.

  • [P] a pump which pumps 2 items every 2 s
  • [T] tree types of tanks (empty, milk, water)
  • junction node
  • a value to connect/disconnect pipes

The file ./test/test_control.lua contains server [S] and client [C] nodes to demonstrate simple on/off commands.

License

Copyright (C) 2021 Joachim Stolberg
Code: Licensed under the GNU AGPL version 3 or later. See LICENSE.txt
Textures: CC BY-SA 3.0

Dependencies

Required: tubelib2

History

2021-05-23 V0.01

  • First shot

2021-05-24 V0.02

  • Add switch
  • Add tool and hide/open feature
  • bug fixes and improvements

2021-05-25 V0.03

  • Add function networks.get_power_data
  • bug fixes and improvements

2021-05-29 V0.04

  • bug fixes and improvements

2021-05-30 V0.05

  • Change power API

2021-06-03 V0.06

  • Add 'liquid'
  • bug fixes and improvements

2021-06-04 V0.07

  • Add 'control' API