Merge remote-tracking branch 'origin/master'

This commit is contained in:
Thomas Rudin 2018-07-26 15:59:02 +02:00
commit 1ca707923f
24 changed files with 294 additions and 201 deletions

View File

@ -164,7 +164,7 @@ minetest.register_craft({
recipe = {
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'},
{'moreores:tin_ingot', 'moreores:tin_ingot', 'moreores:tin_ingot'},
{'default:tin_ingot', 'default:tin_ingot', 'default:tin_ingot'},
}
})

View File

@ -11,9 +11,12 @@ switching station handles the network activity.
Helper functions
----------------
* `technic.EU_string(num)`
* Converts num to a human-readable string (see pretty_num)
and adds the `EU` unit
* Use this function when showing players energy values
* `technic.pretty_num(num)`
* Converts the number `num` to a human-readable string.
* Use this function when showing players power values.
* Converts the number `num` to a human-readable string with SI prefixes
* `technic.swap_node(pos, nodename)`
* Same as `mintest.swap_node` but it only changes the nodename.
* It uses `minetest.get_node` before swapping to ensure the new nodename

View File

@ -1,23 +1,56 @@
local digit_sep_esc
do
local sep = technic.config:get("digit_separator")
sep = tonumber(sep) and string.char(sep) or sep or " "
-- Escape for gsub
for magic in ("().%+-*?[^$"):gmatch(".") do
if sep == magic then
sep = "%"..sep
end
local constant_digit_count = technic.config:get("constant_digit_count")
-- converts a number to a readable string with SI prefix, e.g. 10000 → "10 k",
-- 15 → "15 ", 0.1501 → "150.1 m"
-- a non-breaking space (U+a0) instead of a usual one is put after number
-- The precision is 4 digits
local prefixes = {[-8] = "y", [-7] = "z", [-6] = "a", [-5] = "f", [-4] = "p",
[-3] = "n", [-2] = "µ", [-1] = "m", [0] = "", [1] = "k", [2] = "M",
[3] = "G", [4] = "T", [5] = "P", [6] = "E", [7] = "Z", [8] = "Y"}
function technic.pretty_num(num)
-- the small number added is due to floating point inaccuracy
local b = math.floor(math.log10(math.abs(num)) +0.000001)
local pref_i
if b ~= 0 then
-- b is decremented by 1 to avoid a single digit with many decimals,
-- e.g. instead of 1.021 MEU, 1021 kEU is shown
pref_i = math.floor((b - 1) / 3)
else
-- as special case, avoid showing e.g. 1100 mEU instead of 1.1 EU
pref_i = 0
end
digit_sep_esc = sep
if not prefixes[pref_i] then
-- This happens for 0, nan, inf, very big values, etc.
if num == 0 then
-- handle 0 explicilty to avoid showing "-0"
if not constant_digit_count then
return "0 "
end
-- gives 0.000
return string.format("%.3f ", 0)
end
return string.format("%.4g ", num)
end
num = num * 10 ^ (-3 * pref_i)
if constant_digit_count then
local comma_digits_cnt = 3 - (b - 3 * pref_i)
return string.format("%." .. comma_digits_cnt .. "f %s",
num, prefixes[pref_i])
end
return string.format("%.4g %s", num, prefixes[pref_i])
end
-- some unittests
assert(technic.pretty_num(-0) == "0 ")
assert(technic.pretty_num(0) == "0 ")
assert(technic.pretty_num(1234) == "1234 ")
assert(technic.pretty_num(123456789) == "123.5 M")
function technic.pretty_num(num)
local str, k = tostring(num), nil
repeat
str, k = str:gsub("^(-?%d+)(%d%d%d)", "%1"..digit_sep_esc.."%2")
until k == 0
return str
-- used to display power values
function technic.EU_string(num)
return technic.pretty_num(num) .. "EU"
end

View File

@ -48,7 +48,7 @@ local twosize_products = {
}
local cnc_formspec =
"invsize[9,11;]"..
"size[9,11;]"..
"label[1,0;"..S("Choose Milling Program:").."]"..
"image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]"..
"image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]"..

View File

