Finer gradations of radioactivity

Make the "radioactive" group value be the safe distance in millimeters
rather than meters, to allow for intermediate values.  Use such
intermediate values for the uranium blocks, using the existing formula
with this finer quantisation.  All other radioactive nodes retain their
existing radioactivity exactly.
This commit is contained in:
Zefram 2014-08-20 19:14:03 +01:00
parent 7d610b7c80
commit 7a9d2ffe5f
3 changed files with 16 additions and 16 deletions

View File

@ -197,15 +197,15 @@ for p = 0, 35 do
-- linear interpolation of activity along that scale, rooted at -- linear interpolation of activity along that scale, rooted at
-- a natural (0.7%-fissile) uranium block having the activity of -- a natural (0.7%-fissile) uranium block having the activity of
-- 9 uranium ore blocks (due to 9 ingots per block). The group -- 9 uranium ore blocks (due to 9 ingots per block). The group
-- value is proportional to the square root of the activity, -- value is proportional to the square root of the activity, and
-- and uranium ore has radioactive=1. This yields radioactive=2 -- uranium ore has radioactive=1000. This yields radioactive=2065
-- for a fully-depleted uranium block and radioactive=5 for a -- for a fully-depleted uranium block and radioactive=5286 for
-- 3.5%-fissile uranium block. -- a 3.5%-fissile uranium block.
(ov or minetest.register_node)(block, { (ov or minetest.register_node)(block, {
description = string.format(S("%.1f%%-Fissile Uranium Block"), p/10), description = string.format(S("%.1f%%-Fissile Uranium Block"), p/10),
tiles = {"technic_uranium_block.png"}, tiles = {"technic_uranium_block.png"},
is_ground_content = true, is_ground_content = true,
groups = {uranium_block=1, not_in_creative_inventory=nici, cracky=1, level=2, radioactive=math.floor(math.sqrt((1+5.55*p/35) * 9 / (1+5.55*7/35)) + 0.5)}, groups = {uranium_block=1, not_in_creative_inventory=nici, cracky=1, level=2, radioactive=math.floor(1000*math.sqrt((1+5.55*p/35) * 9 / (1+5.55*7/35)) + 0.5)},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}); });
if not ov then if not ov then

View File

@ -293,7 +293,7 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"}, "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
groups = {cracky=1, technic_machine=1, radioactive=7, not_in_creative_inventory=1}, groups = {cracky=1, technic_machine=1, radioactive=7000, not_in_creative_inventory=1},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop="technic:hv_nuclear_reactor_core", drop="technic:hv_nuclear_reactor_core",
@ -541,10 +541,10 @@ end
-- --
-- A radioactive node is identified by being in the "radioactive" group, -- A radioactive node is identified by being in the "radioactive" group,
-- and the group value signifies the strength of the radiation source. -- and the group value signifies the strength of the radiation source.
-- The group value is the distance in metres from a node at which an -- The group value is the distance in millimetres from a node at which
-- unshielded player will be damaged by 0.25 HP/s. Or, equivalently, it -- an unshielded player will be damaged by 0.25 HP/s. Or, equivalently,
-- is half the square root of the damage rate in HP/s that an unshielded -- it is 500 times the square root of the damage rate in HP/s that an
-- player 1 m away will take. -- unshielded player 1 m away will take.
-- --
-- Shielding is assessed by sampling every 0.25 m along the path -- Shielding is assessed by sampling every 0.25 m along the path
-- from the source to the player, ignoring the source node itself. -- from the source to the player, ignoring the source node itself.
@ -571,7 +571,7 @@ minetest.register_abm({
chance = 1, chance = 1,
action = function (pos, node) action = function (pos, node)
local strength = minetest.registered_nodes[node.name].groups.radioactive local strength = minetest.registered_nodes[node.name].groups.radioactive
for _, o in ipairs(minetest.get_objects_inside_radius(pos, strength + assumed_abdomen_offset_length)) do for _, o in ipairs(minetest.get_objects_inside_radius(pos, strength*0.001 + assumed_abdomen_offset_length)) do
if o:is_player() then if o:is_player() then
local rel = vector.subtract(vector.add(o:getpos(), assumed_abdomen_offset), pos) local rel = vector.subtract(vector.add(o:getpos(), assumed_abdomen_offset), pos)
local dist_sq = vector.length_square(rel) local dist_sq = vector.length_square(rel)
@ -586,7 +586,7 @@ minetest.register_abm({
resistance = resistance + node_radiation_resistance(minetest.get_node(intnodepos).name) resistance = resistance + node_radiation_resistance(minetest.get_node(intnodepos).name)
end end
end end
local dmg_rate = 0.25 * strength*strength * math.exp(-0.0025*resistance) / math.max(0.75, dist_sq) local dmg_rate = 0.25e-6 * strength*strength * math.exp(-0.0025*resistance) / math.max(0.75, dist_sq)
if dmg_rate >= 0.25 then if dmg_rate >= 0.25 then
local dmg_int = math.floor(dmg_rate) local dmg_int = math.floor(dmg_rate)
if math.random() < dmg_rate-dmg_int then if math.random() < dmg_rate-dmg_int then
@ -636,7 +636,7 @@ for _, state in ipairs({ "flowing", "source" }) do
liquid = 2, liquid = 2,
hot = 3, hot = 3,
igniter = 1, igniter = 1,
radioactive = (state == "source" and 32 or 16), radioactive = (state == "source" and 32000 or 16000),
not_in_creative_inventory = (state == "flowing" and 1 or nil), not_in_creative_inventory = (state == "flowing" and 1 or nil),
}, },
}) })
@ -656,7 +656,7 @@ minetest.register_node("technic:chernobylite_block", {
description = S("Chernobylite Block"), description = S("Chernobylite Block"),
tiles = { "technic_chernobylite_block.png" }, tiles = { "technic_chernobylite_block.png" },
is_ground_content = true, is_ground_content = true,
groups = { cracky=1, radioactive=5, level=2 }, groups = { cracky=1, radioactive=5000, level=2 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
light_source = 2, light_source = 2,

View File

@ -5,7 +5,7 @@ minetest.register_node( ":technic:mineral_uranium", {
description = S("Uranium Ore"), description = S("Uranium Ore"),
tiles = { "default_stone.png^technic_mineral_uranium.png" }, tiles = { "default_stone.png^technic_mineral_uranium.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3, radioactive=1}, groups = {cracky=3, radioactive=1000},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = 'craft "technic:uranium_lump" 1', drop = 'craft "technic:uranium_lump" 1',
}) })
@ -56,7 +56,7 @@ minetest.register_node(":technic:uranium_block", {
description = S("Uranium Block"), description = S("Uranium Block"),
tiles = { "technic_uranium_block.png" }, tiles = { "technic_uranium_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {uranium_block=1, cracky=1, level=2, radioactive=3}, groups = {uranium_block=1, cracky=1, level=2, radioactive=3000},
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })