v0.20 with improvements and bugfixes

This commit is contained in:
Joachim Stolberg 2020-07-31 12:41:04 +02:00
parent c1c7af6acc
commit c6082ef8ce
6 changed files with 28 additions and 2 deletions

View File

@ -31,6 +31,8 @@ Copyright (C) 2019-2020 Joachim Stolberg
Code: Licensed under the GNU GPL version 3 or later. See LICENSE.txt
Textures: CC BY-SA 3.0
Many thanks to Thomas-S for his contributions
### Dependencies
Required: default, doors, bucket, stairs, screwdriver, basic_materials, tubelib2, minecart, lcdlib, safer_lua
@ -75,6 +77,12 @@ Available worlds will be converted to 'lsqlite3', but there is no way back, so:
### History
**2020-07-31 V0.20**
- Pull request #21: Lua Controller: Allow to get itemstring and description of 8x2000 chest contents (from Thomas-S)
- Pull request #22: Trowel: Prevent hidden nodes from being dug (from Thomas-S)
- Improvement: TA3 Power Terminal: Outputs max needed power in addition
- Bugfix: Quarry: Shall not dig Techage Light Blocks
**2020-07-24 V0.19**
- Pull request #19: Refactor ICTA to use functions instead of loadstring (from Thomas-S)
- State command added for cart-, node-, and player detectors

View File

@ -26,7 +26,7 @@ local networks = techage.networks
local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2
local PWR_CAPA = 20
local PWR_CAPA = 100
local function formspec(self, pos, nvm)
return "size[4,4]"..

View File

@ -164,6 +164,7 @@ end
function techage.dropped_node(node, ndef)
if node.name == "air" then return end
--if ndef.buildable_to == true then return end
if not ndef.diggable then return end
if ndef.drop == "" then return end
if type(ndef.drop) == "table" then
return handle_drop(ndef.drop)

View File

@ -39,6 +39,7 @@ minetest.register_node("techage:lightblock", {
floodable = true,
is_ground_content = false,
groups = {not_in_creative_inventory=1},
drop = "",
})
function techage.light_ring(center_pos, on, large)

View File

@ -147,3 +147,16 @@ function techage.power.power_distribution(network, tlib_type, netID, cycle_time)
set_taken_values(network.con2, 0, tlib_type)
end
end
-- determine the maxiumum needed power of all con1 consumers
function techage.power.get_con1_sum(network, tlib_type)
local sum = 0
for _,v in ipairs(network.con1 or {}) do
local nvm = techage.get_nvm(v.pos)
local def = nvm[tlib_type] -- power related network data
if def and def["cstate"] ~= STOPPED then
sum = sum + v.nominal
end
end
return sum
end

View File

@ -188,11 +188,14 @@ end
local function get_state(netw)
local state = ""
local needed = techage.power.get_con1_sum(netw, "ele1") or 0
if #(netw.gen1 or {}) + #(netw.gen2 or {}) == 0 then
state = S("No power grid or running generator!")
elseif needed > (netw.available1 or 0) then
state = S("Probably too many consumers (")..needed..S(" ku is needed!)")
elseif (netw.num_nodes or 0) < techage.networks.MAX_NUM_NODES then
state = S("Number of power grid blocks")..": "..(netw.num_nodes or 0)
state = S("Number of power grid blocks")..": "..(netw.num_nodes or 0)..", "..S("Max. needed power")..": "..needed.. " ku"
else
state = S("To many blocks in the power grid!")
end