19 Commits

Author SHA1 Message Date
2454382e90 technic_cnc: use programs definition to generate formspec
This deprecates the variables onesize_products and twosize_products
by using a shared definition table.
2024-08-02 19:08:39 +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
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
132 changed files with 797 additions and 588 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.

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},

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

@ -160,6 +160,11 @@ Unsorted functions:
* If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this
function does nothing, else that value is the maximum 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
* `technic.get_or_load_node(pos)`

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;]"..
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.5,1.5;2,1;start;Start]"..
"checkbox[5.5,2.5;autostart;automatic Start;"..meta:get_string("autostart").."]"
"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

@ -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})

View File

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

View File

@ -409,28 +409,23 @@ minetest.register_on_player_receive_fields(
end
)
local function default_get_charge(itemstack)
function technic.get_charge(itemstack)
-- check if is chargable
local tool_name = itemstack:get_name()
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)
function technic.set_charge(itemstack, charge)
local tool_name = itemstack:get_name()
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)
@ -442,8 +437,8 @@ function technic.charge_tools(meta, batt_charge, charge_step)
-- get callbacks
local src_def = src_stack:get_definition()
local technic_get_charge = src_def.technic_get_charge or default_get_charge
local technic_set_charge = src_def.technic_set_charge or default_set_charge
local technic_get_charge = src_def.technic_get_charge or technic.get_charge
local technic_set_charge = src_def.technic_set_charge or technic.set_charge
-- get tool charge
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
local src_def = src_stack:get_definition()
local technic_get_charge = src_def.technic_get_charge or default_get_charge
local technic_set_charge = src_def.technic_set_charge or default_set_charge
local technic_get_charge = src_def.technic_get_charge or technic.get_charge
local technic_set_charge = src_def.technic_set_charge or technic.set_charge
-- get tool charge
local tool_charge, item_max_charge = technic_get_charge(src_stack)

View File

