29 Commits

Author SHA1 Message Date
9cf5fab245 technic_cnc: Use client-side translation API 2024-03-29 13:34:34 +01:00
d5ff69d1d9 Add Everness sandstone compressor recipes (#634) 2024-03-25 19:45:57 +01:00
f47da0c045 Add grinding for pyrite from Everness mod (#633)
Add recipe for grinding pyrite lump from everness mod into pyrite dust if everness mod is present (also includes images for pyrite dust).
2024-03-08 18:44:13 +01:00
a08ba2bb93 Get rid of deprecated metadata (#628)
The deprecated metadata gets converted to a proper ItemStackMetaRef.
All keys stay the same except for:
- Cans that use `can_level` now, since they didn't store a serialized table in the metadata before.
- `charge` which is now `technic:charge`, since any item (also from other mods) may have a technic charge which can cause compatibility problems.

Backwards compatibility is kept but going back to older `technic` versions might result in misbehaving circuits.
2024-01-22 18:27:54 +01:00
410e341da5 HV Reactor: Improve formspec layout 2024-01-09 21:51:08 +01:00
5826c2feaa Fix outdated dependency links (#627) 2024-01-06 12:26:20 +01:00
b221d69717 Remove duplicated textures
Now the ingot textures provided by commit 83e9cab3 are loaded
2023-12-19 18:59:46 +01:00
a296446da1 Add granite brick node (#593) 2023-12-19 18:25:45 +01:00
49d4105a2b Quarry: revert startpos+1 air-like node check
Quarries are also deployed in entirely solid underground, where
it is expected that the quarry produces a new shaft from scratch.
2023-10-01 10:47:59 +02:00
fda8a3d042 Quarry: Allow digging in different airlike environments
This offloads the digging check to a separate function for better code separation.
2023-09-23 13:25:11 +02:00
dfcf64c1d0 Chainsaw: new setting to disable safe cutting
Some trees might generate with param2 != 0, which makes the
chainsaw appear blunt/useless. This safety feature is now
customizable.
2023-08-26 10:57:05 +02:00
0921c326a8 Chainsaw: fix occasional error on startup
This also tweaks the cost function to make the chainsaw a bit less powerful.
2023-08-03 21:28:41 +02:00
9b7c44b453 Wrench: Fix node registration from other mods 2023-01-29 13:11:37 +01:00
86e083c409 Document a few derived textures
Thanks to cx384 for providing this input
2023-01-11 20:43:06 +01:00
21e044478e Fix battery box charging issues caused by out of sync functions
This code should be merged in the future to avoid such issues.
2022-11-26 23:25:33 +01:00
521c0b74bb Fix battery box charging on Windows 2022-11-24 21:49:20 +01:00
aad1b2875a Add Japanese translation (#613) 2022-11-17 19:59:39 +01:00
66e20a9231 Add register_cable_tier API function (#612) 2022-11-04 19:23:44 +01:00
705961e2fe Supply converter: Charge batteries again 2022-11-01 20:27:26 +01:00
6a9dfec36f Batteries: Workaround to fix discharge (#609)
The network traversal code does still not handle connecting sides,
but at least finite power is no more.
2022-10-29 21:36:48 +02:00
d4609f23f2 Chests: Use prepend styling and re-order elements (#608) 2022-10-29 21:36:33 +02:00
091bb2406d Chainsaw: Add certain dftrees "fruit"-like nodes 2022-10-26 19:17:40 +02:00
c40189eabf Export technic_music_player_top.png to PNG, run optipng 2022-10-25 18:17:45 +02:00
f61bb82bd1 add recipes to grind all sand types into stone dust
idea from https://github.com/minetest-mods/technic/issues/573
2022-10-25 18:08:28 +02:00
7d39136764 Chainsaw: Partial rewrite, various improvements (#607)
Introduces protection checks for the entire tree
More efficient node digging (VoxelManip)
Improved drop handling using detached inventories for correct stack sizes

Approximate speed-up of approx. 7x compared to the previous code for a giant sequoia.
2022-10-25 18:03:51 +02:00
4775d98fb7 Unify and simplify LED/Lamp node definition 2022-10-20 20:08:56 +02:00
d623715d94 Add LV led and lamp 2022-10-20 18:28:45 +02:00
718a5beda1 Supply converter: demany only the needed power (#577)
Supply converter demands only the needed power to satisfy the demand on the output network. It can still be too much if the output network has other power sources, because supply is not taken in account.

This surplus of energy can be used to charge batteries.
2022-10-20 17:56:10 +02:00
fa39b24ed5 Document lead and sulfur 2022-10-19 21:51:09 +02:00
161 changed files with 1251 additions and 824 deletions

View File

@ -15,10 +15,10 @@ world. A few notable features:
* Minetest 5.0.0 or newer
* [Minetest Game](https://github.com/minetest/minetest_game/)
* [mesecons](https://github.com/minetest-mods/mesecons) -> signalling events
* [pipeworks](https://gitlab.com/VanessaE/pipeworks/) -> automation of item transport
* [pipeworks](https://github.com/mt-mods/pipeworks) -> automation of item transport
* [moreores](https://github.com/minetest-mods/moreores/) -> additional ores
* [basic_materials](https://gitlab.com/VanessaE/basic_materials) -> basic craft items
* Supports [moretrees](https://gitlab.com/VanessaE/moretrees) -> rubber trees
* [basic_materials](https://github.com/mt-mods/basic_materials) -> basic craft items
* Supports [moretrees](https://github.com/mt-mods/moretrees) -> rubber trees
* Consult `depends.txt` or `mod.conf` of each mod for further dependency information.

9
concrete/locale/ja.txt Normal file
View File

@ -0,0 +1,9 @@
# technic_concrete japanese translation
# technic_concreteの日本語への翻訳
# by damiemk
Rebar = 鉄筋
Concrete Block = コンクリートのブロック
Blast-resistant Concrete Block = 耐爆性コンクリートのブロック
Concrete Post Platform = コンクリートのプラットフォーム
Concrete Post = コンクリートポスト

View File

@ -27,6 +27,12 @@ if minetest.get_modpath("moreblocks") then
tiles={"technic_granite.png"},
})
stairsplus:register_all("technic", "granite_bricks", "technic:granite_bricks", {
description=S("Granite Bricks"),
groups={cracky=1, not_in_creative_inventory=1},
tiles={"technic_granite_bricks.png"},
})
stairsplus:register_all("technic", "concrete", "technic:concrete", {
description=S("Concrete"),
groups={cracky=3, not_in_creative_inventory=1},

8
extranodes/locale/ja.txt Normal file
View File

@ -0,0 +1,8 @@
# technic_extranodes japanese translation
# technic_extranodesの日本語への翻訳
# by damiemk
Marble = 大理石
Marble Bricks = 大理石のレンガ
Granite = 花崗岩
Concrete = コンクリート

104
manual.md
View File

@ -34,6 +34,11 @@ Note ¹: *These ores are provided by Minetest Game. See [Ores](https://wiki.mine
Note ²: *These ores are provided by moreores. TODO: Add reference link*
#### Chromium
Use: stainless steel
Generated below: -100m, more commonly below -200m
#### Coal ¹
Use: Fuel, alloy as carbon
@ -41,33 +46,61 @@ Burning coal is a way to generate electrical power. Coal is also used,
usually in dust form, as an ingredient in alloying recipes, wherever
elemental carbon is required.
#### Iron ¹
Use: multiple, mainly for alloys with carbon (coal).
#### Copper ¹
Copper is a common metal, used either on its own for its electrical
conductivity, or as the base component of alloys.
Although common, it is very heavily used, and most of the time it will
be the material that most limits your activity.
#### Diamond ¹
Use: mainly for cutting machines
Diamond is a precious gemstone. It is used moderately, mainly for reasons
connected to its extreme hardness.
#### Gold ¹
Use: various
Generated below: -64m, more commonly below -256m
Gold is a precious metal. It is most notably used in electrical items due to
its combination of good conductivity and corrosion resistance.
#### Iron ¹
Use: multiple, mainly for alloys with carbon (coal).
#### Lead
Use: batteries, HV nuclear reactor layout
Generated below: 16m, more common below -128m
#### Mese ¹
Use: various
Mese is a precious gemstone, and unlike diamond it is entirely fictional.
It is used in small quantities, wherever some magic needs to be imparted.
#### Mithril ²
Use: chests
Generated below: -512m, evenly common
Mithril is a fictional ore, being derived from J. R. R. Tolkien's
Middle-Earth setting. It is little used.
#### Silver ²
Use: conductors
Generated below: -2m, evenly common
Silver is a semi-precious metal and is the best conductor of all the pure elements.
#### Tin ¹
Use: batteries, bronze
Tin is a common metal but is used rarely. Its abundance is well in excess
of its usage, so you will usually have a surplus of it.
#### Zinc
Use: brass
Generated below: 2m, more commonly below -32m
Zinc only has a few uses but is a common metal.
#### Chromium
Use: stainless steel
Generated below: -100m, more commonly below -200m
#### Uranium
Use: nuclear reactor fuel
@ -79,40 +112,13 @@ shielding materials available.
Keep a safety distance of a meter to avoid being harmed by radiation.
#### Silver ²
Use: conductors
#### Zinc
Use: brass
Generated below: -2m, evenly common
Generated below: 2m, more commonly below -32m
Silver is a semi-precious metal and is the best conductor of all the pure elements.
Zinc only has a few uses but is a common metal.
#### Gold ¹
Use: various
Generated below: -64m, more commonly below -256m
Gold is a precious metal. It is most notably used in electrical items due to
its combination of good conductivity and corrosion resistance.
#### Mithril ²
Use: chests
Generated below: -512m, evenly common
Mithril is a fictional ore, being derived from J. R. R. Tolkien's
Middle-Earth setting. It is little used.
#### Mese ¹
Use: various
Mese is a precious gemstone, and unlike diamond it is entirely fictional.
It is used in small quantities, wherever some magic needs to be imparted.
#### Diamond ¹
Use: mainly for cutting machines
Diamond is a precious gemstone. It is used moderately, mainly for reasons
connected to its extreme hardness.
### 2.2 Rocks
@ -136,6 +142,12 @@ Granite is found in dense clusters and is much harder to dig than standard
stone. It has mainly decorative use, but also appears in a couple of
machine recipes.
#### Sulfur
Uses: battery box
Sulur is generated around some lava patches (caves).
### 2.3 Rubber
Rubber is a biologically-derived material that has industrial uses due
to its electrical resistivity and its impermeability. In technic, it

View File

@ -1 +1,3 @@
name = technic
description = technic
min_minetest_version = 5.0

9
settingtypes.txt Normal file
View File

@ -0,0 +1,9 @@
# Safety feature for the chainsaw tool aimed to prevent cutting structures
# built by players.
#
# Trunk nodes generated by mapgen have a rotation of '0' whereas manually
# placed trunks usually have another value. However, some mods might generate
# trees with rotation != 0, which renders the chainsaw useless on them.
#
# Disabling this feature will sacrifice safety for convenience.
technic_safe_chainsaw (Chainsaw safety feature) bool true

View File

@ -1,14 +1,16 @@
Technic
=======
# Technic (main mod)
License
-------
## License
### Code
Copyright (C) 2012-2014 Maciej Kasatkin (RealBadAngel)
Technic chests code is licensed under the GNU LGPLv2+.
Texture licenses:
### Textures
BlockMen modified by Zefram (CC BY-SA 3.0):
* technic_chernobylite_block.png
@ -24,15 +26,29 @@ sdzen (Elise Staudter) (CC BY-SA 3.0):
leftshift (CC BY-SA 3.0):
* technic_river_water_can.png
Neuromancer vis Minetest Game (CC BY-SA 3.0)
* `technic_*_electric_furnace_*.png` (derived)
[LB Photo Realism Reload](https://www.curseforge.com/minecraft/texture-packs/lb-photo-realism-reload) (CC 0)
* `technic_geothermal_*.png` (derived)
* `technic_water_mill_*.png` (derived)
* `technic_*_alloy_furnace_*.png` (derived)
* `technic_*_compressor_*.png` (derived)
* `technic_*_grinder_*.png` (derived)
RealBadAngel: (WTFPL)
* Everything else.
CC BY-SA 3.0: <http://creativecommons.org/licenses/by-sa/3.0/>
Sound licenses:
### Sounds
veikk0 (Veikko Mäkelä) (CC BY-SA 4.0):
* technic_hv_nuclear_reactor_siren_danger_loop.ogg
* Derived from "Nuclear alarm.wav" by Freesound.org user rene___ from <https://freesound.org/people/rene___/sounds/56778/>. Originally licensed under CC0 1.0 <https://creativecommons.org/publicdomain/zero/1.0/>
CC BY-SA 4.0: <https://creativecommons.org/licenses/by-sa/4.0/>
### References
CC BY-SA 3.0: http://creativecommons.org/licenses/by-sa/3.0/
CC BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/

View File

@ -35,6 +35,10 @@ Available functions:
* `technic.is_tier_cable(nodename, tier)`
* Tells whether the node `nodename` is the cable of the tier `tier`.
* Short version of `technic.get_cable_tier(nodename) == tier`
* `technic.register_cable_tier(nodename, tier)`
* Register user defined cable to list of known tier cables.
* `nodename`: string, name of the node
* `tier`: string, tier name
## Machines

View File

@ -65,15 +65,26 @@ function technic.swap_node(pos, name)
end
--- Returns the meta of an item
-- Gets overridden when legacy.lua is loaded
function technic.get_stack_meta(itemstack)
return itemstack:get_meta()
end
--- Same as technic.get_stack_meta for cans
function technic.get_stack_meta_cans(itemstack)
return itemstack:get_meta()
end
--- Fully charge RE chargeable item.
-- Must be defined early to reference in item definitions.
function technic.refill_RE_charge(stack)
local max_charge = technic.power_tools[stack:get_name()]
if not max_charge then return stack end
local meta = technic.get_stack_meta(stack)
meta:set_int("technic:charge", max_charge)
technic.set_RE_wear(stack, max_charge, max_charge)
local meta = minetest.deserialize(stack:get_metadata()) or {}
meta.charge = max_charge
stack:set_metadata(minetest.serialize(meta))
return stack
end

View File

@ -39,3 +39,40 @@ for i = 0, 64 do
minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
end
-- Item meta
-- Meta keys that have changed
technic.legacy_meta_keys = {
["charge"] = "technic:charge",
}
-- Converts legacy itemstack metadata string to itemstack meta and returns the ItemStackMetaRef
function technic.get_stack_meta(itemstack)
local meta = itemstack:get_meta()
local legacy_string = meta:get("") -- Get deprecated metadata
if legacy_string then
local legacy_table = minetest.deserialize(legacy_string)
if legacy_table then
local table = meta:to_table()
for k, v in pairs(legacy_table) do
table.fields[technic.legacy_meta_keys[k] or k] = v
end
meta:from_table(table)
end
meta:set_string("", "") -- Remove deprecated metadata
end
return meta
end
-- Same as technic.get_stack_meta for cans.
-- (Cans didn't store a serialized table in the legacy metadata string, but just a number.)
function technic.get_stack_meta_cans(itemstack)
local meta = itemstack:get_meta()
local legacy_string = meta:get("") -- Get deprecated metadata
if legacy_string then
meta:set_string("can_level", legacy_string)
meta:set_string("", "") -- Remove deprecated metadata
return meta
end
return meta
end

View File

@ -31,24 +31,26 @@ minetest.register_craft({
})
local function make_reactor_formspec(meta)
local f = "size[8,9]"..
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
"list[current_name;src;2,1;3,2;]"..
"list[current_player;main;0,5;8,4;]"..
"listring[]"..
"button[5.5,1.5;2,1;start;Start]"..
"checkbox[5.5,2.5;autostart;automatic Start;"..meta:get_string("autostart").."]"
local f =
"formspec_version[4]"..
"size[10.75,10.75]"..
"label[0.2,0.4;"..S("Nuclear Reactor Rod Compartment").."]"..
"list[current_name;src;1.5,1;3,2;]"..
"list[current_player;main;0.5,5.5;8,4;]"..
"listring[]"..
"button[5.7,1;2,1;start;Start]"..
"checkbox[5.7,2.75;autostart;automatic Start;"..meta:get_string("autostart").."]"
if not digiline_remote_path then
return f
end
local digiline_enabled = meta:get_string("enable_digiline")
f = f.."checkbox[0.5,2.8;enable_digiline;Enable Digiline;"..digiline_enabled.."]"
f = f.."checkbox[1.5,3.75;enable_digiline;Enable Digiline channel;"..digiline_enabled.."]"
if digiline_enabled ~= "true" then
return f
end
return f..
"button_exit[4.6,3.69;2,1;save;Save]"..
"field[1,4;4,1;remote_channel;Digiline Remote Channel;${remote_channel}]"
"field[2,4.2;4.25,1;remote_channel;;${remote_channel}]" ..
"button_exit[6.5,4.2;2,1;save;Save]"
end
local SS_OFF = 0
@ -140,8 +142,11 @@ of a lead layer it will be converted to a lead layer.
--]]
local function reactor_structure_badness(pos)
local vm = VoxelManip()
-- Blast-resistant Concrete Block layer outer positions
local pos1 = vector.subtract(pos, 3)
local pos2 = vector.add(pos, 3)
local MinEdge, MaxEdge = vm:read_from_map(pos1, pos2)
local data = vm:get_data()
local area = VoxelArea:new({MinEdge=MinEdge, MaxEdge=MaxEdge})
@ -157,16 +162,19 @@ local function reactor_structure_badness(pos)
for z = pos1.z, pos2.z do
for y = pos1.y, pos2.y do
for x = pos1.x, pos2.x do
-- In the entire volume, make sure there is:
local cid = data[area:index(x, y, z)]
if x == pos1.x or x == pos2.x or
y == pos1.y or y == pos2.y or
z == pos1.z or z == pos2.z then
-- r=3 : Blast-resistant Concrete Block shell
if cid == c_blast_concrete then
blast_layer = blast_layer + 1
end
elseif x == pos1.x+1 or x == pos2.x-1 or
y == pos1.y+1 or y == pos2.y-1 or
z == pos1.z+1 or z == pos2.z-1 then
-- r=2 : Lead Block shell
if cid == c_lead then
lead_layer = lead_layer + 1
elseif cid == c_steel then
@ -175,6 +183,7 @@ local function reactor_structure_badness(pos)
elseif x == pos1.x+2 or x == pos2.x-2 or
y == pos1.y+2 or y == pos2.y-2 or
z == pos1.z+2 or z == pos2.z-2 then
-- r=1 : Water cooling
if cid == c_water_source or cid == c_water_flowing then
water_layer = water_layer + 1
end
@ -184,6 +193,8 @@ local function reactor_structure_badness(pos)
end
if steel_layer >= 96 then
-- Legacy: convert stainless steel to lead
-- Why don't we accept both without conversion?
for z = pos1.z+1, pos2.z-1 do
for y = pos1.y+1, pos2.y-1 do
for x = pos1.x+1, pos2.x-1 do
@ -206,6 +217,7 @@ local function reactor_structure_badness(pos)
if water_layer > 25 then water_layer = 25 end
if lead_layer > 96 then lead_layer = 96 end
if blast_layer > 216 then blast_layer = 216 end
-- Amount of missing blocks
return (25 - water_layer) + (96 - lead_layer) + (216 - blast_layer)
end
@ -297,7 +309,7 @@ local function run(pos, node)
end
meta:set_int("HV_EU_supply", 0)
meta:set_int("burn_time", 0)
meta:set_string("infotext", S("%s Idle"):format(reactor_desc))
meta:set_string("infotext", S("@1 Idle", reactor_desc))
technic.swap_node(pos, "technic:hv_nuclear_reactor_core")
meta:set_int("structure_accumulated_badness", 0)
siren_clear(pos, meta)

View File

@ -110,6 +110,40 @@ local function quarry_handle_purge(pos)
end
end
-- Determines whether the quarry can dig the node at "pos"
-- "startpos" is located a few nodes above the quarry in South West direction (X-, Z-)
-- Returns the node to dig (to avoid double minetest.get_node lookup)
local function quarry_can_dig_node(startpos, pos, quarry_owner)
if minetest.is_protected(pos, quarry_owner) then
return nil
end
local node = technic.get_or_load_node(pos) or minetest.get_node(pos)
local def = minetest.registered_nodes[node.name] or {diggable=false}
-- doors mod among other thing does NOT like a nil digger...
local fakedigger = pipeworks.create_fake_player({
name = quarry_owner
})
if not def.diggable or (def.can_dig and not def.can_dig(pos, fakedigger)) then
return nil
end
-- Find airlike nodes on top of the current node. The entire Y column must be free.
for ay = pos.y+1, startpos.y do
local checkpos = {x=pos.x, y=ay, z=pos.z}
local checknode = technic.get_or_load_node(checkpos) or minetest.get_node(checkpos)
local cdef = minetest.registered_nodes[checknode.name] or {}
local is_kind_of_gas = cdef.buildable_to and cdef.sunlight_propagates and not cdef.walkable
and not cdef.diggable and (cdef.drawtype == "airlike" or cdef.drawtype == "glasslike")
if not is_kind_of_gas then
return nil
end
end
return node
end
local function quarry_run(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -153,35 +187,11 @@ local function quarry_run(pos, node)
vector.new(0, -ry, 0)),
vector.multiply(pdir, rp)),
vector.multiply(qdir, rq))
local can_dig = true
if can_dig and minetest.is_protected and minetest.is_protected(digpos, owner) then
can_dig = false
end
local dignode
if can_dig then
dignode = technic.get_or_load_node(digpos) or minetest.get_node(digpos)
local dignodedef = minetest.registered_nodes[dignode.name] or {diggable=false}
-- doors mod among other thing does NOT like a nil digger...
local fakedigger = pipeworks.create_fake_player({
name = owner
})
if not dignodedef.diggable or (dignodedef.can_dig and not dignodedef.can_dig(digpos, fakedigger)) then
can_dig = false
end
end
if can_dig then
for ay = startpos.y, digpos.y+1, -1 do
local checkpos = {x=digpos.x, y=ay, z=digpos.z}
local checknode = technic.get_or_load_node(checkpos) or minetest.get_node(checkpos)
if checknode.name ~= "air" then
can_dig = false
break
end
end
end
nd = nd + 1
if can_dig then
local dignode = quarry_can_dig_node(startpos, digpos, owner)
if dignode then
minetest.remove_node(digpos)
local drops = minetest.get_node_drops(dignode.name, "")
for _, dropped_item in ipairs(drops) do

View File

@ -22,3 +22,6 @@ dofile(path.."/extractor.lua")
dofile(path.."/compressor.lua")
dofile(path.."/music_player.lua")
-- NEW LV LAMPS
dofile(path.."/led.lua")
dofile(path.."/lamp.lua")

View File

@ -0,0 +1,156 @@
-- LV Lamp
-- Illuminates a 7x7x3(H) volume below itself with light bright as the sun.
local S = technic.getter
local desc = S("@1 Lamp", S("LV"))
local active_desc = S("@1 Active", desc)
local unpowered_desc = S("@1 Unpowered", desc)
local off_desc = S("@1 Off", desc)
local demand = 50
-- Invisible light source node used for illumination
minetest.register_node("technic:dummy_light_source", {
description = S("Dummy light source node"),
inventory_image = "technic_dummy_light_source.png",
wield_image = "technic_dummy_light_source.png",
paramtype = "light",
drawtype = "airlike",
light_source = 14,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
diggable = false,
pointable = false,
--drop = "", -- Intentionally allowed to drop itself
groups = {not_in_creative_inventory = 1}
})
local function illuminate(pos, active)
local pos1 = {x = pos.x - 3, y = pos.y - 1, z = pos.z - 3}
local pos2 = {x = pos.x + 3, y = pos.y - 3, z = pos.z + 3}
local find_node = active and "air" or "technic:dummy_light_source"
local set_node = {name = (active and "technic:dummy_light_source" or "air")}
for _,p in pairs(minetest.find_nodes_in_area(pos1, pos2, find_node)) do
minetest.set_node(p, set_node)
end
end
local function lamp_run(pos, node)
local meta = minetest.get_meta(pos)
if meta:get_int("LV_EU_demand") == 0 then
return -- Lamp is turned off
end
local eu_input = meta:get_int("LV_EU_input")
if node.name == "technic:lv_lamp_active" then
if eu_input < demand then
technic.swap_node(pos, "technic:lv_lamp")
meta:set_string("infotext", unpowered_desc)
illuminate(pos, false)
else
illuminate(pos, true)
end
elseif node.name == "technic:lv_lamp" then
if eu_input >= demand then
technic.swap_node(pos, "technic:lv_lamp_active")
meta:set_string("infotext", active_desc)
illuminate(pos, true)
end
end
end
local function lamp_toggle(pos, node, player)
if not player or minetest.is_protected(pos, player:get_player_name()) then
return
end
local meta = minetest.get_meta(pos)
if meta:get_int("LV_EU_demand") == 0 then
meta:set_string("infotext", active_desc)
meta:set_int("LV_EU_demand", demand)
else
illuminate(pos, false)
technic.swap_node(pos, "technic:lv_lamp")
meta:set_string("infotext", off_desc)
meta:set_int("LV_EU_demand", 0)
end
end
local common_fields = {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {0.5,0.5,0.5,-0.5,-0.2,-0.5}
},
tiles = {
"technic_lv_lamp_top.png",
"technic_lv_lamp_bottom.png",
"technic_lv_lamp_side.png",
"technic_lv_lamp_side.png",
"technic_lv_lamp_side.png",
"technic_lv_lamp_side.png"
},
connect_sides = {"front", "back", "left", "right", "top"},
can_dig = technic.machine_can_dig,
technic_run = lamp_run,
on_destruct = illuminate,
on_rightclick = lamp_toggle
}
local ndef
ndef = {
description = desc,
groups = {cracky = 2, technic_machine = 1, technic_lv = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", desc)
meta:set_int("LV_EU_demand", demand)
end
}
for k, v in pairs(common_fields) do
ndef[k] = v
end
minetest.register_node("technic:lv_lamp", ndef)
ndef = {
description = active_desc,
paramtype = "light",
light_source = 14,
drop = "technic:lv_lamp",
groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1},
technic_on_disable = function(pos)
illuminate(pos, false)
technic.swap_node(pos, "technic:lv_lamp")
end,
}
for k, v in pairs(common_fields) do
ndef[k] = v
end
minetest.register_node("technic:lv_lamp_active", ndef)
technic.register_machine("LV", "technic:lv_lamp", technic.receiver)
technic.register_machine("LV", "technic:lv_lamp_active", technic.receiver)
minetest.register_craft({
output = "technic:lv_lamp",
recipe = {
{"default:glass", "default:glass", "default:glass"},
{"technic:lv_led", "technic:lv_led", "technic:lv_led"},
{"mesecons_materials:glue", "technic:lv_cable", "mesecons_materials:glue"},
}
})

View File

@ -0,0 +1,95 @@
-- LED
-- Intended primarily as a core component for LED lamps.
local S = technic.getter
local desc = S("@1 LED", S("LV"))
local active_desc = S("@1 Active", desc)
local unpowered_desc = S("@1 Unpowered", desc)
local demand = 5
local function led_run(pos, node)
local meta = minetest.get_meta(pos)
local eu_input = meta:get_int("LV_EU_input")
if eu_input < demand and node.name == "technic:lv_led_active" then
technic.swap_node(pos, "technic:lv_led")
meta:set_string("infotext", unpowered_desc)
elseif eu_input >= demand and node.name == "technic:lv_led" then
technic.swap_node(pos, "technic:lv_led_active")
meta:set_string("infotext", active_desc)
end
end
local common_fields = {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {0.5, 0.5, 0.5, -0.5, 0.3, -0.5}
},
tiles = {
"technic_lv_led_top.png",
"technic_lv_led.png",
"technic_lv_led_side.png",
"technic_lv_led_side2.png",
"technic_lv_led_side2.png",
"technic_lv_led_side2.png",
},
connect_sides = {"front", "back", "left", "right", "top", "bottom"},
can_dig = technic.machine_can_dig,
technic_run = led_run,
}
local ndef
ndef = {
description = desc,
inventory_image = "technic_lv_led_inv.png",
sunlight_propagates = true,
groups = {cracky = 2, technic_machine = 1, technic_lv = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", desc)
meta:set_int("LV_EU_demand", demand)
end,
}
for k, v in pairs(common_fields) do
ndef[k] = v
end
minetest.register_node("technic:lv_led", ndef)
ndef = {
description = active_desc,
paramtype = "light",
light_source = 9,
drop = "technic:lv_led",
groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1},
technic_on_disable = function(pos)
technic.swap_node(pos, "technic:lv_led")
end,
}
for k, v in pairs(common_fields) do
ndef[k] = v
end
minetest.register_node("technic:lv_led_active", ndef)
technic.register_machine("LV", "technic:lv_led", technic.receiver)
technic.register_machine("LV", "technic:lv_led_active", technic.receiver)
minetest.register_craft({
output = "technic:lv_led 2",
recipe = {
{"", "homedecor:plastic_sheeting", ""},
{"homedecor:plastic_sheeting", "technic:doped_silicon_wafer", "homedecor:plastic_sheeting"},
{"", "technic:fine_silver_wire", ""},
}
})

View File

@ -192,10 +192,10 @@ function technic.register_battery_box(data)
end
local run = function(pos, node)
local below = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
local meta = minetest.get_meta(pos)
local meta = minetest.get_meta(pos)
local network_id = tonumber(meta:get_string(tier.."_network"))
if not technic.is_tier_cable(below.name, tier) then
if not technic.networks[network_id] then
meta:set_string("infotext", S("%s Battery Box Has No Network"):format(tier))
return
end
@ -415,12 +415,8 @@ local function default_get_charge(itemstack)
if not technic.power_tools[tool_name] then
return 0, 0
end
-- Set meta data for the tool if it didn't do it itself
local item_meta = minetest.deserialize(itemstack:get_metadata()) or {}
if not item_meta.charge then
item_meta.charge = 0
end
return item_meta.charge, technic.power_tools[tool_name]
local item_meta = technic.get_stack_meta(itemstack)
return item_meta:get_int("technic:charge"), technic.power_tools[tool_name]
end
local function default_set_charge(itemstack, charge)
@ -428,9 +424,8 @@ local function default_set_charge(itemstack, charge)
if technic.power_tools[tool_name] then
technic.set_RE_wear(itemstack, charge, technic.power_tools[tool_name])
end
local item_meta = minetest.deserialize(itemstack:get_metadata()) or {}
item_meta.charge = charge
itemstack:set_metadata(minetest.serialize(item_meta))
local item_meta = technic.get_stack_meta(itemstack)
item_meta:set_int("technic:charge", charge)
end
function technic.charge_tools(meta, batt_charge, charge_step)

View File

@ -11,6 +11,13 @@ function technic.get_cable_tier(name)
return cable_tier[name]
end
function technic.register_cable_tier(name, tier)
assert(technic.machines[tier], "Tier does not exist")
assert(type(name) == "string", "Invalid node name")
cable_tier[name] = tier
end
local function check_connections(pos)
-- Build a table of all machines
local machines = {}
@ -60,7 +67,7 @@ local function clear_networks(pos)
local tier = network.tier
-- Actually add it to the (cached) network
-- This is similar to check_node_subp
-- !! IMPORTANT: ../switching_station.lua -> check_node_subp() must be kept in sync
technic.cables[minetest.hash_node_position(pos)] = network_id
pos.visited = 1
if technic.is_tier_cable(node.name, tier) then
@ -69,7 +76,7 @@ local function clear_networks(pos)
elseif technic.machines[tier][node.name] then
-- Found a machine
local eu_type = technic.machines[tier][node.name]
meta:set_string(tier.."_network", minetest.pos_to_string(sw_pos))
meta:set_string(tier.."_network", string.format("%.20g", network_id))
if eu_type == technic.producer then
table.insert(network.PR_nodes, pos)
elseif eu_type == technic.receiver then

View File

@ -21,27 +21,57 @@ local recipes = {
{"technic:uranium35_ingot 5", "technic:uranium_fuel"},
}
if minetest.get_modpath("everness") then
local everness_sand_to_sandstone_recipes = {
{"everness:coral_deep_ocean_sand 2", "everness:coral_deep_ocean_sandstone_block"},
{"everness:coral_sand 2", "everness:coral_sandstone"},
{"everness:coral_white_sand 2", "everness:coral_white_sandstone"},
{"everness:crystal_forest_deep_ocean_sand 2", "everness:crystal_forest_deep_ocean_sandstone_block"},
{"everness:crystal_sand 2", "everness:crystal_sandstone"},
{"everness:cursed_lands_deep_ocean_sand 2", "everness:cursed_lands_deep_ocean_sandstone_block"},
{"everness:cursed_sand 2", "everness:cursed_sandstone_block"},
{"everness:mineral_sand 2", "everness:mineral_sandstone"},
}
for _, data in ipairs(everness_sand_to_sandstone_recipes) do
table.insert(recipes, {data[1], data[2]})
end
end
-- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner
minetest.clear_craft({
recipe = {
{"default:sand", "default:sand"},
{"default:sand", "default:sand"},
},
})
minetest.clear_craft({
recipe = {
{"default:desert_sand", "default:desert_sand"},
{"default:desert_sand", "default:desert_sand"},
},
})
minetest.clear_craft({
recipe = {
{"default:silver_sand", "default:silver_sand"},
{"default:silver_sand", "default:silver_sand"},
},
})
local crafts_to_clear = {
"default:desert_sand",
"default:sand",
"default:silver_sand"
}
if minetest.get_modpath("everness") then
local everness_crafts_to_clear = {
"everness:coral_sand",
"everness:coral_forest_deep_ocean_sand",
"everness:coral_white_sand",
"everness:crystal_sand",
"everness:cursed_sand",
"everness:cursed_lands_deep_ocean_sand",
"everness:crystal_forest_deep_ocean_sand",
"everness:mineral_sand",
}
for _, sand_name in ipairs(everness_crafts_to_clear) do
table.insert(crafts_to_clear, sand_name)
end
end
for _, sand_name in ipairs(crafts_to_clear) do
minetest.clear_craft({
type = "shaped",
recipe = {
{sand_name, sand_name},
{sand_name, sand_name},
},
})
end
for _, data in pairs(recipes) do
technic.register_compressor_recipe({input = {data[1]}, output = data[2]})
end

View File

@ -23,6 +23,8 @@ local recipes = {
{"technic:sulfur_lump", "technic:sulfur_dust 2"},
{"default:stone", "technic:stone_dust"},
{"default:sand", "technic:stone_dust"},
{"default:desert_sand", "technic:stone_dust"},
{"default:silver_sand", "technic:stone_dust"},
-- Other
{"default:cobble", "default:gravel"},
@ -34,6 +36,17 @@ local recipes = {
{"default:ice", "default:snowblock"},
}
if minetest.get_modpath("everness") then
table.insert(recipes, {"everness:coral_deep_ocean_sandstone_block", "everness:coral_deep_ocean_sand 2"})
table.insert(recipes, {"everness:coral_sandstone", "everness:coral_sand 2"})
table.insert(recipes, {"everness:coral_white_sandstone", "everness:coral_white_sand 2"})
table.insert(recipes, {"everness:crystal_forest_deep_ocean_sandstone_block", "everness:crystal_forest_deep_ocean_sand 2"})
table.insert(recipes, {"everness:crystal_sandstone", "everness:crystal_sand 2"})
table.insert(recipes, {"everness:cursed_lands_deep_ocean_sandstone_block", "everness:cursed_lands_deep_ocean_sand 2"})
table.insert(recipes, {"everness:cursed_sandstone_block", "everness:cursed_sand 2"})
table.insert(recipes, {"everness:mineral_sandstone", "everness:mineral_sand 2"})
end
-- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe)
minetest.clear_craft({
recipe = {
@ -51,6 +64,15 @@ minetest.clear_craft({
},
})
if minetest.get_modpath("everness") then
minetest.clear_craft({
recipe = {
{"everness:mineral_sandstone"}
},
})
-- Currently (2024-03-09), there seem to be no reverse recipes for any of the other everness sandstones.
end
if minetest.get_modpath("farming") then
table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"})
end
@ -72,6 +94,10 @@ if minetest.get_modpath("homedecor") then
table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"})
end
if minetest.get_modpath("everness") then
table.insert(recipes, {"everness:pyrite_lump", "technic:pyrite_dust 2"})
end
for _, data in pairs(recipes) do
technic.register_grinder_recipe({input = {data[1]}, output = data[2]})
end
@ -120,6 +146,9 @@ if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
register_dust("Kalite", nil)
register_dust("Talinite", "glooptest:talinite_ingot")
end
if minetest.get_modpath("everness") then
register_dust("Pyrite", "everness:pyrite_ingot")
end
for p = 0, 35 do
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil

View File

@ -120,7 +120,7 @@ local run = function(pos, node, run_stage)
return
end
local remain = 0.9
local efficiency = 0.9
-- Machine information
local machine_name = S("Supply Converter")
local meta = minetest.get_meta(pos)
@ -133,7 +133,6 @@ local run = function(pos, node, run_stage)
enabled = enabled == "1"
end
enabled = enabled and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0)
local demand = enabled and meta:get_int("power") or 0
local pos_up = {x=pos.x, y=pos.y+1, z=pos.z}
local pos_down = {x=pos.x, y=pos.y-1, z=pos.z}
@ -144,14 +143,37 @@ local run = function(pos, node, run_stage)
local to = technic.get_cable_tier(name_down)
if from and to then
local input = meta:get_int(from.."_EU_input")
meta:set_int(from.."_EU_demand", demand)
meta:set_int(from.."_EU_supply", 0)
meta:set_int(to.."_EU_demand", 0)
meta:set_int(to.."_EU_supply", input * remain)
meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name,
technic.EU_string(input), from,
technic.EU_string(input * remain), to))
-- Get the "to" network switching station for EU demand calculation
local network_hash = technic.cables[minetest.hash_node_position(pos_down)]
local network = network_hash and minetest.get_position_from_hash(network_hash)
local sw_pos = network and {x=network.x,y=network.y+1,z=network.z}
local timeout = 0
for tier in pairs(technic.machines) do
-- Supply converter must be connected to a network
timeout = math.max(meta:get_int(tier.."_EU_timeout"), timeout)
end
if timeout > 0 and sw_pos and minetest.get_node(sw_pos).name == "technic:switching_station" then
local sw_meta = minetest.get_meta(sw_pos)
local demand = 0
if enabled then
-- Reverse evaluate the required machine and round to a nice number
demand = sw_meta:get_int("ba_demand") + sw_meta:get_int("demand")
demand = 100 * math.ceil(demand / efficiency / 100)
-- Do not draw more than the limit
demand = math.min(demand, meta:get_int("power"))
end
local input = meta:get_int(from.."_EU_input") -- actual input
meta:set_int(from.."_EU_demand", demand) -- desired input
meta:set_int(from.."_EU_supply", 0)
meta:set_int(to.."_EU_demand", 0)
meta:set_int(to.."_EU_supply", input * efficiency)
meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name,
technic.EU_string(input), from,
technic.EU_string(input * efficiency), to))
else
meta:set_string("infotext",S("%s Has No Network"):format(machine_name))
end
else
meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name))
if to then

View File

@ -117,6 +117,7 @@ local function add_cable_node(nodes, pos, network_id, queue)
end
-- Generic function to add found connected nodes to the right classification array
-- !! IMPORTANT: register/cables.lua -> clear_networks() must be kept in sync
local check_node_subp = function(network, pos, machines, sw_pos, from_below, network_id, queue)
technic.get_or_load_node(pos)
local name = minetest.get_node(pos).name
@ -133,7 +134,9 @@ local check_node_subp = function(network, pos, machines, sw_pos, from_below, net
--dprint(name.." is a "..machines[name])
local meta = minetest.get_meta(pos)
meta:set_string(network.tier.."_network", minetest.pos_to_string(sw_pos))
-- Normal tostring() does not have enough precision, neither does meta:set_int()
-- Lua 5.1 bug: Cannot use hexadecimal notation for compression (see LuaJIT #911)
meta:set_string(network.tier.."_network", string.format("%.20g", network_id))
if eu_type == technic.producer then
add_network_node(network.PR_nodes, pos, network_id)
@ -354,6 +357,8 @@ minetest.register_abm({
BA_eu_supply = BA_eu_supply + meta1:get_int(eu_supply_str)
BA_eu_demand = BA_eu_demand + meta1:get_int(eu_demand_str)
end
-- Expose value for the supply converter
meta:set_int("ba_demand", BA_eu_demand)
--dprint("Total BA supply:"..BA_eu_supply)
--dprint("Total BA demand:"..BA_eu_demand)

View File

@ -1,3 +1,3 @@
name = technic
depends = default, pipeworks, technic_worldgen, basic_materials
optional_depends = bucket, screwdriver, mesecons, mesecons_mvps, digilines, digiline_remote, intllib, unified_inventory, vector_extras, dye, craftguide,i3
optional_depends = bucket, screwdriver, mesecons, mesecons_mvps, digilines, digiline_remote, intllib, unified_inventory, vector_extras, dye, craftguide, i3, everness

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 743 B

View File

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 181 B

View File

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

View File

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 168 B

View File

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Some files were not shown because too many files have changed in this diff Show More