24 Commits

Author SHA1 Message Date
4a5a22a3e3 LV LED: Replace silver wire with empty spool on craft 2025-06-14 21:31:00 +02:00
85e342c08c Sonic Screwdriver: Support every paramtype2 (#662) 2025-05-14 19:52:22 +02:00
0ff7cb769b Fix shading on CNC shape models
Luanti 5.11 showed a lot of flaws in the shading of the CNC models, some
of which were previously obscured. Fix the models so that smooth shading
is applied where appropriate and sharp/flat shading where appropriate.
The modified files have also been run through ExeVirus' CompressObj.
2025-03-01 10:27:59 +01:00
3bece9cec5 Fix incorrect recipe registration for craftguide and i3 2024-12-16 20:46:14 +01:00
59643c45d4 Chainsaw: Chat message for 'aborted by safe cut'
This provides a feedback to the player.
2024-12-07 22:15:43 +01:00
b268e3d526 Fix machines connected to multiple networks (#655)
Machines sometimes were be a part of multiple networks and generated power for each. This is fixed by checking if the machine is already part of an other network before assigning it to the current network.
2024-11-29 18:58:51 +01:00
87e512ff24 Fix power monitor instability (#654)
This fixes the power monitor instability where it was switching between having and not having network infotext. The cause was that the power monitor is LV MV and HV machine at the same time, and each tier has a countdown. If any of these countdowns were 0 it treated the machine as having no network. This was changed so that it only treats a machine as having no network if it is timed out in all tiers that it is a part of.
2024-11-22 21:19:49 +01:00
18df2813a0 Comment print statements in battery_box.lua (#650) 2024-09-06 19:10:04 +02:00
221fc1376e technic_cnc: use programs definition to generate formspec (#647)
This deprecates the variables onesize_products and twosize_products by using a shared definition table.
With these changes, it should be easier to add new programs in the future.

New feature: Tooltips are added to all programs. (only applies to newly placed nodes)
2024-08-10 10:50:51 +02:00
9f373d6528 technic_cnc: Add group 'cracky'
Fixes a regression from ba2bdf836 where stone-like nodes could no longer be dug.
New sanity check to avoid such issues in the future.
2024-08-03 08:25:13 +02:00
6731db14e5 Add compressor recipes for nether racks (#644) 2024-07-07 18:53:15 +02:00
a9079c49e0 Expose technic.get/set_charge functions (#645) 2024-07-07 18:45:03 +02:00
f80372a0f8 Frames: Fix error in node placement callback execution 2024-05-18 18:05:44 +02:00
80dee96dbe Add grinding recipe for nether lump + refactor grinder recipes (#638)
Maintenance:

* Sort dependency-based entries alphabetically
* Refactor dust registration

Features:

* Add grinding recipe for nether lump and ingot + image for nether dust
2024-05-06 17:33:22 +02:00
d65c4aadd2 Add grinder crafting recipe from everness desert stone (#637)
Add two alternative grinder crafting recipes with the two everness desert stones
2024-05-06 17:31:13 +02:00
98675a2ae9 Add compressor recipes for nether brick and lump (#639)
Another addition with nether, similar to the previous one, just this time for compressor.

Clears nether's default recipes for compressed nether brick and nether lump, using the compressor instead for these tasks.
2024-04-30 17:44:51 +02:00
ba2bdf8368 technic_cnc: Use client-side translation API (#636) 2024-04-28 18:41:52 +02: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
139 changed files with 1443 additions and 1233 deletions

View File

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

View File

@ -27,6 +27,12 @@ if minetest.get_modpath("moreblocks") then
tiles={"technic_granite.png"}, 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", { stairsplus:register_all("technic", "concrete", "technic:concrete", {
description=S("Concrete"), description=S("Concrete"),
groups={cracky=3, not_in_creative_inventory=1}, groups={cracky=3, not_in_creative_inventory=1},

View File

@ -160,6 +160,11 @@ Unsorted functions:
* If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this * If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this
function does nothing, else that value is the maximum charge. function does nothing, else that value is the maximum charge.
* The itemstack metadata is changed to contain the charge. * The itemstack metadata is changed to contain the charge.
* `technic.get_charge(itemstack)`
* Returns the charge and max charge of the given itemstack.
* If the itemstack is not an RE chargeable item, both return values will be zero.
* `technic.set_charge(itemstack, charge)`
* Modifies the charge of the given itemstack.
### Node-specific ### Node-specific
* `technic.get_or_load_node(pos)` * `technic.get_or_load_node(pos)`

View File

@ -65,15 +65,26 @@ function technic.swap_node(pos, name)
end 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. --- Fully charge RE chargeable item.
-- Must be defined early to reference in item definitions. -- Must be defined early to reference in item definitions.
function technic.refill_RE_charge(stack) function technic.refill_RE_charge(stack)
local max_charge = technic.power_tools[stack:get_name()] local max_charge = technic.power_tools[stack:get_name()]
if not max_charge then return stack end 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) 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 return stack
end end

View File

@ -39,3 +39,40 @@ for i = 0, 64 do
minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable") minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
end 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 function make_reactor_formspec(meta)
local f = "size[8,9]".. local f =
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]".. "formspec_version[4]"..
"list[current_name;src;2,1;3,2;]".. "size[10.75,10.75]"..
"list[current_player;main;0,5;8,4;]".. "label[0.2,0.4;"..S("Nuclear Reactor Rod Compartment").."]"..
"listring[]".. "list[current_name;src;1.5,1;3,2;]"..
"button[5.5,1.5;2,1;start;Start]".. "list[current_player;main;0.5,5.5;8,4;]"..
"checkbox[5.5,2.5;autostart;automatic Start;"..meta:get_string("autostart").."]" "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 if not digiline_remote_path then
return f return f
end end
local digiline_enabled = meta:get_string("enable_digiline") 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 if digiline_enabled ~= "true" then
return f return f
end end
return f.. return f..
"button_exit[4.6,3.69;2,1;save;Save]".. "field[2,4.2;4.25,1;remote_channel;;${remote_channel}]" ..
"field[1,4;4,1;remote_channel;Digiline Remote Channel;${remote_channel}]" "button_exit[6.5,4.2;2,1;save;Save]"
end end
local SS_OFF = 0 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 function reactor_structure_badness(pos)
local vm = VoxelManip() local vm = VoxelManip()
-- Blast-resistant Concrete Block layer outer positions
local pos1 = vector.subtract(pos, 3) local pos1 = vector.subtract(pos, 3)
local pos2 = vector.add(pos, 3) local pos2 = vector.add(pos, 3)
local MinEdge, MaxEdge = vm:read_from_map(pos1, pos2) local MinEdge, MaxEdge = vm:read_from_map(pos1, pos2)
local data = vm:get_data() local data = vm:get_data()
local area = VoxelArea:new({MinEdge=MinEdge, MaxEdge=MaxEdge}) 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 z = pos1.z, pos2.z do
for y = pos1.y, pos2.y do for y = pos1.y, pos2.y do
for x = pos1.x, pos2.x do for x = pos1.x, pos2.x do
-- In the entire volume, make sure there is:
local cid = data[area:index(x, y, z)] local cid = data[area:index(x, y, z)]
if x == pos1.x or x == pos2.x or if x == pos1.x or x == pos2.x or
y == pos1.y or y == pos2.y or y == pos1.y or y == pos2.y or
z == pos1.z or z == pos2.z then z == pos1.z or z == pos2.z then
-- r=3 : Blast-resistant Concrete Block shell
if cid == c_blast_concrete then if cid == c_blast_concrete then
blast_layer = blast_layer + 1 blast_layer = blast_layer + 1
end end
elseif x == pos1.x+1 or x == pos2.x-1 or elseif x == pos1.x+1 or x == pos2.x-1 or
y == pos1.y+1 or y == pos2.y-1 or y == pos1.y+1 or y == pos2.y-1 or
z == pos1.z+1 or z == pos2.z-1 then z == pos1.z+1 or z == pos2.z-1 then
-- r=2 : Lead Block shell
if cid == c_lead then if cid == c_lead then
lead_layer = lead_layer + 1 lead_layer = lead_layer + 1
elseif cid == c_steel then 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 elseif x == pos1.x+2 or x == pos2.x-2 or
y == pos1.y+2 or y == pos2.y-2 or y == pos1.y+2 or y == pos2.y-2 or
z == pos1.z+2 or z == pos2.z-2 then 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 if cid == c_water_source or cid == c_water_flowing then
water_layer = water_layer + 1 water_layer = water_layer + 1
end end
@ -184,6 +193,8 @@ local function reactor_structure_badness(pos)
end end
if steel_layer >= 96 then 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 z = pos1.z+1, pos2.z-1 do
for y = pos1.y+1, pos2.y-1 do for y = pos1.y+1, pos2.y-1 do
for x = pos1.x+1, pos2.x-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 water_layer > 25 then water_layer = 25 end
if lead_layer > 96 then lead_layer = 96 end if lead_layer > 96 then lead_layer = 96 end
if blast_layer > 216 then blast_layer = 216 end if blast_layer > 216 then blast_layer = 216 end
-- Amount of missing blocks
return (25 - water_layer) + (96 - lead_layer) + (216 - blast_layer) return (25 - water_layer) + (96 - lead_layer) + (216 - blast_layer)
end end
@ -297,7 +309,7 @@ local function run(pos, node)
end end
meta:set_int("HV_EU_supply", 0) meta:set_int("HV_EU_supply", 0)
meta:set_int("burn_time", 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") technic.swap_node(pos, "technic:hv_nuclear_reactor_core")
meta:set_int("structure_accumulated_badness", 0) meta:set_int("structure_accumulated_badness", 0)
siren_clear(pos, meta) siren_clear(pos, meta)

View File

@ -9,5 +9,25 @@ minetest.register_craft({
} }
}) })
if (minetest.get_modpath('everness')) then
minetest.register_craft({
output = 'technic:lv_grinder',
recipe = {
{'everness:coral_desert_stone', 'default:diamond', 'everness:coral_desert_stone'},
{'everness:coral_desert_stone', 'technic:machine_casing', 'everness:coral_desert_stone'},
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
}
})
minetest.register_craft({
output = 'technic:lv_grinder',
recipe = {
{'everness:forsaken_desert_stone', 'default:diamond', 'everness:forsaken_desert_stone'},
{'everness:forsaken_desert_stone', 'technic:machine_casing', 'everness:forsaken_desert_stone'},
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
}
})
end
technic.register_grinder({tier="LV", demand={200}, speed=1}) technic.register_grinder({tier="LV", demand={200}, speed=1})

View File

@ -90,6 +90,7 @@ minetest.register_craft({
recipe = { recipe = {
{"", "homedecor:plastic_sheeting", ""}, {"", "homedecor:plastic_sheeting", ""},
{"homedecor:plastic_sheeting", "technic:doped_silicon_wafer", "homedecor:plastic_sheeting"}, {"homedecor:plastic_sheeting", "technic:doped_silicon_wafer", "homedecor:plastic_sheeting"},
{"", "technic:fine_silver_wire", ""}, {"", "basic_materials:silver_wire", ""},
} },
replacements = { {"basic_materials:silver_wire", "basic_materials:empty_spool"}, },
}) })

View File

@ -324,6 +324,7 @@ for zp = 0, 1 do
on_rightclick = function(pos, node, placer, itemstack, pointed_thing) on_rightclick = function(pos, node, placer, itemstack, pointed_thing)
if is_supported_node(itemstack:get_name()) then if is_supported_node(itemstack:get_name()) then
-- Stripped down version of "core.item_place_node"
if minetest.is_protected(pos, placer:get_player_name()) then if minetest.is_protected(pos, placer:get_player_name()) then
minetest.log("action", placer:get_player_name() minetest.log("action", placer:get_player_name()
.. " tried to place " .. itemstack:get_name() .. " tried to place " .. itemstack:get_name()
@ -347,8 +348,7 @@ for zp = 0, 1 do
end end
-- Run script hook -- Run script hook
local callback = nil for _, callback in ipairs(minetest.registered_on_placenodes) do
for _, _ in ipairs(minetest.registered_on_placenodes) do
-- Copy pos and node because callback can modify them -- Copy pos and node because callback can modify them
local pos_copy = { x = pos.x, y = pos.y, z = pos.z } local pos_copy = { x = pos.x, y = pos.y, z = pos.z }
local newnode_copy = { name = def.name, param1 = 0, param2 = 0 } local newnode_copy = { name = def.name, param1 = 0, param2 = 0 }

View File

@ -92,7 +92,7 @@ local dirtab = {
local tube = { local tube = {
insert_object = function(pos, node, stack, direction) insert_object = function(pos, node, stack, direction)
print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2) --print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2)
if direction.y == 1 if direction.y == 1
or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then
return stack return stack
@ -106,7 +106,7 @@ local tube = {
end end
end, end,
can_insert = function(pos, node, stack, direction) can_insert = function(pos, node, stack, direction)
print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2) --print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2)
if direction.y == 1 if direction.y == 1
or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then
return false return false
@ -409,28 +409,23 @@ minetest.register_on_player_receive_fields(
end end
) )
local function default_get_charge(itemstack) function technic.get_charge(itemstack)
-- check if is chargable -- check if is chargable
local tool_name = itemstack:get_name() local tool_name = itemstack:get_name()
if not technic.power_tools[tool_name] then if not technic.power_tools[tool_name] then
return 0, 0 return 0, 0
end end
-- Set meta data for the tool if it didn't do it itself local item_meta = technic.get_stack_meta(itemstack)
local item_meta = minetest.deserialize(itemstack:get_metadata()) or {} return item_meta:get_int("technic:charge"), technic.power_tools[tool_name]
if not item_meta.charge then
item_meta.charge = 0
end
return item_meta.charge, technic.power_tools[tool_name]
end end
local function default_set_charge(itemstack, charge) function technic.set_charge(itemstack, charge)
local tool_name = itemstack:get_name() local tool_name = itemstack:get_name()
if technic.power_tools[tool_name] then if technic.power_tools[tool_name] then
technic.set_RE_wear(itemstack, charge, technic.power_tools[tool_name]) technic.set_RE_wear(itemstack, charge, technic.power_tools[tool_name])
end end
local item_meta = minetest.deserialize(itemstack:get_metadata()) or {} local item_meta = technic.get_stack_meta(itemstack)
item_meta.charge = charge item_meta:set_int("technic:charge", charge)
itemstack:set_metadata(minetest.serialize(item_meta))
end end
function technic.charge_tools(meta, batt_charge, charge_step) function technic.charge_tools(meta, batt_charge, charge_step)
@ -442,8 +437,8 @@ function technic.charge_tools(meta, batt_charge, charge_step)
-- get callbacks -- get callbacks
local src_def = src_stack:get_definition() local src_def = src_stack:get_definition()
local technic_get_charge = src_def.technic_get_charge or default_get_charge local technic_get_charge = src_def.technic_get_charge or technic.get_charge
local technic_set_charge = src_def.technic_set_charge or default_set_charge local technic_set_charge = src_def.technic_set_charge or technic.set_charge
-- get tool charge -- get tool charge
local tool_charge, item_max_charge = technic_get_charge(src_stack) local tool_charge, item_max_charge = technic_get_charge(src_stack)
@ -476,8 +471,8 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
-- get callbacks -- get callbacks
local src_def = src_stack:get_definition() local src_def = src_stack:get_definition()
local technic_get_charge = src_def.technic_get_charge or default_get_charge local technic_get_charge = src_def.technic_get_charge or technic.get_charge
local technic_set_charge = src_def.technic_set_charge or default_set_charge local technic_set_charge = src_def.technic_set_charge or technic.set_charge
-- get tool charge -- get tool charge
local tool_charge, item_max_charge = technic_get_charge(src_stack) local tool_charge, item_max_charge = technic_get_charge(src_stack)

View File

@ -43,84 +43,106 @@ local function check_connections(pos)
return connections return connections
end end
local function clear_networks(pos) local clear_networks
local function clear_network(network_id)
if not network_id then
return
end
for _,v in pairs(technic.networks[network_id].all_nodes) do
local pos1 = minetest.hash_node_position(v)
technic.cables[pos1] = nil
end
local network_bckup = technic.networks[network_id]
technic.networks[network_id] = nil
for _,n_pos in pairs(network_bckup.PR_nodes) do
clear_networks(n_pos)
end
for _,n_pos in pairs(network_bckup.RE_nodes) do
clear_networks(n_pos)
end
for _,n_pos in pairs(network_bckup.BA_nodes) do
clear_networks(n_pos)
end
end
clear_networks = function(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local placed = node.name ~= "air" local placed = node.name ~= "air"
local positions = check_connections(pos) local positions = check_connections(pos)
if #positions < 1 then return end if #positions < 1 then return end
local dead_end = #positions == 1
for _,connected_pos in pairs(positions) do
local net = technic.cables[minetest.hash_node_position(connected_pos)]
if net and technic.networks[net] then
if dead_end and placed then
-- Dead end placed, add it to the network
-- Get the network
local network_id = technic.cables[minetest.hash_node_position(positions[1])]
if not network_id then
-- We're evidently not on a network, nothing to add ourselves to
return
end
local sw_pos = minetest.get_position_from_hash(network_id)
sw_pos.y = sw_pos.y + 1
local network = technic.networks[network_id]
local tier = network.tier
-- Actually add it to the (cached) network if #positions == 1 then
-- !! IMPORTANT: ../switching_station.lua -> check_node_subp() must be kept in sync if placed then
-- Dead end placed, add it to the network
-- Get the network
local network_id = technic.cables[minetest.hash_node_position(positions[1])]
if not network_id then
-- We're evidently not on a network, nothing to add ourselves to
return
end
local network = technic.networks[network_id]
local tier = network.tier
-- Actually add it to the (cached) network
-- !! IMPORTANT: ../switching_station.lua -> check_node_subp() must be kept in sync
if technic.is_tier_cable(node.name, tier) then
technic.cables[minetest.hash_node_position(pos)] = network_id technic.cables[minetest.hash_node_position(pos)] = network_id
pos.visited = 1 table.insert(network.all_nodes,pos)
if technic.is_tier_cable(node.name, tier) then elseif technic.machines[tier][node.name] then
-- Found a cable -- Found a machine
table.insert(network.all_nodes,pos) local eu_type = technic.machines[tier][node.name]
elseif technic.machines[tier][node.name] then meta:set_string(tier.."_network", string.format("%.20g", network_id))
-- Found a machine meta:set_int(tier.."_EU_timeout", 2)
local eu_type = technic.machines[tier][node.name] if eu_type == technic.producer then
meta:set_string(tier.."_network", string.format("%.20g", network_id)) table.insert(network.PR_nodes, pos)
if eu_type == technic.producer then elseif eu_type == technic.receiver then
table.insert(network.PR_nodes, pos) table.insert(network.RE_nodes, pos)
elseif eu_type == technic.receiver then elseif eu_type == technic.producer_receiver then
table.insert(network.RE_nodes, pos) table.insert(network.PR_nodes, pos)
elseif eu_type == technic.producer_receiver then table.insert(network.RE_nodes, pos)
table.insert(network.PR_nodes, pos) elseif eu_type == technic.battery then
table.insert(network.RE_nodes, pos) table.insert(network.BA_nodes, pos)
elseif eu_type == technic.battery then
table.insert(network.BA_nodes, pos)
end
-- Note: SPECIAL (i.e. switching station) is not traversed!
end end
elseif dead_end and not placed then -- Note: SPECIAL (i.e. switching station) is not traversed!
-- Dead end removed, remove it from the network end
-- Get the network else
local network_id = technic.cables[minetest.hash_node_position(positions[1])] -- Dead end removed, remove it from the network
if not network_id then -- Get the network
-- We're evidently not on a network, nothing to add ourselves to local network_id = technic.cables[minetest.hash_node_position(positions[1])]
return if not network_id then
end -- We're evidently not on a network, nothing to add ourselves to
local network = technic.networks[network_id] return
end
local network = technic.networks[network_id]
-- Search for and remove machine -- Search for and remove machine
technic.cables[minetest.hash_node_position(pos)] = nil technic.cables[minetest.hash_node_position(pos)] = nil
for tblname,table in pairs(network) do for tblname,table in pairs(network) do
if tblname ~= "tier" then if tblname ~= "tier" then
for machinenum,machine in pairs(table) do for machinenum,machine in pairs(table) do
if machine.x == pos.x if machine.x == pos.x
and machine.y == pos.y and machine.y == pos.y
and machine.z == pos.z then and machine.z == pos.z then
table[machinenum] = nil table[machinenum] = nil
end
end end
end end
end end
else
-- Not a dead end, so the whole network needs to be recalculated
for _,v in pairs(technic.networks[net].all_nodes) do
local pos1 = minetest.hash_node_position(v)
technic.cables[pos1] = nil
end
technic.networks[net] = nil
end end
end end
return
end
clear_network(technic.cables[minetest.hash_node_position(pos)])
for _,connected_pos in pairs(positions) do
local network_id = technic.cables[minetest.hash_node_position(connected_pos)]
-- Not a dead end, so the whole network needs to be recalculated
clear_network(network_id)
end end
end end
@ -170,7 +192,7 @@ function technic.register_cable(tier, size)
connects_to = {"group:technic_"..ltier.."_cable", connects_to = {"group:technic_"..ltier.."_cable",
"group:technic_"..ltier, "group:technic_all_tiers"}, "group:technic_"..ltier, "group:technic_all_tiers"},
on_construct = clear_networks, on_construct = clear_networks,
on_destruct = clear_networks, after_destruct = clear_networks,
}) })
local xyz = { local xyz = {
@ -210,7 +232,7 @@ function technic.register_cable(tier, size)
connects_to = {"group:technic_"..ltier.."_cable", connects_to = {"group:technic_"..ltier.."_cable",
"group:technic_"..ltier, "group:technic_all_tiers"}, "group:technic_"..ltier, "group:technic_all_tiers"},
on_construct = clear_networks, on_construct = clear_networks,
on_destruct = clear_networks, after_destruct = clear_networks,
} }
def.node_box.fixed = { def.node_box.fixed = {
{-size, -size, -size, size, size, size}, {-size, -size, -size, size, size, size},

View File

@ -8,6 +8,71 @@ function technic.register_compressor_recipe(data)
technic.register_recipe("compressing", data) technic.register_recipe("compressing", data)
end end
-- Defuse the default recipes, since we have
-- the compressor to take over in a more realistic manner.
local crafts_to_clear = {
"default:desert_sand",
"default:sand",
"default:silver_sand",
}
local dependent_crafts_to_clear = {
everness = {
"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",
},
nether = {
"nether:brick",
"nether:brick_compressed",
"nether:rack",
"nether:rack_deep",
},
}
-- Add dependent recipes to main collection of
-- recipes to be cleared if their mods are used.
for dependency, crafts in pairs(dependent_crafts_to_clear) do
if minetest.get_modpath(dependency) then
for _, craft_entry in ipairs(crafts) do
table.insert(crafts_to_clear, craft_entry)
end
end
end
-- Clear recipes
for _, craft_name in ipairs(crafts_to_clear) do
-- Regular bricks are 2x2 shaped, nether bricks are 3x3 shaped (irregular)
local is_regular = string.sub(craft_name, 1, 12) ~= "nether:brick"
local shaped_recipe
if is_regular then
shaped_recipe = {
{craft_name, craft_name},
{craft_name, craft_name},
}
else
shaped_recipe = {
{craft_name, craft_name, craft_name},
{craft_name, craft_name, craft_name},
{craft_name, craft_name, craft_name},
}
end
minetest.clear_craft({
type = "shaped",
recipe = shaped_recipe,
})
end
--
-- Compile compressor recipes
--
local recipes = { local recipes = {
{"default:snowblock", "default:ice"}, {"default:snowblock", "default:ice"},
{"default:sand 2", "default:sandstone"}, {"default:sand 2", "default:sandstone"},
@ -21,27 +86,36 @@ local recipes = {
{"technic:uranium35_ingot 5", "technic:uranium_fuel"}, {"technic:uranium35_ingot 5", "technic:uranium_fuel"},
} }
-- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner local dependent_recipes = {
minetest.clear_craft({ everness = {
recipe = { {"everness:coral_deep_ocean_sand 2", "everness:coral_deep_ocean_sandstone_block"},
{"default:sand", "default:sand"}, {"everness:coral_sand 2", "everness:coral_sandstone"},
{"default:sand", "default:sand"}, {"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"},
}, },
}) nether = {
minetest.clear_craft({ {"nether:brick 9", "nether:brick_compressed"},
recipe = { {"nether:brick_compressed 9", "nether:nether_lump"},
{"default:desert_sand", "default:desert_sand"}, {"nether:rack", "nether:brick",},
{"default:desert_sand", "default:desert_sand"}, {"nether:rack_deep", "nether:brick_deep"},
}, },
}) }
minetest.clear_craft({
recipe = {
{"default:silver_sand", "default:silver_sand"},
{"default:silver_sand", "default:silver_sand"},
},
})
-- Add dependent recipes to main recipe collection
-- if their mods are used.
for dependency, recipes_to_add in pairs(dependent_recipes) do
if minetest.get_modpath(dependency) then
for _, recipe_entry in ipairs(recipes_to_add) do
table.insert(recipes, recipe_entry)
end
end
end
-- Register compressor recipes
for _, data in pairs(recipes) do for _, data in pairs(recipes) do
technic.register_compressor_recipe({input = {data[1]}, output = data[2]}) technic.register_compressor_recipe({input = {data[1]}, output = data[2]})
end end

View File

@ -36,49 +36,73 @@ local recipes = {
{"default:ice", "default:snowblock"}, {"default:ice", "default:snowblock"},
} }
local dependent_recipes = {
-- Sandstones
everness = {
{"everness:coral_deep_ocean_sandstone_block", "everness:coral_deep_ocean_sand 2"},
{"everness:coral_sandstone", "everness:coral_sand 2"},
{"everness:coral_white_sandstone", "everness:coral_white_sand 2"},
{"everness:crystal_forest_deep_ocean_sandstone_block", "everness:crystal_forest_deep_ocean_sand 2"},
{"everness:crystal_sandstone", "everness:crystal_sand 2"},
{"everness:cursed_lands_deep_ocean_sandstone_block", "everness:cursed_lands_deep_ocean_sand 2"},
{"everness:cursed_sandstone_block", "everness:cursed_sand 2"},
{"everness:mineral_sandstone", "everness:mineral_sand 2"},
-- Lumps and wheat
{"everness:pyrite_lump", "technic:pyrite_dust 2"},
},
farming = {
{"farming:seed_wheat", "farming:flour 1"},
},
gloopores = {
{"gloopores:alatro_lump", "technic:alatro_dust 2"},
{"gloopores:kalite_lump", "technic:kalite_dust 2"},
{"gloopores:arol_lump", "technic:arol_dust 2"},
{"gloopores:talinite_lump", "technic:talinite_dust 2"},
{"gloopores:akalin_lump", "technic:akalin_dust 2"},
},
homedecor = {
{"home_decor:brass_ingot", "technic:brass_dust 1"},
},
moreores = {
{"moreores:mithril_lump", "technic:mithril_dust 2"},
{"moreores:silver_lump", "technic:silver_dust 2"},
},
nether = {
{"nether:nether_lump", "technic:nether_dust 2"},
},
}
for dependency, materials_to_add in pairs(dependent_recipes) do
if minetest.get_modpath(dependency) then
for _, material_entry in ipairs(materials_to_add) do
table.insert(recipes, material_entry)
end
end
end
-- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe) -- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe)
minetest.clear_craft({ minetest.clear_craft({
recipe = { recipe = {{"default:sandstone"}},
{"default:sandstone"}
},
}) })
minetest.clear_craft({ minetest.clear_craft({
recipe = { recipe = {{"default:desert_sandstone"}},
{"default:desert_sandstone"}
},
}) })
minetest.clear_craft({ minetest.clear_craft({
recipe = { recipe = {{"default:silver_sandstone"}},
{"default:silver_sandstone"}
},
}) })
if minetest.get_modpath("farming") then if minetest.get_modpath("everness") then
table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"}) 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 end
if minetest.get_modpath("moreores") then for _, data in ipairs(recipes) do
table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"})
table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"})
end
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
table.insert(recipes, {"gloopores:alatro_lump", "technic:alatro_dust 2"})
table.insert(recipes, {"gloopores:kalite_lump", "technic:kalite_dust 2"})
table.insert(recipes, {"gloopores:arol_lump", "technic:arol_dust 2"})
table.insert(recipes, {"gloopores:talinite_lump", "technic:talinite_dust 2"})
table.insert(recipes, {"gloopores:akalin_lump", "technic:akalin_dust 2"})
end
if minetest.get_modpath("homedecor") then
table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"})
end
for _, data in pairs(recipes) do
technic.register_grinder_recipe({input = {data[1]}, output = data[2]}) technic.register_grinder_recipe({input = {data[1]}, output = data[2]})
end end
-- dusts -- Dusts
local function register_dust(name, ingot) local function register_dust(name, ingot)
local lname = string.lower(name) local lname = string.lower(name)
lname = string.gsub(lname, ' ', '_') lname = string.gsub(lname, ' ', '_')
@ -96,33 +120,57 @@ local function register_dust(name, ingot)
end end
end end
-- Sorted alphibeticaly -- Sorted alphabetically
register_dust("Brass", "basic_materials:brass_ingot") local dusts = {
register_dust("Bronze", "default:bronze_ingot") {"Brass", "basic_materials:brass_ingot"},
register_dust("Carbon Steel", "technic:carbon_steel_ingot") {"Bronze", "default:bronze_ingot"},
register_dust("Cast Iron", "technic:cast_iron_ingot") {"Carbon Steel", "technic:carbon_steel_ingot"},
register_dust("Chernobylite", "technic:chernobylite_block") {"Cast Iron", "technic:cast_iron_ingot"},
register_dust("Chromium", "technic:chromium_ingot") {"Chernobylite", "technic:chernobylite_block"},
register_dust("Coal", nil) {"Chromium", "technic:chromium_ingot"},
register_dust("Copper", "default:copper_ingot") {"Coal", nil},
register_dust("Lead", "technic:lead_ingot") {"Copper", "default:copper_ingot"},
register_dust("Gold", "default:gold_ingot") {"Lead", "technic:lead_ingot"},
register_dust("Mithril", "moreores:mithril_ingot") {"Gold", "default:gold_ingot"},
register_dust("Silver", "moreores:silver_ingot") {"Mithril", "moreores:mithril_ingot"},
register_dust("Stainless Steel", "technic:stainless_steel_ingot") {"Silver", "moreores:silver_ingot"},
register_dust("Stone", "default:stone") {"Stainless Steel", "technic:stainless_steel_ingot"},
register_dust("Sulfur", nil) {"Stone", "default:stone"},
register_dust("Tin", "default:tin_ingot") {"Sulfur", nil},
register_dust("Wrought Iron", "technic:wrought_iron_ingot") {"Tin", "default:tin_ingot"},
register_dust("Zinc", "technic:zinc_ingot") {"Wrought Iron", "technic:wrought_iron_ingot"},
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then {"Zinc", "technic:zinc_ingot"},
register_dust("Akalin", "glooptest:akalin_ingot") }
register_dust("Alatro", "glooptest:alatro_ingot")
register_dust("Arol", "glooptest:arol_ingot") local dependent_dusts = {
register_dust("Kalite", nil) everness = {
register_dust("Talinite", "glooptest:talinite_ingot") {"Pyrite", "everness:pyrite_ingot"},
},
gloopores = {
{"Akalin", "glooptest:akalin_ingot"},
{"Alatro", "glooptest:alatro_ingot"},
{"Arol", "glooptest:arol_ingot"},
{"Kalite", nil},
{"Talinite", "glooptest:talinite_ingot"},
},
nether = {
{"Nether", "nether:nether_ingot"},
},
}
for dependency, dusts_to_add in pairs(dependent_dusts) do
if minetest.get_modpath(dependency) then
for _, dust_entry in pairs(dusts_to_add) do
table.insert(dusts, dust_entry)
end
end
end end
for _, data in ipairs(dusts) do
register_dust(data[1], data[2])
end
-- Uranium
for p = 0, 35 do for p = 0, 35 do
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil
local psuffix = p == 7 and "" or p local psuffix = p == 7 and "" or p
@ -158,6 +206,7 @@ for pa = 0, 34 do
end end
end end
-- Fuels
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "technic:coal_dust", recipe = "technic:coal_dust",

View File

@ -32,7 +32,10 @@ function technic.register_recipe_type(typename, origdata)
end end
local function get_recipe_index(items) local function get_recipe_index(items)
if not items or type(items) ~= "table" then return false end if type(items) ~= "table" then
return false
end
local l = {} local l = {}
for i, stack in ipairs(items) do for i, stack in ipairs(items) do
l[i] = ItemStack(stack):get_name() l[i] = ItemStack(stack):get_name()
@ -75,22 +78,21 @@ local function register_recipe(typename, data)
end end
if (have_cg or have_i3) and technic.recipes[typename].output_size == 1 then if (have_cg or have_i3) and technic.recipes[typename].output_size == 1 then
local result = data.output local result = data.output
if (type(result)=="table") then if type(result) == "table" then
result = result[1] result = result[1]
end end
local items = table.concat(data.input, ", ")
if have_cg and craftguide.register_craft then if have_cg and craftguide.register_craft then
craftguide.register_craft({ craftguide.register_craft({
type = typename, type = typename,
result = result, result = result,
items = {items}, items = data.input,
}) })
end end
if have_i3 then if have_i3 then
i3.register_craft({ i3.register_craft({
type = typename, type = typename,
result = result, result = result,
items = {items}, items = data.input,
}) })
end end
end end

View File

@ -97,12 +97,14 @@ local function flatten(map)
return list return list
end end
-- Add a wire node to the LV/MV/HV network -- Add a node to the LV/MV/HV network
-- Returns: indicator whether the cable is new in the network -- Returns: indicator whether the node is new in the network
local hash_node_position = minetest.hash_node_position local hash_node_position = minetest.hash_node_position
local function add_network_node(nodes, pos, network_id) local function add_network_node(nodes, pos, network_id)
local node_id = hash_node_position(pos) local node_id = hash_node_position(pos)
technic.cables[node_id] = network_id if network_id then
technic.cables[node_id] = network_id
end
if nodes[node_id] then if nodes[node_id] then
return false return false
end end
@ -136,21 +138,31 @@ local check_node_subp = function(network, pos, machines, sw_pos, from_below, net
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
-- Normal tostring() does not have enough precision, neither does meta:set_int() -- 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) -- Lua 5.1 bug: Cannot use hexadecimal notation for compression (see LuaJIT #911)
meta:set_string(network.tier.."_network", string.format("%.20g", network_id)) local network_str = string.format("%.20g", network_id)
local network_key = network.tier.."_network"
local m_network_str = meta:get_string(network_key)
if m_network_str == "" then
meta:set_string(network_key, network_str)
else
if m_network_str ~= network_str then
return
end
end
if eu_type == technic.producer then if eu_type == technic.producer then
add_network_node(network.PR_nodes, pos, network_id) add_network_node(network.PR_nodes, pos)
elseif eu_type == technic.receiver then elseif eu_type == technic.receiver then
add_network_node(network.RE_nodes, pos, network_id) add_network_node(network.RE_nodes, pos)
elseif eu_type == technic.producer_receiver then elseif eu_type == technic.producer_receiver then
add_network_node(network.PR_nodes, pos, network_id) add_network_node(network.PR_nodes, pos)
add_network_node(network.RE_nodes, pos, network_id) add_network_node(network.RE_nodes, pos)
elseif eu_type == technic.battery then elseif eu_type == technic.battery then
add_network_node(network.BA_nodes, pos, network_id) add_network_node(network.BA_nodes, pos)
elseif eu_type == "SPECIAL" and from_below and elseif eu_type == "SPECIAL" and from_below and
not vector.equals(pos, sw_pos) then not vector.equals(pos, sw_pos) then
-- Another switching station -> disable it -- Another switching station -> disable it
add_network_node(network.SP_nodes, pos, network_id) add_network_node(network.SP_nodes, pos)
meta:set_int("active", 0) meta:set_int("active", 0)
end end
@ -193,7 +205,6 @@ local get_network = function(sw_pos, cable_pos, tier)
end end
return cached.PR_nodes, cached.BA_nodes, cached.RE_nodes return cached.PR_nodes, cached.BA_nodes, cached.RE_nodes
end end
local machines = technic.machines[tier] local machines = technic.machines[tier]
local network = { local network = {
tier = tier, tier = tier,
@ -455,6 +466,7 @@ local function switching_station_timeout_count(pos, tier)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local timeout = meta:get_int(tier.."_EU_timeout") local timeout = meta:get_int(tier.."_EU_timeout")
if timeout <= 0 then if timeout <= 0 then
meta:set_string(tier.."_network", "")
meta:set_int(tier.."_EU_input", 0) -- Not needed anymore <-- actually, it is for supply converter meta:set_int(tier.."_EU_input", 0) -- Not needed anymore <-- actually, it is for supply converter
return true return true
else else
@ -468,22 +480,29 @@ minetest.register_abm({
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local has_network = false
local technic_machine = false
for tier, machines in pairs(technic.machines) do for tier, machines in pairs(technic.machines) do
if machines[node.name] and switching_station_timeout_count(pos, tier) then if machines[node.name] then
local nodedef = minetest.registered_nodes[node.name] technic_machine = true
if nodedef then if not switching_station_timeout_count(pos, tier) then
local meta = minetest.get_meta(pos) has_network = true
meta:set_string("infotext", S("%s Has No Network"):format(nodedef.description))
end
if nodedef and nodedef.technic_disabled_machine_name then
node.name = nodedef.technic_disabled_machine_name
minetest.swap_node(pos, node)
end
if nodedef and nodedef.technic_on_disable then
nodedef.technic_on_disable(pos, node)
end end
end end
end end
if technic_machine and not has_network then
local nodedef = minetest.registered_nodes[node.name]
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("%s Has No Network"):format(nodedef.description))
if nodedef.technic_disabled_machine_name then
node.name = nodedef.technic_disabled_machine_name
minetest.swap_node(pos, node)
end
if nodedef.technic_on_disable then
nodedef.technic_on_disable(pos, node)
end
end
end, end,
}) })

View File

@ -1,3 +1,3 @@
name = technic name = technic
depends = default, pipeworks, technic_worldgen, basic_materials 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, nether

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: 207 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: 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 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.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.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.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 B

View File

@ -12,14 +12,6 @@ local function set_can_wear(itemstack, level, max_level)
itemstack:set_wear(temp) itemstack:set_wear(temp)
end end
local function get_can_level(itemstack)
if itemstack:get_metadata() == "" then
return 0
else
return tonumber(itemstack:get_metadata())
end
end
function technic.register_can(d) function technic.register_can(d)
local data = {} local data = {}
for k, v in pairs(d) do data[k] = v end for k, v in pairs(d) do data[k] = v end
@ -33,7 +25,8 @@ function technic.register_can(d)
if pointed_thing.type ~= "node" then return end if pointed_thing.type ~= "node" then return end
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
if node.name ~= data.liquid_source_name then return end if node.name ~= data.liquid_source_name then return end
local charge = get_can_level(itemstack) local meta = technic.get_stack_meta_cans(itemstack)
local charge = meta:get_int("can_level")
if charge == data.can_capacity then return end if charge == data.can_capacity then return end
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
minetest.log("action", user:get_player_name().. minetest.log("action", user:get_player_name()..
@ -44,7 +37,7 @@ function technic.register_can(d)
end end
minetest.remove_node(pointed_thing.under) minetest.remove_node(pointed_thing.under)
charge = charge + 1 charge = charge + 1
itemstack:set_metadata(tostring(charge)) meta:set_int("can_level", charge)
set_can_wear(itemstack, charge, data.can_capacity) set_can_wear(itemstack, charge, data.can_capacity)
return itemstack return itemstack
end, end,
@ -63,7 +56,8 @@ function technic.register_can(d)
-- Try to place node above the pointed source, or abort. -- Try to place node above the pointed source, or abort.
if not def.buildable_to or node_name == data.liquid_source_name then return end if not def.buildable_to or node_name == data.liquid_source_name then return end
end end
local charge = get_can_level(itemstack) local meta = technic.get_stack_meta_cans(itemstack)
local charge = meta:get_int("can_level")
if charge == 0 then return end if charge == 0 then return end
if minetest.is_protected(pos, user:get_player_name()) then if minetest.is_protected(pos, user:get_player_name()) then
minetest.log("action", user:get_player_name().. minetest.log("action", user:get_player_name()..
@ -74,12 +68,13 @@ function technic.register_can(d)
end end
minetest.set_node(pos, {name=data.liquid_source_name}) minetest.set_node(pos, {name=data.liquid_source_name})
charge = charge - 1 charge = charge - 1
itemstack:set_metadata(tostring(charge)) meta:set_int("can_level", charge)
set_can_wear(itemstack, charge, data.can_capacity) set_can_wear(itemstack, charge, data.can_capacity)
return itemstack return itemstack
end, end,
on_refill = function(stack) on_refill = function(stack)
stack:set_metadata(tostring(data.can_capacity)) local meta = technic.get_stack_meta_cans(stack)
meta:set_int("can_level", data.can_capacity)
set_can_wear(stack, data.can_capacity, data.can_capacity) set_can_wear(stack, data.can_capacity, data.can_capacity)
return stack return stack
end, end,

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