@ -35,7 +35,8 @@ local run = function(pos, node)
local charge_to_give = math.floor((light + pos1.y) * 3)
charge_to_give = math.max(charge_to_give, 0)
charge_to_give = math.min(charge_to_give, 200)
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give)))
meta:set_string("infotext", S("@1 Active (@2)", machine_name,
technic.EU_string(charge_to_give)))
meta:set_int("LV_EU_supply", charge_to_give)
else
meta:set_string("infotext", S("%s Idle"):format(machine_name))
@ -54,7 +55,7 @@ minetest.register_node("technic:solar_panel", {
active = false,
drawtype = "nodebox",
paramtype = "light",
is_ground_content = true,
is_ground_content = true,
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},

View File

@ -19,7 +19,7 @@ minetest.register_craft({
local workshop_demand = {5000, 3500, 2000}
local workshop_formspec =
"invsize[8,9;]"..
"size[8,9;]"..
"list[current_name;src;3,1;1,1;]"..
"label[0,0;"..S("%s Tool Workshop"):format("MV").."]"..
"list[current_name;upgrade1;1,3;1,1;]"..

View File

@ -60,7 +60,8 @@ local run = function(pos, node)
elseif check == true then
local power = math.min(pos.y * 100, 5000)
meta:set_int("MV_EU_supply", power)
meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power)))
meta:set_string("infotext", S("@1 (@2)", machine_name,
technic.EU_string(power)))
end
-- check == nil: assume nothing has changed
end

View File

@ -99,7 +99,7 @@ local function make_on(mark, length)
if node.name == "technic:constructor_mk"..mark.."_off" then
technic.swap_node(pos, "technic:constructor_mk"..mark.."_on")
nodeupdate(pos)
minetest.check_for_falling(pos)
for i = 1, length do
place_pos = vector.add(place_pos, dir)
local place_node = minetest.get_node(place_pos)
@ -113,7 +113,7 @@ local function make_off(mark)
return function(pos, node)
if node.name == "technic:constructor_mk"..mark.."_on" then
technic.swap_node(pos,"technic:constructor_mk"..mark.."_off")
nodeupdate(pos)
minetest.check_for_falling(pos)
end
end
end

View File

@ -55,7 +55,7 @@ minetest.register_craft({
local function set_injector_formspec(meta)
local is_stack = meta:get_string("mode") == "whole stacks"
meta:set_string("formspec",
"invsize[8,9;]"..
"size[8,9;]"..
"item_image[0,0;1,1;technic:injector]"..
"label[1,0;"..S("Self-Contained Injector").."]"..
(is_stack and

View File

@ -55,7 +55,7 @@ minetest.register_abm({
local demand = sw_meta:get_int("demand")
meta:set_string("infotext",
S("Power Monitor. Supply: @1 Demand: @2",
technic.pretty_num(supply), technic.pretty_num(demand)))
technic.EU_string(supply), technic.EU_string(demand)))
else
meta:set_string("infotext",S("Power Monitor Has No Network"))
end

View File

@ -13,7 +13,7 @@ end
local recipes = {
{"technic:copper_dust 3", "technic:tin_dust", "technic:bronze_dust 4"},
{"default:copper_ingot 3", "moreores:tin_ingot", "default:bronze_ingot 4"},
{"default:copper_ingot 3", "default:tin_ingot", "default:bronze_ingot 4"},
{"technic:wrought_iron_dust", "technic:coal_dust", "technic:carbon_steel_dust", 3},
{"technic:wrought_iron_ingot", "technic:coal_dust", "technic:carbon_steel_ingot", 3},
{"technic:carbon_steel_dust", "technic:coal_dust", "technic:cast_iron_dust", 3},

View File

@ -18,7 +18,7 @@ minetest.register_craft({
output = "technic:battery",
recipe = {
{"group:wood", "default:copper_ingot", "group:wood"},
{"group:wood", "moreores:tin_ingot", "group:wood"},
{"group:wood", "default:tin_ingot", "group:wood"},
{"group:wood", "default:copper_ingot", "group:wood"},
}
})
@ -255,8 +255,9 @@ function technic.register_battery_box(data)
local charge_percent = math.floor(current_charge / max_charge * 100)
meta:set_string("formspec", formspec..add_on_off_buttons(meta, ltier, charge_percent))
local infotext = S("@1 Battery Box: @2/@3", tier,
technic.pretty_num(current_charge), technic.pretty_num(max_charge))
local infotext = S("@1 Battery Box: @2 / @3", tier,
technic.EU_string(current_charge),
technic.EU_string(max_charge))
if eu_input == 0 then
infotext = S("%s Idle"):format(infotext)
end

View File

@ -35,7 +35,7 @@ function technic.register_generator(data)
for k, v in pairs(groups) do active_groups[k] = v end
local generator_formspec =
"invsize[8,9;]"..
"size[8,9;]"..
"label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]"..
"list[current_name;src;3,1;1,1;]"..
"image[4,1;1,1;default_furnace_fire_bg.png]"..

View File

@ -15,6 +15,7 @@ local recipes = {
{"default:desert_stone", "default:desert_sand"},
{"default:gold_lump", "technic:gold_dust 2"},
{"default:iron_lump", "technic:wrought_iron_dust 2"},
{"default:tin_lump", "technic:tin_dust 2"},
{"technic:chromium_lump", "technic:chromium_dust 2"},
{"technic:uranium_lump", "technic:uranium_dust 2"},
{"technic:zinc_lump", "technic:zinc_dust 2"},
@ -43,7 +44,6 @@ 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"})
table.insert(recipes, {"moreores:tin_lump", "technic:tin_dust 2"})
end
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
@ -94,9 +94,9 @@ 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("Stone", "default:stone")
register_dust("Sulfur", nil)
register_dust("Tin", "moreores:tin_ingot")
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

View File

@ -44,7 +44,7 @@ function technic.register_base_machine(data)
for k, v in pairs(groups) do active_groups[k] = v end
local formspec =
"invsize[8,9;]"..
"size[8,9;]"..
"list[current_name;src;"..(4-input_size)..",1;"..input_size..",1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"..

View File

@ -30,14 +30,15 @@ function technic.register_solar_array(data)
local charge_to_give = math.floor((light + pos.y) * data.power)
charge_to_give = math.max(charge_to_give, 0)
charge_to_give = math.min(charge_to_give, data.power * 50)
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give)))
meta:set_string("infotext", S("@1 Active (@2)", machine_name,
technic.EU_string(charge_to_give)))
meta:set_int(tier.."_EU_supply", charge_to_give)
else
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int(tier.."_EU_supply", 0)
end
end
minetest.register_node("technic:solar_array_"..ltier, {
tiles = {"technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png",
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png",

View File

@ -149,7 +149,9 @@ local run = function(pos, node, run_stage)
meta:set_int(from.."_EU_supply", 0)
meta:set_int(to.."_EU_demand", 0)
meta:set_int(to.."_EU_supply", input * remain)
meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name, technic.pretty_num(input), from, technic.pretty_num(input * remain), to))
meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name,
technic.EU_string(input), from,
technic.EU_string(input * remain), to))
else
meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name))
if to then

