From 7a9d2ffe5f93354681be85a60d1f28a9273f0e0d Mon Sep 17 00:00:00 2001 From: Zefram Date: Wed, 20 Aug 2014 19:14:03 +0100 Subject: [PATCH] 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. --- technic/items.lua | 10 +++++----- technic/machines/HV/nuclear_reactor.lua | 18 +++++++++--------- technic_worldgen/nodes.lua | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/technic/items.lua b/technic/items.lua index 3c00dd9..82da1d2 100644 --- a/technic/items.lua +++ b/technic/items.lua @@ -197,15 +197,15 @@ for p = 0, 35 do -- linear interpolation of activity along that scale, rooted at -- a natural (0.7%-fissile) uranium block having the activity of -- 9 uranium ore blocks (due to 9 ingots per block). The group - -- value is proportional to the square root of the activity, - -- and uranium ore has radioactive=1. This yields radioactive=2 - -- for a fully-depleted uranium block and radioactive=5 for a - -- 3.5%-fissile uranium block. + -- value is proportional to the square root of the activity, and + -- uranium ore has radioactive=1000. This yields radioactive=2065 + -- for a fully-depleted uranium block and radioactive=5286 for + -- a 3.5%-fissile uranium block. (ov or minetest.register_node)(block, { description = string.format(S("%.1f%%-Fissile Uranium Block"), p/10), tiles = {"technic_uranium_block.png"}, 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(), }); if not ov then diff --git a/technic/machines/HV/nuclear_reactor.lua b/technic/machines/HV/nuclear_reactor.lua index b57faa7..19a3c99 100644 --- a/technic/machines/HV/nuclear_reactor.lua +++ b/technic/machines/HV/nuclear_reactor.lua @@ -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", "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, sounds = default.node_sound_wood_defaults(), drop="technic:hv_nuclear_reactor_core", @@ -541,10 +541,10 @@ end -- -- A radioactive node is identified by being in the "radioactive" group, -- 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 --- unshielded player will be damaged by 0.25 HP/s. Or, equivalently, it --- is half the square root of the damage rate in HP/s that an unshielded --- player 1 m away will take. +-- The group value is the distance in millimetres from a node at which +-- an unshielded player will be damaged by 0.25 HP/s. Or, equivalently, +-- it is 500 times the square root of the damage rate in HP/s that an +-- unshielded player 1 m away will take. -- -- Shielding is assessed by sampling every 0.25 m along the path -- from the source to the player, ignoring the source node itself. @@ -571,7 +571,7 @@ minetest.register_abm({ chance = 1, action = function (pos, node) 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 local rel = vector.subtract(vector.add(o:getpos(), assumed_abdomen_offset), pos) local dist_sq = vector.length_square(rel) @@ -586,7 +586,7 @@ minetest.register_abm({ resistance = resistance + node_radiation_resistance(minetest.get_node(intnodepos).name) 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 local dmg_int = math.floor(dmg_rate) if math.random() < dmg_rate-dmg_int then @@ -636,7 +636,7 @@ for _, state in ipairs({ "flowing", "source" }) do liquid = 2, hot = 3, 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), }, }) @@ -656,7 +656,7 @@ minetest.register_node("technic:chernobylite_block", { description = S("Chernobylite Block"), tiles = { "technic_chernobylite_block.png" }, is_ground_content = true, - groups = { cracky=1, radioactive=5, level=2 }, + groups = { cracky=1, radioactive=5000, level=2 }, sounds = default.node_sound_stone_defaults(), light_source = 2, diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua index e4774ce..c50385a 100644 --- a/technic_worldgen/nodes.lua +++ b/technic_worldgen/nodes.lua @@ -5,7 +5,7 @@ minetest.register_node( ":technic:mineral_uranium", { description = S("Uranium Ore"), tiles = { "default_stone.png^technic_mineral_uranium.png" }, is_ground_content = true, - groups = {cracky=3, radioactive=1}, + groups = {cracky=3, radioactive=1000}, sounds = default.node_sound_stone_defaults(), drop = 'craft "technic:uranium_lump" 1', }) @@ -56,7 +56,7 @@ minetest.register_node(":technic:uranium_block", { description = S("Uranium Block"), tiles = { "technic_uranium_block.png" }, 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() })