@ -8,6 +8,71 @@ function technic.register_compressor_recipe(data)
technic.register_recipe("compressing", data)
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 = {
{"default:snowblock", "default:ice"},
{"default:sand 2", "default:sandstone"},
@ -21,27 +86,36 @@ local recipes = {
{"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
minetest.clear_craft({
recipe = {
{"default:sand", "default:sand"},
{"default:sand", "default:sand"},
local dependent_recipes = {
everness = {
{"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"},
},
})
minetest.clear_craft({
recipe = {
{"default:desert_sand", "default:desert_sand"},
{"default:desert_sand", "default:desert_sand"},
nether = {
{"nether:brick 9", "nether:brick_compressed"},
{"nether:brick_compressed 9", "nether:nether_lump"},
{"nether:rack", "nether:brick",},
{"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
technic.register_compressor_recipe({input = {data[1]}, output = data[2]})
end

View File

@ -36,49 +36,73 @@ local recipes = {
{"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)
minetest.clear_craft({
recipe = {
{"default:sandstone"}
},
recipe = {{"default:sandstone"}},
})
minetest.clear_craft({
recipe = {
{"default:desert_sandstone"}
},
recipe = {{"default:desert_sandstone"}},
})
minetest.clear_craft({
recipe = {
{"default:silver_sandstone"}
},
recipe = {{"default:silver_sandstone"}},
})
if minetest.get_modpath("farming") then
table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"})
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("moreores") then
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
for _, data in ipairs(recipes) do
technic.register_grinder_recipe({input = {data[1]}, output = data[2]})
end
-- dusts
-- Dusts
local function register_dust(name, ingot)
local lname = string.lower(name)
lname = string.gsub(lname, ' ', '_')
@ -96,33 +120,57 @@ local function register_dust(name, ingot)
end
end
-- Sorted alphibeticaly
register_dust("Brass", "basic_materials:brass_ingot")
register_dust("Bronze", "default:bronze_ingot")
register_dust("Carbon Steel", "technic:carbon_steel_ingot")
register_dust("Cast Iron", "technic:cast_iron_ingot")
register_dust("Chernobylite", "technic:chernobylite_block")
register_dust("Chromium", "technic:chromium_ingot")
register_dust("Coal", nil)
register_dust("Copper", "default:copper_ingot")
register_dust("Lead", "technic:lead_ingot")
register_dust("Gold", "default:gold_ingot")
register_dust("Mithril", "moreores:mithril_ingot")
register_dust("Silver", "moreores:silver_ingot")
register_dust("Stainless Steel", "technic:stainless_steel_ingot")
register_dust("Stone", "default:stone")
register_dust("Sulfur", nil)
register_dust("Tin", "default:tin_ingot")
register_dust("Wrought Iron", "technic:wrought_iron_ingot")
register_dust("Zinc", "technic:zinc_ingot")
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
register_dust("Akalin", "glooptest:akalin_ingot")
register_dust("Alatro", "glooptest:alatro_ingot")
register_dust("Arol", "glooptest:arol_ingot")
register_dust("Kalite", nil)
register_dust("Talinite", "glooptest:talinite_ingot")
-- Sorted alphabetically
local dusts = {
{"Brass", "basic_materials:brass_ingot"},
{"Bronze", "default:bronze_ingot"},
{"Carbon Steel", "technic:carbon_steel_ingot"},
{"Cast Iron", "technic:cast_iron_ingot"},
{"Chernobylite", "technic:chernobylite_block"},
{"Chromium", "technic:chromium_ingot"},
{"Coal", nil},
{"Copper", "default:copper_ingot"},
{"Lead", "technic:lead_ingot"},
{"Gold", "default:gold_ingot"},
{"Mithril", "moreores:mithril_ingot"},
{"Silver", "moreores:silver_ingot"},
{"Stainless Steel", "technic:stainless_steel_ingot"},
{"Stone", "default:stone"},
{"Sulfur", nil},
{"Tin", "default:tin_ingot"},
{"Wrought Iron", "technic:wrought_iron_ingot"},
{"Zinc", "technic:zinc_ingot"},
}
local dependent_dusts = {
everness = {
{"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
for _, data in ipairs(dusts) do
register_dust(data[1], data[2])
end
-- Uranium
for p = 0, 35 do
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil
local psuffix = p == 7 and "" or p
@ -158,6 +206,7 @@ for pa = 0, 34 do
end
end
-- Fuels
minetest.register_craft({
type = "fuel",
recipe = "technic:coal_dust",

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, 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)
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)
local data = {}
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
local node = minetest.get_node(pointed_thing.under)
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 minetest.is_protected(pointed_thing.under, user:get_player_name()) then
minetest.log("action", user:get_player_name()..
@ -44,7 +37,7 @@ function technic.register_can(d)
end
minetest.remove_node(pointed_thing.under)
charge = charge + 1
itemstack:set_metadata(tostring(charge))
meta:set_int("can_level", charge)
set_can_wear(itemstack, charge, data.can_capacity)
return itemstack
end,
@ -63,7 +56,8 @@ function technic.register_can(d)
-- 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
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 minetest.is_protected(pos, user:get_player_name()) then
minetest.log("action", user:get_player_name()..
@ -74,12 +68,13 @@ function technic.register_can(d)
end
minetest.set_node(pos, {name=data.liquid_source_name})
charge = charge - 1
itemstack:set_metadata(tostring(charge))
meta:set_int("can_level", charge)
set_can_wear(itemstack, charge, data.can_capacity)
return itemstack
end,
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)
return stack
end,

View File

@ -5,9 +5,9 @@ local chainsaw_max_charge = 30000 -- Maximum charge of the saw
-- if this is disabled.
local chainsaw_leaves = true
local chainsaw_efficiency = 0.95 -- Drops less items
local chainsaw_efficiency = 0.92 -- Drops less items
-- Maximal dimensions of the tree to cut
-- Maximal dimensions of the tree to cut (giant sequoia)
local tree_max_radius = 10
local tree_max_height = 70
@ -39,12 +39,16 @@ local tree_nodes = {
["ethereal:bamboo"] = -1,
}
local tree_nodes_by_cid = {
-- content ID indexed table, data populated on mod load.
-- Format: [node_name] = cost_number
}
-- Function to decide whether or not to cut a certain node (and at which energy cost)
local function populate_costs(name, def)
repeat
if tree_nodes[name] == -1 then
tree_nodes[name] = nil
break -- Manually added, but need updating
if tree_nodes[name] then
break -- Manually specified node to chop
end
if (def.groups.tree or 0) > 0 then
break -- Tree node
@ -61,17 +65,18 @@ local function populate_costs(name, def)
until 1
-- luacheck: pop
-- Function did not return! --> add content ID to the digging table
-- Add the node cost to the content ID indexed table
local content_id = minetest.get_content_id(name)
-- Get 12 in average
local cost = 0
-- Make it so that the giant sequoia can be cut with a full charge
local cost = tree_nodes[name] or 0
if def.groups.choppy then
cost = def.groups.choppy * 5 -- trunks (usually 3 * 5)
elseif def.groups.snappy then
cost = def.groups.snappy * 2 -- leaves
cost = math.max(cost, def.groups.choppy * 14) -- trunks (usually 3 * 14)
end
tree_nodes[content_id] = math.max(4, cost)
if def.groups.snappy then
cost = math.max(cost, def.groups.snappy * 2) -- leaves
end
tree_nodes_by_cid[content_id] = math.max(4, cost)
end
minetest.register_on_mods_loaded(function()
@ -111,6 +116,7 @@ local cutter = {
-- See function cut_tree()
}
local safe_cut = minetest.settings:get_bool("technic_safe_chainsaw") ~= false
local c_air = minetest.get_content_id("air")
local function dig_recursive(x, y, z)
local i = cutter.area:index(x, y, z)
@ -119,13 +125,14 @@ local function dig_recursive(x, y, z)
end
cutter.seen[i] = 1 -- Mark as visited
if cutter.param2[i] ~= 0 then
if safe_cut and cutter.param2[i] ~= 0 then
-- Do not dig manually placed nodes
-- Problem: moretrees' generated jungle trees use param2 = 2
return
end
local c_id = cutter.data[i]
local cost = tree_nodes[c_id]
local cost = tree_nodes_by_cid[c_id]
if not cost or cost > cutter.charge then
return -- Cannot dig this node
end
@ -306,10 +313,8 @@ minetest.register_tool("technic:chainsaw", {
return itemstack
end
local meta = minetest.deserialize(itemstack:get_metadata())
if not meta or not meta.charge then
return
end
local meta = technic.get_stack_meta(itemstack)
local charge = meta:get_int("technic:charge")
local name = user:get_player_name()
if minetest.is_protected(pointed_thing.under, name) then
@ -319,14 +324,14 @@ minetest.register_tool("technic:chainsaw", {
-- Send current charge to digging function so that the
-- chainsaw will stop after digging a number of nodes
chainsaw_dig(user, pointed_thing.under, meta.charge)
meta.charge = cutter.charge
chainsaw_dig(user, pointed_thing.under, charge)
charge = cutter.charge
cutter = {} -- Free RAM
if not technic.creative_mode then
technic.set_RE_wear(itemstack, meta.charge, chainsaw_max_charge)
itemstack:set_metadata(minetest.serialize(meta))
meta:set_int("technic:charge", charge)
technic.set_RE_wear(itemstack, charge, chainsaw_max_charge)
end
return itemstack
end,

View File

@ -38,12 +38,13 @@ local function check_for_flashlight(player)
local hotbar = inv:get_list("main")
for i = 1, 8 do
if hotbar[i]:get_name() == "technic:flashlight" then
local meta = minetest.deserialize(hotbar[i]:get_metadata())
if meta and meta.charge and meta.charge >= 2 then
local meta = technic.get_stack_meta(hotbar[i])
local charge = meta:get_int("technic:charge")
if charge >= 2 then
if not technic.creative_mode then
meta.charge = meta.charge - 2;
technic.set_RE_wear(hotbar[i], meta.charge, flashlight_max_charge)
hotbar[i]:set_metadata(minetest.serialize(meta))
charge = charge - 2;
meta:set_int("technic:charge", charge)
technic.set_RE_wear(hotbar[i], charge, flashlight_max_charge)
inv:set_stack("main", i, hotbar[i])
end
return true

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