View File

@ -361,9 +361,9 @@ minetest.register_abm({
end
--dprint("Total BA demand:"..BA_eu_demand)
meta:set_string("infotext",
S("@1. Supply: @2 Demand: @3",
machine_name, technic.pretty_num(PR_eu_supply), technic.pretty_num(RE_eu_demand)))
meta:set_string("infotext", S("@1. Supply: @2 Demand: @3",
machine_name, technic.EU_string(PR_eu_supply),
technic.EU_string(RE_eu_demand)))
-- If mesecon signal and power supply or demand changed then
-- send them via digilines.

View File

@ -54,6 +54,7 @@ local rad_resistance_node = {
["default:lava_source"] = 17,
["default:mese"] = 21,
["default:mossycobble"] = 15,
["default:tinblock"] = 37,
["pbj_pup:pbj_pup"] = 10000,
["pbj_pup:pbj_pup_candies"] = 10000,
["gloopblocks:rainbow_block_diagonal"] = 5000,
@ -76,6 +77,7 @@ local rad_resistance_node = {
["default:stone_with_gold"] = 34,
["default:stone_with_iron"] = 20,
["default:stone_with_mese"] = 17,
["default:stone_with_tin"] = 19,
["default:stonebrick"] = 17,
["default:water_flowing"] = 2.8,
["default:water_source"] = 5.6,
@ -141,10 +143,8 @@ local rad_resistance_node = {
["moreblocks:wood_tile_up"] = 1.7,
["moreores:mineral_mithril"] = 18,
["moreores:mineral_silver"] = 21,
["moreores:mineral_tin"] = 19,
["moreores:mithril_block"] = 26,
["moreores:silver_block"] = 53,
["moreores:tin_block"] = 37,
["snow:snow_brick"] = 2.8,
["technic:brass_block"] = 43,
["technic:carbon_steel_block"] = 40,

View File

@ -6,7 +6,7 @@ local S = technic.getter
minetest.register_craft({
output = 'technic:mining_drill',
recipe = {
{'moreores:tin_ingot', 'technic:diamond_drill_head', 'moreores:tin_ingot'},
{'default:tin_ingot', 'technic:diamond_drill_head', 'default:tin_ingot'},
{'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'},
{'', 'technic:red_energy_crystal', 'default:copper_ingot'},
}

View File

@ -4,43 +4,43 @@ local mining_lasers_list = {
{"2", 14, 200000, 2000},
{"3", 21, 650000, 3000},
}
local allow_entire_discharging = true
local S = technic.getter
minetest.register_craft({
output = 'technic:laser_mk1',
output = "technic:laser_mk1",
recipe = {
{'default:diamond', 'technic:brass_ingot', 'default:obsidian_glass'},
{'', 'technic:brass_ingot', 'technic:red_energy_crystal'},
{'', '', 'default:copper_ingot'},
{"default:diamond", "technic:brass_ingot", "default:obsidian_glass"},
{"", "technic:brass_ingot", "technic:red_energy_crystal"},
{"", "", "default:copper_ingot"},
}
})
minetest.register_craft({
output = 'technic:laser_mk2',
output = "technic:laser_mk2",
recipe = {
{'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk1'},
{'', 'technic:carbon_steel_ingot', 'technic:green_energy_crystal'},
{'', '', 'default:copper_ingot'},
{"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk1"},
{"", "technic:carbon_steel_ingot", "technic:green_energy_crystal"},
{"", "", "default:copper_ingot"},
}
})
minetest.register_craft({
output = 'technic:laser_mk3',
output = "technic:laser_mk3",
recipe = {
{'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk2'},
{'', 'technic:carbon_steel_ingot', 'technic:blue_energy_crystal'},
{'', '', 'default:copper_ingot'},
{"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk2"},
{"", "technic:carbon_steel_ingot", "technic:blue_energy_crystal"},
{"", "", "default:copper_ingot"},
}
})
local function laser_node(pos, node, player)
local def = minetest.registered_nodes[node.name]
if def and def.liquidtype ~= "none" then
if def.liquidtype ~= "none" and def.buildable_to then
minetest.remove_node(pos)
minetest.add_particle({
pos = pos,
velocity = {x=0, y=2, z=0},
acceleration = {x=0, y=-1, z=0},
expirationtime = 1.5,
velocity = {x = 0, y = 1.5 + math.random(), z = 0},
acceleration = {x = 0, y = -1, z = 0},
size = 6 + math.random() * 2,
texture = "smoke_puff.png^[transform" .. math.random(0, 7),
})
@ -49,11 +49,15 @@ local function laser_node(pos, node, player)
minetest.node_dig(pos, node, player)
end
local no_destroy = {
["air"] = true,
["default:lava_source"] = true,
["default:lava_flowing"] = true,
}
local keep_node = {air = true}
local function can_keep_node(name)
if keep_node[name] ~= nil then
return keep_node[name]
end
keep_node[name] = minetest.get_item_group(name, "hot") ~= 0
return keep_node[name]
end
local function laser_shoot(player, range, particle_texture, sound)
local player_pos = player:getpos()
local player_name = player:get_player_name()
@ -61,12 +65,12 @@ local function laser_shoot(player, range, particle_texture, sound)
local start_pos = vector.new(player_pos)
-- Adjust to head height
start_pos.y = start_pos.y + 1.6
start_pos.y = start_pos.y + (player:get_properties().eye_height or 1.625)
minetest.add_particle({
pos = startpos,
pos = start_pos,
velocity = dir,
acceleration = vector.multiply(dir, 50),
expirationtime = range / 11,
expirationtime = (math.sqrt(1 + 100 * (range + 0.4)) - 1) / 50,
size = 1,
texture = particle_texture .. "^[transform" .. math.random(0, 7),
})
@ -76,42 +80,48 @@ local function laser_shoot(player, range, particle_texture, sound)
minetest.record_protection_violation(pos, player_name)
break
end
local node = minetest.get_node_or_nil(pos)
if not node then
local node = minetest.get_node(pos)
if node.name == "ignore"
or not minetest.registered_nodes[node.name] then
break
end
if not no_destroy[node.name] then
if not can_keep_node(node.name) then
laser_node(pos, node, player)
end
end
end
for _, m in pairs(mining_lasers_list) do
technic.register_power_tool("technic:laser_mk"..m[1], m[3])
minetest.register_tool("technic:laser_mk"..m[1], {
description = S("Mining Laser Mk%d"):format(m[1]),
inventory_image = "technic_mining_laser_mk"..m[1]..".png",
range = 0,
stack_max = 1,
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user)
local meta = minetest.deserialize(itemstack:get_metadata())
if not meta or not meta.charge then
if not meta or not meta.charge or meta.charge == 0 then
return
end
-- If there's enough charge left, fire the laser
if meta.charge >= m[4] then
laser_shoot(user, m[2], "technic_laser_beam_mk"..m[1]..".png", "technic_laser_mk"..m[1])
if not technic.creative_mode then
meta.charge = meta.charge - m[4]
technic.set_RE_wear(itemstack, meta.charge, m[3])
itemstack:set_metadata(minetest.serialize(meta))
local range = m[2]
if meta.charge < m[4] then
if not allow_entire_discharging then
return
end
-- If charge is too low, give the laser a shorter range
range = range * meta.charge / m[4]
end
laser_shoot(user, range, "technic_laser_beam_mk" .. m[1] .. ".png",
"technic_laser_mk" .. m[1])
if not technic.creative_mode then
meta.charge = math.max(meta.charge - m[4], 0)
technic.set_RE_wear(itemstack, meta.charge, m[3])
itemstack:set_metadata(minetest.serialize(meta))
end
return itemstack
end,
})
end

View File

@ -15,3 +15,11 @@ dofile(modpath.."/silver_chest.lua")
dofile(modpath.."/gold_chest.lua")
dofile(modpath.."/mithril_chest.lua")
minetest.register_lbm({
name = "technic_chests:fix_wooden_chests",
nodenames = {"default:chest"},
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "")
end
})

View File

@ -1,132 +1,157 @@
local uranium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 420, octaves = 3, persist = 0.7}
local uranium_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
seed = 420,
octaves = 3,
persist = 0.7
}
local uranium_threshold = 0.55
local chromium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 421, octaves = 3, persist = 0.7}
local chromium_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
seed = 421,
octaves = 3,
persist = 0.7
}
local chromium_threshold = 0.55
local zinc_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 422, octaves = 3, persist = 0.7}
local zinc_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
seed = 422,
octaves = 3,
persist = 0.7
}
local zinc_threshold = 0.5
local lead_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 423, octaves = 3, persist = 0.7}
local lead_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
seed = 423,
octaves = 3,
persist = 0.7
}
local lead_threshold = 0.3
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_uranium",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 4,
clust_size = 3,
y_min = -300,
y_max = -80,
noise_params = uranium_params,
ore_type = "scatter",
ore = "technic:mineral_uranium",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 4,
clust_size = 3,
y_min = -300,
y_max = -80,
noise_params = uranium_params,
noise_threshold = uranium_threshold,
})
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_chromium",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 2,
clust_size = 3,
y_min = -200,
y_max = -100,
noise_params = chromium_params,
ore_type = "scatter",
ore = "technic:mineral_chromium",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 2,
clust_size = 3,
y_min = -200,
y_max = -100,
noise_params = chromium_params,
noise_threshold = chromium_threshold,
})
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_chromium",
wherein = "default:stone",
clust_scarcity = 6*6*6,
clust_num_ores = 2,
clust_size = 3,
y_min = -31000,
y_max = -200,
flags = "absheight",
noise_params = chromium_params,
ore_type = "scatter",
ore = "technic:mineral_chromium",
wherein = "default:stone",
clust_scarcity = 6*6*6,
clust_num_ores = 2,
clust_size = 3,
y_min = -31000,
y_max = -200,
flags = "absheight",
noise_params = chromium_params,
noise_threshold = chromium_threshold,
})
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_zinc",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 5,
clust_size = 7,
y_min = -32,
y_max = 2,
noise_params = zinc_params,
ore_type = "scatter",
ore = "technic:mineral_zinc",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 5,
clust_size = 7,
y_min = -32,
y_max = 2,
noise_params = zinc_params,
noise_threshold = zinc_threshold,
})
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_zinc",
wherein = "default:stone",
clust_scarcity = 6*6*6,
clust_num_ores = 4,
clust_size = 3,
y_min = -31000,
y_max = -32,
flags = "absheight",
noise_params = zinc_params,
ore_type = "scatter",
ore = "technic:mineral_zinc",
wherein = "default:stone",
clust_scarcity = 6*6*6,
clust_num_ores = 4,
clust_size = 3,
y_min = -31000,
y_max = -32,
flags = "absheight",
noise_params = zinc_params,
noise_threshold = zinc_threshold,
})
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_lead",
wherein = "default:stone",
clust_scarcity = 9*9*9,
clust_num_ores = 5,
clust_size = 3,
y_min = -16,
y_max = 16,
noise_params = lead_params,
ore_type = "scatter",
ore = "technic:mineral_lead",
wherein = "default:stone",
clust_scarcity = 9*9*9,
clust_num_ores = 5,
clust_size = 3,
y_min = -16,
y_max = 16,
noise_params = lead_params,
noise_threshold = lead_threshold,
})
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_lead",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 5,
clust_size = 3,
y_min = -128,
y_max = -16,
noise_params = lead_params,
ore_type = "scatter",
ore = "technic:mineral_lead",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 5,
clust_size = 3,
y_min = -128,
y_max = -16,
noise_params = lead_params,
noise_threshold = lead_threshold,
})
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_lead",
wherein = "default:stone",
clust_scarcity = 6*6*6,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -128,
flags = "absheight",
noise_params = lead_params,
ore_type = "scatter",
ore = "technic:mineral_lead",
wherein = "default:stone",
clust_scarcity = 6*6*6,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -128,
flags = "absheight",
noise_params = lead_params,
noise_threshold = lead_threshold,
})
-- Sulfur
local sulfur_buf = {}
local sulfur_noise= nil
local sulfur_noise
minetest.register_on_generated(function(minp, maxp, seed)
minetest.register_on_generated(function(minp, maxp)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local a = VoxelArea:new{
MinEdge = {x = emin.x, y = emin.y, z = emin.z},
MaxEdge = {x = emax.x, y = emax.y, z = emax.z},
}
local a = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
local data = vm:get_data(sulfur_buf)
local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z)
sulfur_noise = sulfur_noise or minetest.get_perlin(9876, 3, 0.5, 100)
@ -141,17 +166,20 @@ minetest.register_on_generated(function(minp, maxp, seed)
for y = minp.y + math.floor(grid_size / 2), maxp.y, grid_size do
for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do
local c = data[a:index(x, y, z)]
if (c == c_lava or c == c_lava_flowing) and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then
for xx = math.max(minp.x, x - grid_size), math.min(maxp.x, x + grid_size) do
for yy = math.max(minp.y, y - grid_size), math.min(maxp.y, y + grid_size) do
for zz = math.max(minp.z, z - grid_size), math.min(maxp.z, z + grid_size) do
local i = a:index(xx, yy, zz)
if (c == c_lava or c == c_lava_flowing)
and sulfur_noise:get_3d({x = x, y = z, z = z}) >= 0.4 then
for i in a:iter(
math.max(minp.x, x - grid_size),
math.max(minp.y, y - grid_size),
math.max(minp.z, z - grid_size),
math.min(maxp.x, x + grid_size),
math.min(maxp.y, y + grid_size),
math.min(maxp.z, z + grid_size)
) do
if data[i] == c_stone and pr:next(1, 10) <= 7 then
data[i] = c_sulfur
end
end
end
end
end
end
end
@ -163,32 +191,37 @@ end)
if technic.config:get_bool("enable_marble_generation") then
minetest.register_ore({
ore_type = "sheet",
ore = "technic:marble",
wherein = "default:stone",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 3,
y_min = -31000,
y_max = -50,
noise_threshold = 0.4,
noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70}
})
minetest.register_ore({
ore_type = "sheet",
ore = "technic:marble",
wherein = "default:stone",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 3,
y_min = -31000,
y_max = -50,
noise_threshold = 0.4,
noise_params = {
offset = 0, scale = 15, spread = {x = 150, y = 150, z = 150},
seed = 23, octaves = 3, persist = 0.70
}
})
end
if technic.config:get_bool("enable_granite_generation") then
minetest.register_ore({
ore_type = "sheet",
ore = "technic:granite",
wherein = "default:stone",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 4,
y_min = -31000,
y_max = -150,
noise_threshold = 0.4,
noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70}
})
minetest.register_ore({
ore_type = "sheet",
ore = "technic:granite",
wherein = "default:stone",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 4,
y_min = -31000,
y_max = -150,
noise_threshold = 0.4,
noise_params = {
offset = 0, scale = 15, spread = {x = 130, y = 130, z = 130},
seed = 24, octaves = 3, persist = 0.70
}
})
end

View File

@ -120,7 +120,7 @@ minetest.register_tool("wrench:wrench", {
return
end
local meta = minetest.get_meta(pos)
if def.owned then
if def.owned and not minetest.check_player_privs(placer, "protection_bypass") then
local owner = meta:get_string("owner")
if owner and owner ~= player_name then
minetest.log("action", player_name..