Namespacing pt. 1

This commit is contained in:
2022-11-22 00:44:34 -05:00
parent 750d6abc26
commit 293822f2a9
763 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
local cplate_id = terumet.id('item_ceramic')
local cblock_id = terumet.id('block_ceramic')
minetest.register_craftitem( cplate_id, {
description = 'Teruceramic Plate',
inventory_image = terumet.tex(cplate_id)
})
minetest.register_node( cblock_id, {
description = 'Teruceramic Block',
tiles = {terumet.tex(cblock_id)},
is_ground_content = false,
groups={cracky=1, level=1, puts_out_fire=1},
sounds = default.node_sound_glass_defaults()
})
minetest.register_craft{ output = cblock_id,
recipe = terumet.recipe_3x3(cplate_id)
}
minetest.register_craft{ type = 'shapeless', output = terumet.id('item_ceramic', 9),
recipe = {cblock_id}
}

View File

@@ -0,0 +1,120 @@
local coke_id = terumet.id('item_coke')
minetest.register_craftitem( coke_id, {
description = 'Coke Lump',
inventory_image = terumet.tex(coke_id),
groups = {coal = 1, flammable = 1},
})
minetest.register_craft({
type = "fuel",
recipe = coke_id,
burntime = 80,
})
local coke_block_id = terumet.id('block_coke')
minetest.register_node( coke_block_id, {
description = 'Coke Block',
tiles = {terumet.tex(coke_block_id)},
is_ground_content = false,
groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_craft({
type = "fuel",
recipe = coke_block_id,
burntime = 740,
})
minetest.register_craft{ output = coke_block_id,
recipe = terumet.recipe_3x3(coke_id)
}
minetest.register_craft{ type = 'shapeless', output = coke_id .. ' 9',
recipe = {coke_block_id},
}
local tarball_id = terumet.id('item_tarball')
minetest.register_craftitem( tarball_id, {
description = 'Tarball',
inventory_image = terumet.tex(tarball_id),
groups = {glue=1}
})
minetest.register_craft({
type = "fuel",
recipe = tarball_id,
burntime = 30,
})
local tarblock_id = terumet.id('block_tar')
minetest.register_node( tarblock_id, {
description = 'Tar Block',
tiles = {terumet.tex(tarblock_id)},
is_ground_content = false,
groups = {level=2, crumbly=2, cracky=1, snappy=2, choppy=2, disable_jump=1, fall_damage_add_percent=-100},
sounds = terumet.squishy_node_sounds
})
minetest.register_craft{ output = tarblock_id,
recipe = terumet.recipe_box(tarball_id, '')
}
minetest.register_craft{ type = 'shapeless', output = tarball_id .. ' 8', recipe = {tarblock_id} }
local prerubber_id = terumet.id('item_prerub')
minetest.register_craftitem( prerubber_id, {
description = 'Bio-tar Mixture',
inventory_image = terumet.tex(prerubber_id)
})
minetest.register_craft{ output = prerubber_id,
recipe = {
{'', tarball_id, ''},
{tarball_id, 'terumet:item_dust_bio', tarball_id},
{'', tarball_id, ''}
}
}
local rubber_bar_id = terumet.id('item_rubber')
terumet.options.vulcan.recipes[prerubber_id] = {rubber_bar_id, 1}
minetest.register_craftitem( rubber_bar_id, {
description = 'Synthetic Rubber Bar',
inventory_image = terumet.tex(rubber_bar_id)
})
local rsuit_mat = terumet.id('item_rsuitmat')
minetest.register_craftitem( rsuit_mat, {
description = 'Vulcansuit Plate',
inventory_image = terumet.tex(rsuit_mat)
})
terumet.register_alloy_recipe{result=rsuit_mat, flux=8, time=20.0, input={rubber_bar_id, 'terumet:ingot_cgls', 'terumet:item_ceramic'}}
local asphalt_id = terumet.id('block_asphalt')
minetest.register_node( asphalt_id, {
description = 'Asphalt Block',
tiles = {terumet.tex(asphalt_id)},
is_ground_content = false,
groups = {cracky = 3, crumbly = 1, level = 1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_craft({
output = asphalt_id..' 8',
recipe = terumet.recipe_box('default:gravel', tarball_id)
})
walls.register(terumet.id('wall_asphalt'), 'Asphalt Wall', terumet.tex(asphalt_id), asphalt_id, default.node_sound_stone_defaults())
stairs.register_stair_and_slab('asphalt', asphalt_id, {cracky = 3, crumbly = 1, level = 1}, {terumet.tex(asphalt_id)}, 'Asphalt Stair', 'Asphalt Slab', default.node_sound_stone_defaults(), false )

View File

@@ -0,0 +1,20 @@
local reg_coil = function(name, mat)
local coil_id = terumet.id('item_coil_'..mat)
minetest.register_craftitem( coil_id, {
description = name,
inventory_image = terumet.tex(coil_id)
})
local ingot_id = terumet.id('ingot_'..mat)
minetest.register_craft{ output=coil_id .. ' 3',
recipe = {
{ingot_id},
{ingot_id},
{ingot_id},
}
}
end
reg_coil('Pure Terumetal Coil', 'raw')
reg_coil('Terucopper Coil', 'tcop')
reg_coil('Terugold Coil', 'tgol')

View File

@@ -0,0 +1,152 @@
local CONCRETE_COLORS = {
'#FFF',--white
'#AAA',--grey
'#666',--dark grey
'#333',--black
'#722ed4',--violet
'#2e56d4',--blue
'#5484ac',--cyan
'#135918',--dark green
'#3ad42e',--green
'#d4c12e',--yellow
'#592e13',--brown
'#d4652e',--orange
'#d42e2e',--red
'#d80481',--magenta
'#ff7272',--pink
}
local mix_base = terumet.id('block_conmix')
local block_base = terumet.id('block_con')
local FMT = string.format
local function mix_id(dye_index)
return FMT("%s_%s", mix_base, dye.dyes[dye_index][1])
end
function terumet.concrete_block_id(dye_index)
return FMT("%s_%s", block_base, dye.dyes[dye_index][1])
end
local NAMEFORMATS = {
mix="%s Concrete Mix",
block="%s Concrete Block",
door="%s Concrete Door",
wall="%s Concrete Wall",
stair="%s Concrete Stair",
slab="%s Concrete Slab"
}
local function make_name(name, dye_index)
return FMT(NAMEFORMATS[name], dye.dyes[dye_index][2])
end
local function texture(base, dye_index)
return FMT("%s^[multiply:%s", base, CONCRETE_COLORS[dye_index])
end
local function mix_texture(dye_index)
return texture(terumet.tex('block_conmix'), dye_index)
end
local function block_texture(dye_index)
return texture(terumet.tex('block_con'), dye_index)
end
local function door_texture(dye_index)
return texture(terumet.tex('door_con'), dye_index)
end
local function door_item_texture(dye_index)
return texture(terumet.tex('dinv_con'), dye_index)
end
local HARDEN_LIST = {}
local MIXES_LIST = {}
for index,dye_info in ipairs(dye.dyes) do
local con_id = 'con_'..dye_info[1]
minetest.register_node(mix_id(index), {
description = make_name('mix', index),
tiles = {mix_texture(index)},
is_ground_content = false,
groups = {crumbly=2},
--sounds = default.node_sound_sand_defaults(),
})
local block_id = terumet.concrete_block_id(index)
minetest.register_node(block_id, {
description = make_name('block', index),
tiles = {block_texture(index)},
is_ground_content = false,
groups = {cracky = 2, level = 1},
sounds = default.node_sound_stone_defaults(),
})
if index ~= 1 then
local dye_id = "group:dye,color_"..dye_info[1]
local basic_powder = mix_id(1)
minetest.register_craft{
output = mix_id(index)..' 8',
recipe = terumet.recipe_box(basic_powder, dye_id)
}
minetest.register_craft{
output = mix_id(index)..' 8',
recipe = terumet.recipe_box(basic_powder, 'dye:'..dye_info[1])
}
end
HARDEN_LIST[mix_id(index)] = block_id
table.insert(MIXES_LIST, mix_id(index))
walls.register(terumet.id('wall_'..con_id), make_name('wall', index), block_texture(index), block_id, default.node_sound_stone_defaults())
doors.register(terumet.id('door_'..con_id), {
tiles = {{name = door_texture(index), backface_culling = true}},
description = make_name('door', index),
inventory_image = door_item_texture(index),
protected = true,
groups = {cracky = 2, level = 1},
sounds = default.node_sound_stone_defaults(),
sound_open = 'doors_steel_door_open',
sound_close = 'doors_steel_door_close',
recipe = {
{block_id},
{'doors:door_steel'},
{block_id},
}
})
stairs.register_stair_and_slab(con_id, block_id,
{cracky = 2, level = 1},
{block_texture(index)},
make_name('stair',index), make_name('slab', index),
default.node_sound_stone_defaults(),
false
)
end
minetest.register_abm{
label = 'Concrete mix hardening',
nodenames = MIXES_LIST,
neighbors = {'default:water_source', 'default:water_flowing'},
interval = 3.0, -- Run every 3 seconds
chance = 1, -- always
action = function(pos, node, active_object_count, active_object_count_wider)
local harden_id = HARDEN_LIST[node.name]
if harden_id then
minetest.set_node(pos, {name = harden_id})
end
end
}
local gravel_id = 'default:gravel'
local any_sand = 'group:sand'
minetest.register_craft{
output = mix_id(1)..' 8',
recipe = {
{any_sand, gravel_id, any_sand},
{gravel_id, '', gravel_id},
{any_sand, gravel_id, any_sand}
}
}

View File

@@ -0,0 +1,96 @@
local biomat_item = terumet.id('item_dust_bio')
local biomat_block = terumet.id('block_dust_bio')
local woodmulch_item = terumet.id('item_dust_wood')
local glue_item = terumet.id('item_glue')
minetest.register_craftitem( terumet.id('item_dust_ob'), {
description = 'Obsidian Grit',
inventory_image = terumet.tex('item_dust_ob')
})
-- ========================================================
minetest.register_craftitem( woodmulch_item, {
description = 'Wood Mulch',
inventory_image = terumet.tex('item_dust_wood')
})
minetest.register_craft({
type = 'fuel',
recipe = woodmulch_item,
burntime = 10,
})
minetest.register_craft{ output = 'default:paper',
type = 'shapeless',
recipe = {'bucket:bucket_water', woodmulch_item, woodmulch_item},
replacements={{'bucket:bucket_water','bucket:bucket_empty'}}
}
-- =======================================================
minetest.register_craftitem( biomat_item, {
description = 'Biomatter',
inventory_image = terumet.tex('item_dust_bio')
})
minetest.register_craft{
type = 'fuel',
recipe = biomat_item,
burntime = 30,
}
minetest.register_node( biomat_block, {
description = 'Biomatter Block',
tiles = {terumet.tex('block_dust_bio')},
is_ground_content = false,
groups={crumbly=3, oddly_breakable_by_hand=2, flammable=1},
sounds = default.node_sound_leaves_defaults()
})
minetest.register_craft{
type = 'fuel',
recipe = biomat_block,
burntime = 280,
}
minetest.register_craft{ output = biomat_block,
recipe = terumet.recipe_3x3(biomat_item)
}
minetest.register_craft{ output = biomat_item..' 9',
type = 'shapeless',
recipe = {biomat_block}
}
minetest.register_craft{ output = 'default:torch 4',
recipe = { {biomat_item},
{'group:stick'}}
}
-- =======================================================
minetest.register_craftitem( glue_item, {
description = 'Plant Glue',
groups = {glue=1},
inventory_image = terumet.tex('item_glue')
})
minetest.register_craft{ output = glue_item,
type = 'shapeless',
recipe = {'bucket:bucket_water', biomat_item},
replacements={{'bucket:bucket_water','bucket:bucket_empty'}}
}
minetest.register_craft{ output = glue_item .. ' 9',
type = 'shapeless',
recipe = {'bucket:bucket_water', biomat_block},
replacements={{'bucket:bucket_water','bucket:bucket_empty'}}
}
minetest.register_craft{ output = glue_item .. ' 8',
type = 'shapeless',
recipe = {'bucket:bucket_water', 'farming:flour'},
replacements={{'bucket:bucket_water','bucket:bucket_empty'}}
}

View File

@@ -0,0 +1,88 @@
local id=terumet.id
local opts = terumet.options.vulcan
local crys_terumetal = terumet.register_crystal{
suffix='raw',
color='#a33d57',
name='Crystallized Terumetal',
cooking_result=id('ingot_raw')
}
terumet.register_vulcan_result(id('lump_raw'), crys_terumetal, nil, true) -- 4th arg indicates it is a terumetal specialized recipe
terumet.register_vulcan_result(id('ore_raw'), crys_terumetal, 1, true)
terumet.register_vulcan_result(id('ore_raw_desert'), crys_terumetal, 2, true)
local crys_copper = terumet.register_crystal{
suffix='copper',
color='#ec923a',
name='Crystallized Copper',
cooking_result='default:copper_ingot'
}
terumet.register_vulcan_result('default:copper_lump', crys_copper)
terumet.register_vulcan_result('default:stone_with_copper', crys_copper, 1)
local crys_tin = terumet.register_crystal{
suffix='tin',
color='#dddddd',
name='Crystallized Tin',
cooking_result='default:tin_ingot'
}
terumet.register_vulcan_result('default:tin_lump', crys_tin )
terumet.register_vulcan_result('default:stone_with_tin', crys_tin, 1)
local crys_iron = terumet.register_crystal{
suffix='iron',
color='#ffdcb5',
name='Crystallized Iron',
cooking_result='default:steel_ingot'
}
terumet.register_vulcan_result('default:iron_lump', crys_iron)
terumet.register_vulcan_result('default:stone_with_iron', crys_iron, 1)
local crys_gold = terumet.register_crystal{
suffix='gold',
color='#ffcb15',
name='Crystallized Gold',
cooking_result='default:gold_ingot'
}
terumet.register_vulcan_result('default:gold_lump', crys_gold)
terumet.register_vulcan_result('default:stone_with_gold', crys_gold, 1)
local crys_ob = terumet.register_crystal{
suffix='ob',
color='#351569',
name='Crystallized Obsidian',
cooking_result='default:obsidian'
}
if opts.LIMIT_OBSIDIAN then
terumet.register_vulcan_result('default:obsidian', crys_ob, -1)
else
terumet.register_vulcan_result('default:obsidian', crys_ob)
end
local crys_mese = terumet.register_crystal{
suffix='mese',
color='#fffb81',
name='Crystallized Mese',
cooking_result='default:mese_crystal'
}
terumet.register_vulcan_result('default:stone_with_mese', crys_mese)
local crys_dia = terumet.register_crystal{
suffix='dia',
color='#66f6ff',
name='Crystallized Diamond',
cooking_result='default:diamond'
}
terumet.register_vulcan_result('default:stone_with_diamond', crys_dia)
-- outside mods can access ids of default crystallized materials through terumet.crystal_ids
terumet.crystal_ids = {
terumetal=crys_terumetal,
copper=crys_copper,
tin=crys_tin,
iron=crys_iron,
gold=crys_gold,
obsidian=crys_ob,
mese=crys_mese,
diamond=crys_dia
}

View File

@@ -0,0 +1,26 @@
local ent_crystal_id = terumet.id('item_entropy')
local ent_matrix_id = terumet.id('block_entropy')
minetest.register_craftitem( ent_crystal_id, {
description = 'Entropic Crystal',
inventory_image = terumet.tex(ent_crystal_id)
})
minetest.register_node( ent_matrix_id, {
description = 'Entropic Matrix\nPlace directly above EEE Heater',
tiles = {terumet.tex(ent_matrix_id)},
is_ground_content = false,
groups={cracky=1, level=2},
sounds = default.node_sound_glass_defaults()
})
minetest.register_craft{ output = ent_crystal_id,
recipe = {
{ terumet.id('item_dust_ob'), terumet.id('item_cryst_mese'), terumet.id('item_dust_ob') },
{ terumet.id('item_cryst_mese'), terumet.id('item_cryst_dia'), terumet.id('item_cryst_mese') },
{ terumet.id('item_dust_ob'), terumet.id('item_cryst_mese'), terumet.id('item_dust_ob') },
}}
minetest.register_craft{ output = ent_matrix_id,
recipe = terumet.recipe_box(ent_crystal_id, 'default:diamondblock')
}

View File

@@ -0,0 +1,41 @@
local ingot_id = terumet.id('ingot_meson')
local meson_color = '#be61ff'
minetest.register_craftitem( ingot_id, {
description = 'Fused Meson Ingot',
inventory_image = terumet.tex(ingot_id),
groups = {ingot = 1},
})
local toolstat = {times={1.3, 1.1, 0.9}, uses=0, maxlevel=5}
minetest.register_tool( terumet.id('tool_meson'), {
description = minetest.colorize(meson_color, 'Fused Meson Omni-tool'),
inventory_image = terumet.tex('tool_meson'),
wield_scale={x=1.8, y=1.8, z=1.4},
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level = 99,
groupcaps = {
cracky = toolstat,
crumbly = toolstat,
choppy = toolstat,
snappy = toolstat,
},
damage_groups = {fleshy=4},
},
})
--[[
Meson Fusion Reactor
Accepts items that yield repair material to create a critical mass. This mass is then superheated and Meson Fusion is attempted.
The chance of successful fusion is based on:
- The quality of materials used (the fewer items used -> higher chance)
- The time taken to reach the necessary heat (less time -> higher chance)
For 1 attempt at fusion the following is needed:
60 x 50 = 3500 RMP (repair material points) -- This averages to approx. 50 between alloyed iron and gold.
500000 HU -- assuming an average of 10000/second, averages to 50 seconds
]]

View File

@@ -0,0 +1,64 @@
local htg_id = terumet.id('item_htglass')
minetest.register_craftitem( htg_id, {
description = 'Heat-transference Glass',
inventory_image = terumet.tex(htg_id)
})
minetest.register_craft{ output = htg_id .. ' 3',
recipe = {
{'', 'default:obsidian_glass', ''},
{terumet.id('item_cryst_tin'), terumet.id('item_glue'), terumet.id('item_cryst_tin')},
{'', terumet.id('item_dust_ob'), ''}
}
}
-- =============================================
local emit_id = terumet.id('item_heatunit')
minetest.register_craftitem( emit_id, {
description = 'High Energy Alpha-wave Transmission Unit',
inventory_image = terumet.tex(emit_id)
})
minetest.register_craft{ output = emit_id,
recipe = {
{terumet.id('ingot_tgol'), 'default:obsidian_glass', terumet.id('ingot_tgol')},
{terumet.id('item_thermese'), 'default:mese_crystal', terumet.id('item_thermese')},
{terumet.id('item_ceramic'), terumet.id('item_coil_tgol'), terumet.id('item_ceramic')}
}
}
-- =============================================
local press_id = terumet.id('item_press')
minetest.register_craftitem( press_id, {
description = 'Terutin Expansion Press',
inventory_image = terumet.tex(press_id)
})
minetest.register_craft{ output = press_id,
recipe = {
{'default:stone', terumet.id('block_ttin'), 'default:stone'},
{terumet.id('ingot_tcha'), terumet.id('ingot_tcha'), terumet.id('ingot_tcha')},
{terumet.id('ingot_ttin'), terumet.id('ingot_ttin'), terumet.id('ingot_ttin')}
}
}
-- =============================================
local cryscham_id = terumet.id('item_cryscham')
minetest.register_craftitem( cryscham_id, {
description = 'Crystal Growth Chamber',
inventory_image = terumet.tex(cryscham_id)
})
minetest.register_craft{ output = cryscham_id,
recipe = {
{'default:obsidian_glass', 'default:obsidian_glass', 'default:obsidian_glass'},
{terumet.id('item_dust_ob'), terumet.id('item_dust_ob'), terumet.id('item_dust_ob')},
{terumet.id('ingot_tcha'), 'bucket:bucket_water', terumet.id('ingot_tcha')}
},
replacements={{'bucket:bucket_water','bucket:bucket_empty'}}
}

View File

@@ -0,0 +1,34 @@
local pwood_ytex = terumet.tex('block_pwood')
local pwood_xztex = terumet.tex('block_pwood_sides')
local pwood_tiles = {pwood_ytex, pwood_ytex, pwood_xztex}
local pwood_id = terumet.id('block_pwood')
minetest.register_node(pwood_id, {
description = "Pressed Wood",
tiles = pwood_tiles,
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft{ output = pwood_id..' 16',
recipe = terumet.recipe_box(terumet.id('item_dust_wood'), 'group:glue'),
}
if minetest.get_modpath('stairs') then
stairs.register_stair_and_slab(
'terumet_pwood',
pwood_id,
{choppy = 2, oddly_breakable_by_hand = 2},
pwood_tiles,
'Pressed Wood Stair',
'Pressed Wood Slab',
default.node_sound_wood_defaults()
)
end
if minetest.get_modpath('walls') then
walls.register(terumet.id('walls_pwood'), 'Pressed Wood Wall', pwood_tiles,
pwood_id, default.node_sound_stone_defaults())
end

View File

@@ -0,0 +1,16 @@
local id = terumet.id
local tex = terumet.tex
local function items(item, count)
return item .. ' ' .. count
end
local ore_stone = id('ore_raw')
local ore_stone_dense = id('ore_dense_raw')
local ore_desert_stone = id('ore_raw_desert')
local ore_desert_stone_dense = id('ore_raw_desert_dense')
local lump = id('lump_raw')
local ingot = id('ingot_raw')
local block = id('block_raw')

View File

@@ -0,0 +1,82 @@
local rebar_id = terumet.id('item_rebar')
minetest.register_craftitem( rebar_id, {
description = 'Teruchalcum Rebar',
inventory_image = terumet.tex('item_rebar'),
})
minetest.register_craft{ output=rebar_id..' 5', recipe=terumet.recipe_plus('terumet:ingot_tcha') }
local desc = {'Reinforced %s', 'Double-reinforced %s', 'Triple-reinforced %s'}
local blchance = {40, 20, 3}
local function reinf_block_id(code, rlv)
return minetest.get_current_modname()..':reinf_block_'..code..rlv
end
function terumet.register_reinforced_block(base, code)
local base_def = minetest.registered_nodes[base]
if not base_def then error('base '..base..' is not defined') end
for rlv = 1,3 do
local def = {}
for k,v in pairs(base_def) do
if k == 'groups' then
def.groups = {}
for gk,gv in pairs(v) do
if not terumet.options.misc.BLOCK_REMOVE_GROUPS[gk] then
def.groups[gk]=gv
end
end
else
def[k] = v
end
end
if not base_def.groups then
def.groups = {level=(rlv+1)}
else
def.groups.level = (base_def.groups.level or 1) + rlv
end
local id = reinf_block_id(code, rlv)
def.description = string.format(desc[rlv], base_def.description)
local visibility = terumet.options.cosmetic.REINFORCING_VISIBLE
if visibility then
local tileov = terumet.tex('blockov_rebar'..rlv)
if visibility == 1 then
def.overlay_tiles = {tileov, tileov, '', '', '', ''}
else
def.overlay_tiles = {tileov}
end
end
def.on_blast = terumet.blast_chance(blchance[rlv], id)
minetest.register_node(id, def)
local recbase
if rlv == 1 then
recbase = base
minetest.register_craft{ output=id..' 4', recipe = {
{rebar_id, recbase, rebar_id},
{recbase, '', recbase},
{rebar_id, recbase, rebar_id}
}}
elseif rlv == 2 then
recbase = reinf_block_id(code, 1)
minetest.register_craft{ output=id..' 4', recipe = {
{rebar_id, recbase, rebar_id},
{recbase, '', recbase},
{rebar_id, recbase, rebar_id}
}}
else
recbase = reinf_block_id(code, 2)
minetest.register_craft{ output=id..' 4', recipe = {
{rebar_id, recbase, rebar_id},
{recbase, '', recbase},
{rebar_id, recbase, rebar_id}
}}
end
end
end

View File

@@ -0,0 +1,35 @@
local id = terumet.id
local tex = terumet.tex
terumet.alloys = {}
function terumet.reg_alloy(name, alloy_id, block_level, repairmat_value)
local ingot_id = 'ingot_' .. alloy_id
local block_id = 'block_' .. alloy_id
minetest.register_craftitem( id(ingot_id), {
description = name .. ' Ingot',
inventory_image = tex(ingot_id),
groups = {ingot=1}
})
minetest.register_node( id(block_id), {
description = name .. ' Block',
tiles = {tex(block_id)},
is_ground_content = false,
groups = {cracky=1, level=block_level},
--sounds = default.node_sound_metal_defaults()
})
minetest.register_craft{ output = id(block_id),
recipe = terumet.recipe_3x3(id(ingot_id))
}
minetest.register_craft{ type = 'shapeless', output = id(ingot_id, 9),
recipe = {id(block_id)}
}
terumet.alloys[alloy_id] = {ingot=id(ingot_id), block=id(block_id)}
terumet.register_repair_material(id(ingot_id), repairmat_value)
end

View File

@@ -0,0 +1,38 @@
local tglass_id = terumet.id('block_tglass')
local tiles, glowtiles
if terumet.options.cosmetic.CLEAR_GLASS then
tiles = {terumet.tex('block_tglass_frame'), terumet.tex('blank')}
glowtiles = {terumet.tex('block_tglassglow_frame'), terumet.tex('blank')}
else
tiles = {terumet.tex('block_tglass_frame'), terumet.tex('block_tglass_streak')}
glowtiles = {terumet.tex('block_tglassglow_frame'), terumet.tex('block_tglassglow_streak')}
end
minetest.register_node(tglass_id, {
description = 'Terumetal Glass',
drawtype= 'glasslike_framed_optional',
paramtype = "light",
tiles = tiles,
is_ground_content = false,
sunlight_propagates = true,
groups = {cracky = 1, level = 2},
sounds = default.node_sound_glass_defaults(),
on_blast = terumet.blast_chance(30, tglass_id),
})
local tglass_glow_id = tglass_id..'glow'
minetest.register_node(tglass_glow_id, {
description = 'Terumetal Glow Glass',
drawtype= 'glasslike_framed_optional',
paramtype = "light",
tiles = glowtiles,
is_ground_content = false,
sunlight_propagates = true,
light_source=13,
groups = {cracky = 1, level = 2},
sounds = default.node_sound_glass_defaults(),
on_blast = terumet.blast_chance(15, tglass_glow_id),
})

View File

@@ -0,0 +1,97 @@
--[[
Adds food to the vacuum oven recipes:
* Upgrades food items - vacuum two food items to create a condensed and packaged version that restores 3 times as much health/stamina.
* Food items are items that are of the group "food_*" and have an on_use (presumably minetest.item_eat)
* To ensure all food items are seen, any mods that add foods must be added as a dependent mod to Terumet - by default only "farming" is
]]--
local options = terumet.options.vac_oven.VAC_FOOD
local FMT = string.format
local generated_vacfoods = {}
local function make_vacfood_image(img)
return FMT('[combine:32x32:0,0=%s:8,8=%s', terumet.tex('item_vacfood'), img)
end
local function make_vacfood(item_id)
local def = minetest.registered_items[item_id]
if generated_vacfoods[item_id] or (not def) then return end
local mod, item = item_id:match('^(%S+):(%S+)')
if mod and item then
local vf_id = terumet.id(FMT('vacf_%s_%s', mod, item))
local image
if def.inventory_image and def.inventory_image ~= '' then
image = make_vacfood_image(def.inventory_image)
elseif def.tiles and def.tiles[1] and def.tiles[1] ~= '' then
image = make_vacfood_image(def.tiles[1])
else
image = terumet.tex('item_vacfood')
end
local item_sound
if def.sound then
item_sound = table.copy(def.sound)
else
item_sound = {}
end
item_sound.eat = 'terumet_eat_vacfood'
minetest.register_craftitem(vf_id, {
description = 'Vacuum-packed ' .. def.description,
inventory_image = image,
sound=item_sound,
_terumet_vacfood = true,
on_use = def.on_use,
})
terumet.register_vacoven_recipe{
input=item_id..' 2',
results={vf_id},
time=4.0
}
generated_vacfoods[item_id]=vf_id
else
minetest.log('warning', FMT('terumet: valid item "%s" was selected for vacfood but mod or item-id did not parse properly', item_id))
end
end
if options.AUTO_GENERATE then
for id,def in pairs(minetest.registered_items) do
local blacklisted = false
if options.BLACKLIST then
blacklisted = options.BLACKLIST[id]
if not blacklisted then
blacklisted = terumet.match_group_key(options.BLACKLIST, def)
end
end
if not blacklisted then
local is_food = false
for group,_ in pairs(def.groups) do
if def.on_use and group:match('^food_') then
is_food = true
break
end
end
if is_food then make_vacfood(id) end
end
end
end
if options.WHITELIST then
for id,_ in pairs(options.WHITELIST) do
make_vacfood(id)
end
end
-- add a wrapper to core function of do_item_eat which triples hp_change value of items with _terumet_vacfood flag
-- there's no way to read what value individual food items are calling minetest.item_eat() with, so this is the next best way to multiply the value
local old_item_eat = core.do_item_eat
core.do_item_eat = function(hp_change, replace_with_item, itemstack, ...)
local def = itemstack:get_definition()
if def and def._terumet_vacfood then
return old_item_eat(hp_change * 3, replace_with_item, itemstack, ...)
else
return old_item_eat(hp_change, replace_with_item, itemstack, ...)
end
end