summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--origin0
-rw-r--r--technic/README.md8
-rw-r--r--technic/config.lua3
-rw-r--r--technic/crafts.lua11
-rw-r--r--technic/init.lua3
-rw-r--r--technic/items.lua9
-rw-r--r--technic/locale/it.txt48
-rw-r--r--technic/machines/HV/nuclear_reactor.lua468
-rw-r--r--technic/machines/HV/quarry.lua13
-rw-r--r--technic/machines/LV/water_mill.lua16
-rw-r--r--technic/machines/register/cables.lua17
-rw-r--r--technic/machines/register/centrifuge_recipes.lua3
-rw-r--r--technic/machines/register/grinder_recipes.lua6
-rw-r--r--technic/machines/supply_converter.lua61
-rw-r--r--technic/machines/switching_station.lua26
-rw-r--r--technic/radiation.lua483
-rw-r--r--technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.oggbin13059 -> 36524 bytes
-rw-r--r--technic/textures/technic_stone_dust.pngbin0 -> 417 bytes
-rw-r--r--technic/textures/technicx32/technic_stone_dust.pngbin0 -> 1284 bytes
-rw-r--r--technic/tools/mining_drill.lua16
-rw-r--r--technic_chests/common.lua28
-rw-r--r--technic_worldgen/nodes.lua4
-rw-r--r--technic_worldgen/oregen.lua10
23 files changed, 741 insertions, 492 deletions
diff --git a/origin b/origin
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/origin
diff --git a/technic/README.md b/technic/README.md
index b6aa05f..e5adf31 100644
--- a/technic/README.md
+++ b/technic/README.md
@@ -25,3 +25,11 @@ RealBadAngel: (WTFPL)
* Everything else.
CC BY-SA 3.0: <http://creativecommons.org/licenses/by-sa/3.0/>
+
+Sound licenses:
+
+veikk0 (Veikko Mäkelä) (CC BY-SA 4.0):
+ * technic_hv_nuclear_reactor_siren_danger_loop.ogg
+ * Derived from "Nuclear alarm.wav" by Freesound.org user rene___ from <https://freesound.org/people/rene___/sounds/56778/>. Originally licensed under CC0 1.0 <https://creativecommons.org/publicdomain/zero/1.0/>
+
+CC BY-SA 4.0: <https://creativecommons.org/licenses/by-sa/4.0/> \ No newline at end of file
diff --git a/technic/config.lua b/technic/config.lua
index 81a2224..29321f9 100644
--- a/technic/config.lua
+++ b/technic/config.lua
@@ -9,6 +9,9 @@ local defaults = {
enable_wind_mill = "false",
enable_frames = "false",
enable_corium_griefing = "true",
+ enable_radiation_protection = "true",
+ enable_entity_radiation_damage = "true",
+ enable_longterm_radiation_damage = "true",
}
for k, v in pairs(defaults) do
diff --git a/technic/crafts.lua b/technic/crafts.lua
index 8a8cd37..4859768 100644
--- a/technic/crafts.lua
+++ b/technic/crafts.lua
@@ -191,3 +191,14 @@ minetest.register_craft({
},
})
+minetest.register_craft({
+ output = "default:dirt 2",
+ type = "shapeless",
+ replacements = {{"bucket:bucket_water","bucket:bucket_empty"}},
+ recipe = {
+ "technic:stone_dust",
+ "group:leaves",
+ "bucket:bucket_water",
+ "group:sand",
+ },
+})
diff --git a/technic/init.lua b/technic/init.lua
index 70ad848..4464082 100644
--- a/technic/init.lua
+++ b/technic/init.lua
@@ -35,6 +35,9 @@ dofile(modpath.."/crafts.lua")
-- Register functions
dofile(modpath.."/register.lua")
+-- Radiation
+dofile(modpath.."/radiation.lua")
+
-- Machines
dofile(modpath.."/machines/init.lua")
diff --git a/technic/items.lua b/technic/items.lua
index 27e05e4..a0edb96 100644
--- a/technic/items.lua
+++ b/technic/items.lua
@@ -194,14 +194,16 @@ for p = 0, 35 do
-- 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=1000. This yields radioactive=2065
- -- for a fully-depleted uranium block and radioactive=5286 for
+ -- uranium ore has radioactive=1. This yields radioactive=1.0
+ -- for a fully-depleted uranium block and radioactive=2.6 for
-- a 3.5%-fissile uranium block.
+ local radioactivity = math.floor(math.sqrt((1+5.55*p/35) * 18 / (1+5.55*7/35)) + 0.5);
(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(1000*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=radioactivity},
sounds = default.node_sound_stone_defaults(),
});
if not ov then
@@ -219,3 +221,4 @@ for p = 0, 35 do
})
end
end
+
diff --git a/technic/locale/it.txt b/technic/locale/it.txt
index 59ba7f6..a092a53 100644
--- a/technic/locale/it.txt
+++ b/technic/locale/it.txt
@@ -26,8 +26,8 @@ Graphite = Lastra in graffite
Carbon Cloth = Fibra di carbonio
Raw Latex = Latex grezzo
Rubber Fiber = Fibra di gomma
-%.1f%%-Fissile Uranium Ingot =
-%.1f%%-Fissile Uranium Block =
+%.1f%%-Fissile Uranium Ingot = %.1f%%-Lingotto di uranio fissile
+%.1f%%-Fissile Uranium Block = %.1f%%-Blocco di uranio fissile
## Machine misc
Machine cannot be removed because it is not empty = La macchina non può essere rimossa perchè non è vuota
@@ -36,7 +36,7 @@ Inventory move disallowed due to protection = Impossibile muovere l'inventario a
@1 Active (@2 EU) = @1 Attivo (@2 EU)
%s Active = %s Attivo
%s Disabled = %s Disabilitato
-%s Enabled =
+%s Enabled = %s Abilitato
%s Idle = %s Inattivo
%s Improperly Placed = %s Piazzato impropiamente
%s Unpowered = %s Non alimentato
@@ -46,18 +46,18 @@ Inventory move disallowed due to protection = Impossibile muovere l'inventario a
%s Finished = %s Finito
Enable/Disable = Abilita/Disabilita
Range = Raggio
-Upgrade Slots =
+Upgrade Slots = Alloggi di aggiornamento
In: = Ingresso:
Out: = Uscita:
-Slot %d =
+Slot %d = Alloggio %d
Itemwise = Singolo elemento
Stackwise = pila completa
-Owner: =
-Unlocked =
-Locked =
-Radius: =
-Enabled =
-Disabled =
+Owner: = Proprietario:
+Unlocked = Non chiuso a chiave
+Locked = Chiuso a chiave
+Radius: = Raggio:
+Enabled = Abilitato
+Disabled = Disabilitato
## Machine names
# $1: Tier
@@ -84,10 +84,10 @@ Self-Contained Injector = Ignettore
Constructor Mk%d = Costruttore Mk%d
Frame = Cornice
Frame Motor = Cornice del motore
-Template =
-Template (replacing) = Template (rimpiazzato)
-Template Motor =
-Template Tool =
+Template = Sagoma
+Template (replacing) = Sagoma (di rimpiazzo)
+Template Motor = Motore per sagome
+Template Tool = Strumento per sagome
Battery Box = Box batterie
Supply Converter = Trasformatore
Switching Station = Stazione di controllo
@@ -96,7 +96,7 @@ Fuel-Fired Furnace = Fornace a carbone
Wind Mill Frame = Pala eolica
Forcefield = Campo di forza
Nuclear Reactor Rod Compartment = Compartimento combustibile nucleare
-Administrative World Anchor =
+Administrative World Anchor = Ancora-mondo amministrativa
## Machine-specific
# $1: Pruduced EU
@@ -111,12 +111,12 @@ Production at %d%% = Produzione a %d%%
Choose Milling Program: = Scegliere un programma di Fresatura
Slim Elements half / normal height: = Metà elementi sottili / altezza normale:
Current track %s = Traccia corrente %s
-Stopped =
-Keeping %d/%d map blocks loaded =
-Digging not started =
-Digging finished =
-Digging %d m above machine =
-Digging %d m below machine =
+Stopped = Fermato
+Keeping %d/%d map blocks loaded = Mantenimento di %d/%d blocchi mappa caricati
+Digging not started = Scavo non iniziato
+Digging finished = Scavo finito
+Digging %d m above machine = Scavo di %d m sopra la macchina
+Digging %d m below machine = Scavo di %d m sotto la macchina
## CNC
Cylinder = Cilindro
@@ -174,10 +174,10 @@ Talinite = Talinite
Tin = Stagno
Wrought Iron = Ferro Battuto
Zinc = Zinco
-%.1f%%-Fissile Uranium =
+%.1f%%-Fissile Uranium = %.1f%%-Uranio fissile
## Tools
-RE Battery =
+RE Battery = Batteria RE
Water Can = Serbatoio d'acqua
Lava Can = Serbatoio di lava
Chainsaw = Motosega
diff --git a/technic/machines/HV/nuclear_reactor.lua b/technic/machines/HV/nuclear_reactor.lua
index c7951ab..16bb928 100644
--- a/technic/machines/HV/nuclear_reactor.lua
+++ b/technic/machines/HV/nuclear_reactor.lua
@@ -110,18 +110,17 @@ section through the middle:
CCCC CCCC
CBBB BBBC
- CBSS SSBC
- CBSWWWSBC
- CBSW#WSBC
- CBSW|WSBC
- CBSS|SSBC
+ CBLL LLBC
+ CBLWWWLBC
+ CBLW#WLBC
+ CBLW|WLBC
+ CBLL|LLBC
CBBB|BBBC
CCCC|CCCC
- C = Concrete, B = Blast-resistant concrete, S = Stainless Steel,
+ C = Concrete, B = Blast-resistant concrete, L = Lead,
W = water node, # = reactor core, | = HV cable
-The man-hole and the HV cable are only in the middle, and the man-hole
-is optional.
+The man-hole is optional (but necessary for refueling).
For the reactor to operate and not melt down, it insists on the inner
7x7x7 portion (from the core out to the blast-resistant concrete)
@@ -139,6 +138,9 @@ be mandatory, and for historical reasons (that it predates the
implementation of radiation) it needs to continue being adequate
shielding of legacy reactors. If it ever ceases to be adequate
shielding for new reactors, legacy ones should be grandfathered.
+
+For legacy reasons, if the reactor has a stainless steel layer instead
+of a lead layer it will be converted to a lead layer.
--]]
local function reactor_structure_badness(pos)
local vm = VoxelManip()
@@ -149,11 +151,12 @@ local function reactor_structure_badness(pos)
local area = VoxelArea:new({MinEdge=MinEdge, MaxEdge=MaxEdge})
local c_blast_concrete = minetest.get_content_id("technic:blast_resistant_concrete")
- local c_stainless_steel = minetest.get_content_id("technic:stainless_steel_block")
+ local c_lead = minetest.get_content_id("technic:lead_block")
+ local c_steel = minetest.get_content_id("technic:stainless_steel_block")
local c_water_source = minetest.get_content_id("default:water_source")
local c_water_flowing = minetest.get_content_id("default:water_flowing")
- local blastlayer, steellayer, waterlayer = 0, 0, 0
+ local blast_layer, steel_layer, lead_layer, water_layer = 0, 0, 0, 0
for z = pos1.z, pos2.z do
for y = pos1.y, pos2.y do
@@ -163,28 +166,51 @@ local function reactor_structure_badness(pos)
y == pos1.y or y == pos2.y or
z == pos1.z or z == pos2.z then
if cid == c_blast_concrete then
- blastlayer = blastlayer + 1
+ 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
- if cid == c_stainless_steel then
- steellayer = steellayer + 1
+ y == pos1.y+1 or y == pos2.y-1 or
+ z == pos1.z+1 or z == pos2.z-1 then
+ if cid == c_lead then
+ lead_layer = lead_layer + 1
+ elseif cid == c_steel then
+ steel_layer = steel_layer + 1
end
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
+ y == pos1.y+2 or y == pos2.y-2 or
+ z == pos1.z+2 or z == pos2.z-2 then
if cid == c_water_source or cid == c_water_flowing then
- waterlayer = waterlayer + 1
+ water_layer = water_layer + 1
end
end
end
end
end
- if waterlayer > 25 then waterlayer = 25 end
- if steellayer > 96 then steellayer = 96 end
- if blastlayer > 216 then blastlayer = 216 end
- return (25 - waterlayer) + (96 - steellayer) + (216 - blastlayer)
+
+ if steel_layer >= 96 then
+ 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
+ local vi = area:index(x, y, z)
+ if 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
+ if data[vi] == c_steel then
+ data[vi] = c_lead
+ end
+ end
+ end
+ end
+ end
+ vm:set_data(data)
+ vm:write_to_map()
+ lead_layer = steel_layer
+ end
+
+ 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
+ return (25 - water_layer) + (96 - lead_layer) + (216 - blast_layer)
end
@@ -292,7 +318,7 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
minetest.register_node("technic:hv_nuclear_reactor_core_active", {
tiles = {"technic_hv_nuclear_reactor_core.png"},
groups = {cracky=1, technic_machine=1, technic_hv=1,
- radioactive=11000, not_in_creative_inventory=1},
+ radioactive=4, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
drop = "technic:hv_nuclear_reactor_core",
@@ -339,399 +365,3 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
technic.register_machine("HV", "technic:hv_nuclear_reactor_core", technic.producer)
technic.register_machine("HV", "technic:hv_nuclear_reactor_core_active", technic.producer)
---[[
-Radioactivity
-
-Radiation resistance represents the extent to which a material
-attenuates radiation passing through it; i.e., how good a radiation
-shield it is. This is identified per node type. For materials that
-exist in real life, the radiation resistance value that this system
-uses for a node type consisting of a solid cube of that material is the
-(approximate) number of halvings of ionising radiation that is achieved
-by a meter of the material in real life. This is approximately
-proportional to density, which provides a good way to estimate it.
-Homogeneous mixtures of materials have radiation resistance computed
-by a simple weighted mean. Note that the amount of attenuation that
-a material achieves in-game is not required to be (and is not) the
-same as the attenuation achieved in real life.
-
-Radiation resistance for a node type may be specified in the node
-definition, under the key "radiation_resistance". As an interim
-measure, until node definitions widely include this, this code
-knows a bunch of values for particular node types in several mods,
-and values for groups of node types. The node definition takes
-precedence if it specifies a value. Nodes for which no value at
-all is known are taken to provide no radiation resistance at all;
-this is appropriate for the majority of node types. Only node types
-consisting of a fairly homogeneous mass of material should report
-non-zero radiation resistance; anything with non-uniform geometry
-or complex internal structure should show no radiation resistance.
-Fractional resistance values are permitted.
---]]
-
-local default_radiation_resistance_per_node = {
- ["default:brick"] = 13,
- ["default:bronzeblock"] = 45,
- ["default:clay"] = 15,
- ["default:coalblock"] = 9.6,
- ["default:cobble"] = 15,
- ["default:copperblock"] = 46,
- ["default:desert_cobble"] = 15,
- ["default:desert_sand"] = 10,
- ["default:desert_stone"] = 17,
- ["default:desert_stonebrick"] = 17,
- ["default:diamondblock"] = 24,
- ["default:dirt"] = 8.2,
- ["default:dirt_with_grass"] = 8.2,
- ["default:dirt_with_grass_footsteps"] = 8.2,
- ["default:dirt_with_snow"] = 8.2,
- ["default:glass"] = 17,
- ["default:goldblock"] = 170,
- ["default:gravel"] = 10,
- ["default:ice"] = 5.6,
- ["default:lava_flowing"] = 8.5,
- ["default:lava_source"] = 17,
- ["default:mese"] = 21,
- ["default:mossycobble"] = 15,
- ["default:nyancat"] = 1000,
- ["default:nyancat_rainbow"] = 1000,
- ["default:obsidian"] = 18,
- ["default:obsidian_glass"] = 18,
- ["default:sand"] = 10,
- ["default:sandstone"] = 15,
- ["default:sandstonebrick"] = 15,
- ["default:snowblock"] = 1.7,
- ["default:steelblock"] = 40,
- ["default:stone"] = 17,
- ["default:stone_with_coal"] = 16,
- ["default:stone_with_copper"] = 20,
- ["default:stone_with_diamond"] = 18,
- ["default:stone_with_gold"] = 34,
- ["default:stone_with_iron"] = 20,
- ["default:stone_with_mese"] = 17,
- ["default:stonebrick"] = 17,
- ["default:water_flowing"] = 2.8,
- ["default:water_source"] = 5.6,
- ["farming:desert_sand_soil"] = 10,
- ["farming:desert_sand_soil_wet"] = 10,
- ["farming:soil"] = 8.2,
- ["farming:soil_wet"] = 8.2,
- ["glooptest:akalin_crystal_glass"] = 21,
- ["glooptest:akalinblock"] = 40,
- ["glooptest:alatro_crystal_glass"] = 21,
- ["glooptest:alatroblock"] = 40,
- ["glooptest:amethystblock"] = 18,
- ["glooptest:arol_crystal_glass"] = 21,
- ["glooptest:crystal_glass"] = 21,
- ["glooptest:emeraldblock"] = 19,
- ["glooptest:heavy_crystal_glass"] = 21,
- ["glooptest:mineral_akalin"] = 20,
- ["glooptest:mineral_alatro"] = 20,
- ["glooptest:mineral_amethyst"] = 17,
- ["glooptest:mineral_arol"] = 20,
- ["glooptest:mineral_desert_coal"] = 16,
- ["glooptest:mineral_desert_iron"] = 20,
- ["glooptest:mineral_emerald"] = 17,
- ["glooptest:mineral_kalite"] = 20,
- ["glooptest:mineral_ruby"] = 18,
- ["glooptest:mineral_sapphire"] = 18,
- ["glooptest:mineral_talinite"] = 20,
- ["glooptest:mineral_topaz"] = 18,
- ["glooptest:reinforced_crystal_glass"] = 21,
- ["glooptest:rubyblock"] = 27,
- ["glooptest:sapphireblock"] = 27,
- ["glooptest:talinite_crystal_glass"] = 21,
- ["glooptest:taliniteblock"] = 40,
- ["glooptest:topazblock"] = 24,
- ["mesecons_extrawires:mese_powered"] = 21,
- ["moreblocks:cactus_brick"] = 13,
- ["moreblocks:cactus_checker"] = 8.5,
- ["moreblocks:circle_stone_bricks"] = 17,
- ["moreblocks:clean_glass"] = 17,
- ["moreblocks:coal_checker"] = 9.0,
- ["moreblocks:coal_glass"] = 17,
- ["moreblocks:coal_stone"] = 17,
- ["moreblocks:coal_stone_bricks"] = 17,
- ["moreblocks:glow_glass"] = 17,
- ["moreblocks:grey_bricks"] = 15,
- ["moreblocks:iron_checker"] = 11,
- ["moreblocks:iron_glass"] = 17,
- ["moreblocks:iron_stone"] = 17,
- ["moreblocks:iron_stone_bricks"] = 17,
- ["moreblocks:plankstone"] = 9.3,
- ["moreblocks:split_stone_tile"] = 15,
- ["moreblocks:split_stone_tile_alt"] = 15,
- ["moreblocks:stone_tile"] = 15,
- ["moreblocks:super_glow_glass"] = 17,
- ["moreblocks:tar"] = 7.0,
- ["moreblocks:wood_tile"] = 1.7,
- ["moreblocks:wood_tile_center"] = 1.7,
- ["moreblocks:wood_tile_down"] = 1.7,
- ["moreblocks:wood_tile_flipped"] = 1.7,
- ["moreblocks:wood_tile_full"] = 1.7,
- ["moreblocks:wood_tile_left"] = 1.7,
- ["moreblocks:wood_tile_right"] = 1.7,
- ["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,
- ["technic:cast_iron_block"] = 40,
- ["technic:chernobylite_block"] = 40,
- ["technic:chromium_block"] = 37,
- ["technic:corium_flowing"] = 40,
- ["technic:corium_source"] = 80,
- ["technic:granite"] = 18,
- ["technic:lead_block"] = 80,
- ["technic:marble"] = 18,
- ["technic:marble_bricks"] = 18,
- ["technic:mineral_chromium"] = 19,
- ["technic:mineral_uranium"] = 71,
- ["technic:mineral_zinc"] = 19,
- ["technic:stainless_steel_block"] = 40,
- ["technic:zinc_block"] = 36,
- ["tnt:tnt"] = 11,
- ["tnt:tnt_burning"] = 11,
-}
-local default_radiation_resistance_per_group = {
- concrete = 16,
- tree = 3.4,
- uranium_block = 500,
- wood = 1.7,
-}
-local cache_radiation_resistance = {}
-local function node_radiation_resistance(node_name)
- local eff = cache_radiation_resistance[node_name]
- if eff then return eff end
- local def = minetest.registered_nodes[node_name]
- eff = def and def.radiation_resistance or
- default_radiation_resistance_per_node[node_name]
- if def and not eff then
- for g, v in pairs(def.groups) do
- if v > 0 and default_radiation_resistance_per_group[g] then
- eff = default_radiation_resistance_per_group[g]
- break
- end
- end
- end
- if not eff then eff = 0 end
- cache_radiation_resistance[node_name] = eff
- return eff
-end
-
---[[
-Radioactive nodes cause damage to nearby players. The damage
-effect depends on the intrinsic strength of the radiation source,
-the distance between the source and the player, and the shielding
-effect of the intervening material. These determine a rate of damage;
-total damage caused is the integral of this over time.
-
-In the absence of effective shielding, for a specific source the
-damage rate varies realistically in inverse proportion to the square
-of the distance. (Distance is measured to the player's abdomen,
-not to the nominal player position which corresponds to the foot.)
-However, if the player is inside a non-walkable (liquid or gaseous)
-radioactive node, the nominal distance could go to zero, yielding
-infinite damage. In that case, the player's body is displacing the
-radioactive material, so the effective distance should remain non-zero.
-We therefore apply a lower distance bound of sqrt(0.75), which is
-the maximum distance one can get from the node center within the node.
-
-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 1000 times the distance from a node at which
-an unshielded player will be damaged by 0.25 HP/s. Or, equivalently,
-it is 2000 times the square root of the damage rate in HP/s that an
-unshielded player 1 node away will take.
-
-Shielding is assessed by adding the shielding values of all nodes
-between the source node and the player, ignoring the source node itself.
-As in reality, shielding causes exponential attenuation of radiation.
-However, the effect is scaled down relative to real life. A node with
-radiation resistance value R yields attenuation of sqrt(R) * 0.1 nepers.
-(In real life it would be about R * 0.69 nepers, by the definition
-of the radiation resistance values.) The sqrt part of this formula
-scales down the differences between shielding types, reflecting the
-game's simplification of making expensive materials such as gold
-readily available in cubes. The multiplicative factor in the
-formula scales down the difference between shielded and unshielded
-safe distances, avoiding the latter becoming impractically large.
-
-Damage is processed at rates down to 0.25 HP/s, which in the absence of
-shielding is attained at the distance specified by the "radioactive"
-group value. Computed damage rates below 0.25 HP/s result in no
-damage at all to the player. This gives the player an opportunity
-to be safe, and limits the range at which source/player interactions
-need to be considered.
---]]
-local abdomen_offset = vector.new(0, 1, 0)
-local abdomen_offset_length = vector.length(abdomen_offset)
-local cache_scaled_shielding = {}
-
-local function dmg_player(pos, o, strength)
- local pl_pos = vector.add(o:getpos(), abdomen_offset)
- local shielding = 0
- local dist = vector.distance(pos, pl_pos)
- for ray_pos in technic.trace_node_ray(pos,
- vector.direction(pos, pl_pos), dist) do
- if not vector.equals(ray_pos, pos) then
- local shield_name = minetest.get_node(ray_pos).name
- local shield_val = cache_scaled_shielding[sname]
- if not shield_val then
- shield_val = math.sqrt(node_radiation_resistance(shield_name)) * 0.025
- cache_scaled_shielding[shield_name] = shield_val
- end
- shielding = shielding + shield_val
- end
- end
- local dmg = (0.25e-6 * strength * strength) /
- (math.max(0.75, dist * dist) * math.exp(shielding))
- if dmg >= 0.25 then
- local dmg_int = math.floor(dmg)
- -- The closer you are to getting one more damage point,
- -- the more likely it will be added.
- if math.random() < dmg - dmg_int then
- dmg_int = dmg_int + 1
- end
- if dmg_int > 0 then
- o:set_hp(math.max(o:get_hp() - dmg_int, 0))
- end
- end
-end
-
-local function dmg_abm(pos, node)
- local strength = minetest.get_item_group(node.name, "radioactive")
- for _, o in pairs(minetest.get_objects_inside_radius(pos,
- strength * 0.001 + abdomen_offset_length)) do
- if o:is_player() then
- dmg_player(pos, o, strength)
- end
- end
-end
-
-
-if minetest.setting_getbool("enable_damage") then
- minetest.register_abm({
- nodenames = {"group:radioactive"},
- interval = 1,
- chance = 1,
- action = dmg_abm,
- })
-end
-
--- Radioactive materials that can result from destroying a reactor
-local griefing = technic.config:get_bool("enable_corium_griefing")
-
-for _, state in pairs({"flowing", "source"}) do
- minetest.register_node("technic:corium_"..state, {
- description = S(state == "source" and "Corium Source" or "Flowing Corium"),
- drawtype = (state == "source" and "liquid" or "flowingliquid"),
- [state == "source" and "tiles" or "special_tiles"] = {{
- name = "technic_corium_"..state.."_animated.png",
- animation = {
- type = "vertical_frames",
- aspect_w = 16,
- aspect_h = 16,
- length = 3.0,
- },
- }},
- paramtype = "light",
- paramtype2 = (state == "flowing" and "flowingliquid" or nil),
- light_source = (state == "source" and 8 or 5),
- walkable = false,
- pointable = false,
- diggable = false,
- buildable_to = true,
- drop = "",
- drowning = 1,
- liquidtype = state,
- liquid_alternative_flowing = "technic:corium_flowing",
- liquid_alternative_source = "technic:corium_source",
- liquid_viscosity = LAVA_VISC,
- liquid_renewable = false,
- damage_per_second = 6,
- post_effect_color = {a=192, r=80, g=160, b=80},
- groups = {
- liquid = 2,
- hot = 3,
- igniter = (griefing and 1 or 0),
- radioactive = (state == "source" and 32000 or 16000),
- not_in_creative_inventory = (state == "flowing" and 1 or nil),
- },
- })
-end
-
-if rawget(_G, "bucket") and bucket.register_liquid then
- bucket.register_liquid(
- "technic:corium_source",
- "technic:corium_flowing",
- "technic:bucket_corium",
- "technic_bucket_corium.png",
- "Corium Bucket"
- )
-end
-
-minetest.register_node("technic:chernobylite_block", {
- description = S("Chernobylite Block"),
- tiles = {"technic_chernobylite_block.png"},
- is_ground_content = true,
- groups = {cracky=1, radioactive=5000, level=2},
- sounds = default.node_sound_stone_defaults(),
- light_source = 2,
-})
-
-minetest.register_abm({
- nodenames = {"group:water"},
- neighbors = {"technic:corium_source"},
- interval = 1,
- chance = 1,
- action = function(pos, node)
- minetest.remove_node(pos)
- end,
-})
-
-minetest.register_abm({
- nodenames = {"technic:corium_flowing"},
- neighbors = {"group:water"},
- interval = 1,
- chance = 1,
- action = function(pos, node)
- minetest.set_node(pos, {name="technic:chernobylite_block"})
- end,
-})
-
-minetest.register_abm({
- nodenames = {"technic:corium_flowing"},
- interval = 5,
- chance = (griefing and 10 or 1),
- action = function(pos, node)
- minetest.set_node(pos, {name="technic:chernobylite_block"})
- end,
-})
-
-if griefing then
- minetest.register_abm({
- nodenames = {"technic:corium_source", "technic:corium_flowing"},
- interval = 4,
- chance = 4,
- action = function(pos, node)
- for _, offset in ipairs({
- vector.new(1,0,0),
- vector.new(-1,0,0),
- vector.new(0,0,1),
- vector.new(0,0,-1),
- vector.new(0,-1,0),
- }) do
- if math.random(8) == 1 then
- minetest.dig_node(vector.add(pos, offset))
- end
- end
- end,
- })
-end
-
diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua
index 8255676..8d87b65 100644
--- a/technic/machines/HV/quarry.lua
+++ b/technic/machines/HV/quarry.lua
@@ -12,6 +12,7 @@ minetest.register_craft({
local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes
local quarry_max_depth = 100
local quarry_demand = 10000
+local quarry_eject_dir = vector.new(0, 1, 0)
local function set_quarry_formspec(meta)
local radius = meta:get_int("size")
@@ -83,7 +84,7 @@ local function quarry_handle_purge(pos)
if stack then
local item = stack:to_table()
if item then
- technic.tube_inject_item(pos, pos, vector.new(0, 1, 0), item)
+ technic.tube_inject_item(pos, pos, quarry_eject_dir, item)
stack:clear()
inv:set_stack("cache", i, stack)
break
@@ -217,6 +218,16 @@ minetest.register_node("technic:quarry", {
connect_sides = {"bottom", "front", "left", "right"},
tube = {
connect_sides = {top = 1},
+ -- lower priority than other tubes, so that quarries will prefer any
+ -- other tube to another quarry, which could lead to server freezes
+ -- in certain quarry placements (2x2 for example would never eject)
+ priority = 10,
+ can_go = function(pos, node, velocity, stack)
+ -- always eject the same, even if items came in another way
+ -- this further mitigates loops and generally avoids random sideway movement
+ -- that can be expected in certain quarry placements
+ return { quarry_eject_dir }
+ end
},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
diff --git a/technic/machines/LV/water_mill.lua b/technic/machines/LV/water_mill.lua
index c853310..acb778c 100644
--- a/technic/machines/LV/water_mill.lua
+++ b/technic/machines/LV/water_mill.lua
@@ -17,19 +17,21 @@ minetest.register_craft({
local function check_node_around_mill(pos)
local node = minetest.get_node(pos)
- if node.name == "default:water_flowing" or
- node.name == "default:water_source" then
- return true
+ if node.name == "default:water_flowing"
+ or node.name == "default:river_water_flowing" then
+ return node.param2 -- returns approx. water flow, if any
end
return false
end
local run = function(pos, node)
local meta = minetest.get_meta(pos)
- local water_nodes = 0
+ local water_flow = 0
local lava_nodes = 0
local production_level = 0
local eu_supply = 0
+ local max_output = 35 * 45 -- four param2's at 15 makes 60, cap it lower for "overload protection"
+ -- (plus we want the gen to report 100% if three sides have full flow)
local positions = {
{x=pos.x+1, y=pos.y, z=pos.z},
@@ -41,12 +43,12 @@ local run = function(pos, node)
for _, p in pairs(positions) do
local check = check_node_around_mill(p)
if check then
- water_nodes = water_nodes + 1
+ water_flow = water_flow + check
end
end
- production_level = 25 * water_nodes
- eu_supply = 30 * water_nodes
+ eu_supply = math.min(35 * water_flow, max_output)
+ production_level = math.floor(100 * eu_supply / max_output)
if production_level > 0 then
meta:set_int("LV_EU_supply", eu_supply)
diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua
index 28984c0..a7e72a3 100644
--- a/technic/machines/register/cables.lua
+++ b/technic/machines/register/cables.lua
@@ -11,8 +11,19 @@ function technic.get_cable_tier(name)
return cable_tier[name]
end
-local function clear_networks()
- technic.networks = {}
+local function clear_networks(pos)
+ local positions = {
+ {x=pos.x+1, y=pos.y, z=pos.z},
+ {x=pos.x-1, y=pos.y, z=pos.z},
+ {x=pos.x, y=pos.y+1, z=pos.z},
+ {x=pos.x, y=pos.y-1, z=pos.z},
+ {x=pos.x, y=pos.y, z=pos.z+1},
+ {x=pos.x, y=pos.y, z=pos.z-1}}
+ for _,connected_pos in pairs(positions) do
+ if technic.cables[minetest.hash_node_position(connected_pos)] then
+ technic.networks[technic.cables[minetest.hash_node_position(connected_pos)]] = nil
+ end
+ end
end
function technic.register_cable(tier, size)
@@ -55,7 +66,7 @@ end
local function clear_nets_if_machine(pos, node)
for tier, machine_list in pairs(technic.machines) do
if machine_list[node.name] ~= nil then
- return clear_networks()
+ return clear_networks(pos)
end
end
end
diff --git a/technic/machines/register/centrifuge_recipes.lua b/technic/machines/register/centrifuge_recipes.lua
index 05642f5..b4db47c 100644
--- a/technic/machines/register/centrifuge_recipes.lua
+++ b/technic/machines/register/centrifuge_recipes.lua
@@ -14,6 +14,7 @@ local recipes = {
{ "technic:bronze_dust 4", "technic:copper_dust 3", "technic:tin_dust" },
{ "technic:stainless_steel_dust 4", "technic:wrought_iron_dust 3", "technic:chromium_dust" },
{ "technic:brass_dust 3", "technic:copper_dust 2", "technic:zinc_dust" },
+ { "default:dirt 4", "default:sand", "default:gravel", "default:clay_lump 2" },
}
local function uranium_dust(p)
@@ -34,5 +35,5 @@ if minetest.get_modpath("farming") then
end
for _, data in pairs(recipes) do
- technic.register_separating_recipe({ input = { data[1] }, output = { data[2], data[3] } })
+ technic.register_separating_recipe({ input = { data[1] }, output = { data[2], data[3], data[4] } })
end
diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua
index 87c6ade..7eaa7d4 100644
--- a/technic/machines/register/grinder_recipes.lua
+++ b/technic/machines/register/grinder_recipes.lua
@@ -20,11 +20,12 @@ local recipes = {
{"technic:zinc_lump", "technic:zinc_dust 2"},
{"technic:lead_lump", "technic:lead_dust 2"},
{"technic:sulfur_lump", "technic:sulfur_dust 2"},
+ {"default:stone", "technic:stone_dust"},
+ {"default:sand", "technic:stone_dust"},
-- Other
{"default:cobble", "default:gravel"},
- {"default:gravel", "default:dirt"},
- {"default:stone", "default:sand"},
+ {"default:gravel", "default:sand"},
{"default:sandstone", "default:sand 2"}, -- reverse recipe can be found in the compressor
}
@@ -103,6 +104,7 @@ register_dust("Sulfur", nil)
register_dust("Tin", "moreores:tin_ingot")
register_dust("Wrought Iron", "technic:wrought_iron_ingot")
register_dust("Zinc", "technic:zinc_ingot")
+register_dust("Stone", "default:stone")
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
register_dust("Akalin", "glooptest:akalin_ingot")
register_dust("Alatro", "glooptest:alatro_ingot")
diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua
index 32597de..15c761d 100644
--- a/technic/machines/supply_converter.lua
+++ b/technic/machines/supply_converter.lua
@@ -9,12 +9,62 @@
local S = technic.getter
+local function set_supply_converter_formspec(meta)
+ local formspec = "size[5,2.25]"..
+ "field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]"
+ -- The names for these toggle buttons are explicit about which
+ -- state they'll switch to, so that multiple presses (arising
+ -- from the ambiguity between lag and a missed press) only make
+ -- the single change that the user expects.
+ if meta:get_int("mesecon_mode") == 0 then
+ formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]"
+ else
+ formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]"
+ end
+ if meta:get_int("enabled") == 0 then
+ formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("Supply Converter")).."]"
+ else
+ formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("Supply Converter")).."]"
+ end
+ meta:set_string("formspec", formspec)
+end
+
+local supply_converter_receive_fields = function(pos, formname, fields, sender)
+ local meta = minetest.get_meta(pos)
+ local power = nil
+ if fields.power then
+ power = tonumber(fields.power) or 0
+ power = 100 * math.floor(power / 100)
+ power = math.max(power, 0)
+ power = math.min(power, 10000)
+ if power == meta:get_int("power") then power = nil end
+ end
+ if power then meta:set_int("power", power) end
+ if fields.enable then meta:set_int("enabled", 1) end
+ if fields.disable then meta:set_int("enabled", 0) end
+ if fields.mesecon_mode_0 then meta:set_int("mesecon_mode", 0) end
+ if fields.mesecon_mode_1 then meta:set_int("mesecon_mode", 1) end
+ set_supply_converter_formspec(meta)
+end
+
+local mesecons = {
+ effector = {
+ action_on = function(pos, node)
+ minetest.get_meta(pos):set_int("mesecon_effect", 1)
+ end,
+ action_off = function(pos, node)
+ minetest.get_meta(pos):set_int("mesecon_effect", 0)
+ end
+ }
+}
+
local run = function(pos, node)
- local demand = 10000
local remain = 0.9
-- Machine information
local machine_name = S("Supply Converter")
local meta = minetest.get_meta(pos)
+ local enabled = meta:get_int("enabled") ~= 0 and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0)
+ local demand = enabled and meta:get_int("power") or 10000
local pos_up = {x=pos.x, y=pos.y+1, z=pos.z}
local pos_down = {x=pos.x, y=pos.y-1, z=pos.z}
@@ -53,12 +103,19 @@ minetest.register_node("technic:supply_converter", {
technic_machine=1, technic_all_tiers=1},
connect_sides = {"top", "bottom"},
sounds = default.node_sound_wood_defaults(),
+ on_receive_fields = supply_converter_receive_fields,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Supply Converter"))
- meta:set_float("active", false)
+ meta:set_int("power", 10000)
+ meta:set_int("enabled", 1)
+ meta:set_int("mesecon_mode", 0)
+ meta:set_int("mesecon_effect", 0)
+ set_supply_converter_formspec(meta)
end,
+ mesecons = mesecons,
technic_run = run,
+ technic_on_disable = run,
})
minetest.register_craft({
diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua
index f7ec0b6..2051acf 100644
--- a/technic/machines/switching_station.lua
+++ b/technic/machines/switching_station.lua
@@ -32,6 +32,7 @@
-- This way the supplies are separated per network.
technic.networks = {}
+technic.cables = {}
local S = technic.getter
@@ -64,7 +65,8 @@ minetest.register_node("technic:switching_station",{
--------------------------------------------------
-- Add a wire node to the LV/MV/HV network
-local add_new_cable_node = function(nodes, pos)
+local add_new_cable_node = function(nodes, pos, network_id)
+ technic.cables[minetest.hash_node_position(pos)] = network_id
-- Ignore if the node has already been added
for i = 1, #nodes do
if pos.x == nodes[i].x and
@@ -78,31 +80,31 @@ local add_new_cable_node = function(nodes, pos)
end
-- Generic function to add found connected nodes to the right classification array
-local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos, from_below)
+local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos, from_below, network_id)
technic.get_or_load_node(pos)
local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name
if technic.is_tier_cable(name, tier) then
- add_new_cable_node(all_nodes, pos)
+ add_new_cable_node(all_nodes, pos,network_id)
elseif machines[name] then
--dprint(name.." is a "..machines[name])
if machines[name] == technic.producer then
- add_new_cable_node(PR_nodes, pos)
+ add_new_cable_node(PR_nodes, pos, network_id)
elseif machines[name] == technic.receiver then
- add_new_cable_node(RE_nodes, pos)
+ add_new_cable_node(RE_nodes, pos, network_id)
elseif machines[name] == technic.producer_receiver then
- add_new_cable_node(PR_nodes, pos)
- add_new_cable_node(RE_nodes, pos)
+ add_new_cable_node(PR_nodes, pos, network_id)
+ add_new_cable_node(RE_nodes, pos, network_id)
elseif machines[name] == "SPECIAL" and
(pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) and
from_below then
-- Another switching station -> disable it
- add_new_cable_node(SP_nodes, pos)
+ add_new_cable_node(SP_nodes, pos, network_id)
meta:set_int("active", 0)
meta:set_string("active_pos", minetest.serialize(sw_pos))
elseif machines[name] == technic.battery then
- add_new_cable_node(BA_nodes, pos)
+ add_new_cable_node(BA_nodes, pos, network_id)
end
meta:set_int(tier.."_EU_timeout", 2) -- Touch node
@@ -110,7 +112,7 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nod
end
-- Traverse a network given a list of machines and a cable type name
-local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, i, machines, tier, sw_pos)
+local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, i, machines, tier, sw_pos, network_id)
local pos = all_nodes[i]
local positions = {
{x=pos.x+1, y=pos.y, z=pos.z},
@@ -121,7 +123,7 @@ local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_no
{x=pos.x, y=pos.y, z=pos.z-1}}
--print("ON")
for i, cur_pos in pairs(positions) do
- check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3)
+ check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3, network_id)
end
end
@@ -153,7 +155,7 @@ local get_network = function(sw_pos, pos1, tier)
local all_nodes = {pos1}
repeat
traverse_network(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes,
- i, technic.machines[tier], tier, sw_pos)
+ i, technic.machines[tier], tier, sw_pos, minetest.hash_node_position(pos1))
i = i + 1
until all_nodes[i] == nil
technic.networks[minetest.hash_node_position(pos1)] = {tier = tier, PR_nodes = PR_nodes,
diff --git a/technic/radiation.lua b/technic/radiation.lua
new file mode 100644
index 0000000..13936f9
--- /dev/null
+++ b/technic/radiation.lua
@@ -0,0 +1,483 @@
+--[[
+Radioactivity
+
+Radiation resistance represents the extent to which a material
+attenuates radiation passing through it; i.e., how good a radiation
+shield it is. This is identified per node type. For materials that
+exist in real life, the radiation resistance value that this system
+uses for a node type consisting of a solid cube of that material is the
+(approximate) number of halvings of ionising radiation that is achieved
+by a meter of the material in real life. This is approximately
+proportional to density, which provides a good way to estimate it.
+Homogeneous mixtures of materials have radiation resistance computed
+by a simple weighted mean. Note that the amount of attenuation that
+a material achieves in-game is not required to be (and is not) the
+same as the attenuation achieved in real life.
+
+Radiation resistance for a node type may be specified in the node
+definition, under the key "radiation_resistance". As an interim
+measure, until node definitions widely include this, this code
+knows a bunch of values for particular node types in several mods,
+and values for groups of node types. The node definition takes
+precedence if it specifies a value. Nodes for which no value at
+all is known are taken to provide no radiation resistance at all;
+this is appropriate for the majority of node types. Only node types
+consisting of a fairly homogeneous mass of material should report
+non-zero radiation resistance; anything with non-uniform geometry
+or complex internal structure should show no radiation resistance.
+Fractional resistance values are permitted.
+--]]
+
+local S = technic.getter
+
+local rad_resistance_node = {
+ ["default:brick"] = 13,
+ ["default:bronzeblock"] = 45,
+ ["default:clay"] = 15,
+ ["default:coalblock"] = 9.6,
+ ["default:cobble"] = 15,
+ ["default:copperblock"] = 46,
+ ["default:desert_cobble"] = 15,
+ ["default:desert_sand"] = 10,
+ ["default:desert_stone"] = 17,
+ ["default:desert_stonebrick"] = 17,
+ ["default:diamondblock"] = 24,
+ ["default:dirt"] = 8.2,
+ ["default:dirt_with_grass"] = 8.2,
+ ["default:dirt_with_grass_footsteps"] = 8.2,
+ ["default:dirt_with_snow"] = 8.2,
+ ["default:glass"] = 17,
+ ["default:goldblock"] = 170,
+ ["default:gravel"] = 10,
+ ["default:ice"] = 5.6,
+ ["default:lava_flowing"] = 8.5,
+ ["default:lava_source"] = 17,
+ ["default:mese"] = 21,
+ ["default:mossycobble"] = 15,
+ ["default:nyancat"] = 1000,
+ ["default:nyancat_rainbow"] = 1000,
+ ["default:obsidian"] = 18,
+ ["default:obsidian_glass"] = 18,
+ ["default:sand"] = 10,
+ ["default:sandstone"] = 15,
+ ["default:sandstonebrick"] = 15,
+ ["default:snowblock"] = 1.7,
+ ["default:steelblock"] = 40,
+ ["default:stone"] = 17,
+ ["default:stone_with_coal"] = 16,
+ ["default:stone_with_copper"] = 20,
+ ["default:stone_with_diamond"] = 18,
+ ["default:stone_with_gold"] = 34,
+ ["default:stone_with_iron"] = 20,
+ ["default:stone_with_mese"] = 17,
+ ["default:stonebrick"] = 17,
+ ["default:water_flowing"] = 2.8,
+ ["default:water_source"] = 5.6,
+ ["farming:desert_sand_soil"] = 10,
+ ["farming:desert_sand_soil_wet"] = 10,
+ ["farming:soil"] = 8.2,
+ ["farming:soil_wet"] = 8.2,
+ ["glooptest:akalin_crystal_glass"] = 21,
+ ["glooptest:akalinblock"] = 40,
+ ["glooptest:alatro_crystal_glass"] = 21,
+ ["glooptest:alatroblock"] = 40,
+ ["glooptest:amethystblock"] = 18,
+ ["glooptest:arol_crystal_glass"] = 21,
+ ["glooptest:crystal_glass"] = 21,
+ ["glooptest:emeraldblock"] = 19,
+ ["glooptest:heavy_crystal_glass"] = 21,
+ ["glooptest:mineral_akalin"] = 20,
+ ["glooptest:mineral_alatro"] = 20,
+ ["glooptest:mineral_amethyst"] = 17,
+ ["glooptest:mineral_arol"] = 20,
+ ["glooptest:mineral_desert_coal"] = 16,
+ ["glooptest:mineral_desert_iron"] = 20,
+ ["glooptest:mineral_emerald"] = 17,
+ ["glooptest:mineral_kalite"] = 20,
+ ["glooptest:mineral_ruby"] = 18,
+ ["glooptest:mineral_sapphire"] = 18,
+ ["glooptest:mineral_talinite"] = 20,
+ ["glooptest:mineral_topaz"] = 18,
+ ["glooptest:reinforced_crystal_glass"] = 21,
+ ["glooptest:rubyblock"] = 27,
+ ["glooptest:sapphireblock"] = 27,
+ ["glooptest:talinite_crystal_glass"] = 21,
+ ["glooptest:taliniteblock"] = 40,
+ ["glooptest:topazblock"] = 24,
+ ["mesecons_extrawires:mese_powered"] = 21,
+ ["moreblocks:cactus_brick"] = 13,
+ ["moreblocks:cactus_checker"] = 8.5,
+ ["moreblocks:circle_stone_bricks"] = 17,
+ ["moreblocks:clean_glass"] = 17,
+ ["moreblocks:coal_checker"] = 9.0,
+ ["moreblocks:coal_glass"] = 17,
+ ["moreblocks:coal_stone"] = 17,
+ ["moreblocks:coal_stone_bricks"] = 17,
+ ["moreblocks:glow_glass"] = 17,
+ ["moreblocks:grey_bricks"] = 15,
+ ["moreblocks:iron_checker"] = 11,
+ ["moreblocks:iron_glass"] = 17,
+ ["moreblocks:iron_stone"] = 17,
+ ["moreblocks:iron_stone_bricks"] = 17,
+ ["moreblocks:plankstone"] = 9.3,
+ ["moreblocks:split_stone_tile"] = 15,
+ ["moreblocks:split_stone_tile_alt"] = 15,
+ ["moreblocks:stone_tile"] = 15,
+ ["moreblocks:super_glow_glass"] = 17,
+ ["moreblocks:tar"] = 7.0,
+ ["moreblocks:wood_tile"] = 1.7,
+ ["moreblocks:wood_tile_center"] = 1.7,
+ ["moreblocks:wood_tile_down"] = 1.7,
+ ["moreblocks:wood_tile_flipped"] = 1.7,
+ ["moreblocks:wood_tile_full"] = 1.7,
+ ["moreblocks:wood_tile_left"] = 1.7,
+ ["moreblocks:wood_tile_right"] = 1.7,
+ ["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,
+ ["technic:cast_iron_block"] = 40,
+ ["technic:chernobylite_block"] = 40,
+ ["technic:chromium_block"] = 37,
+ ["technic:corium_flowing"] = 40,
+ ["technic:corium_source"] = 80,
+ ["technic:granite"] = 18,
+ ["technic:lead_block"] = 80,
+ ["technic:marble"] = 18,
+ ["technic:marble_bricks"] = 18,
+ ["technic:mineral_chromium"] = 19,
+ ["technic:mineral_uranium"] = 71,
+ ["technic:mineral_zinc"] = 19,
+ ["technic:stainless_steel_block"] = 40,
+ ["technic:zinc_block"] = 36,
+ ["tnt:tnt"] = 11,
+ ["tnt:tnt_burning"] = 11,
+}
+local rad_resistance_group = {
+ concrete = 16,
+ tree = 3.4,
+ uranium_block = 500,
+ wood = 1.7,
+}
+local cache_radiation_resistance = {}
+local function node_radiation_resistance(node_name)
+ local resistance = cache_radiation_resistance[node_name]
+ if resistance then
+ return resistance
+ end
+ local def = minetest.registered_nodes[node_name]
+ if not def then
+ cache_radiation_resistance[node_name] = 0
+ return 0
+ end
+ resistance = def.radiation_resistance or
+ rad_resistance_node[node_name]
+ if not resistance then
+ resistance = 0
+ for g, v in pairs(def.groups) do
+ if v > 0 and rad_resistance_group[g] then
+ resistance = resistance + rad_resistance_group[g]
+ end
+ end
+ end
+ resistance = math.sqrt(resistance)
+ cache_radiation_resistance[node_name] = resistance
+ return resistance
+end
+
+
+--[[
+Radioactive nodes cause damage to nearby players. The damage
+effect depends on the intrinsic strength of the radiation source,
+the distance between the source and the player, and the shielding
+effect of the intervening material. These determine a rate of damage;
+total damage caused is the integral of this over time.
+
+In the absence of effective shielding, for a specific source the
+damage rate varies realistically in inverse proportion to the square
+of the distance. (Distance is measured to the player's abdomen,
+not to the nominal player position which corresponds to the foot.)
+However, if the player is inside a non-walkable (liquid or gaseous)
+radioactive node, the nominal distance could go to zero, yielding
+infinite damage. In that case, the player's body is displacing the
+radioactive material, so the effective distance should remain non-zero.
+We therefore apply a lower distance bound of sqrt(0.75), which is
+the maximum distance one can get from the node center within the node.
+
+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 from a node at which an unshielded
+player will be damaged by 1 HP/s. Or, equivalently, it is the square
+root of the damage rate in HP/s that an unshielded player one node
+away will take.
+
+Shielding is assessed by adding the shielding values of all nodes
+between the source node and the player, ignoring the source node itself.
+As in reality, shielding causes exponential attenuation of radiation.
+However, the effect is scaled down relative to real life. A node with
+radiation resistance value R yields attenuation of sqrt(R) * 0.1 nepers.
+(In real life it would be about R * 0.69 nepers, by the definition
+of the radiation resistance values.) The sqrt part of this formula
+scales down the differences between shielding types, reflecting the
+game's simplification of making expensive materials such as gold
+readily available in cubes. The multiplicative factor in the
+formula scales down the difference between shielded and unshielded
+safe distances, avoiding the latter becoming impractically large.
+
+Damage is processed at rates down to 0.2 HP/s, which in the absence of
+shielding is attained at the distance specified by the "radioactive"
+group value. Computed damage rates below 0.2 HP/s result in no
+damage at all to the player. This gives the player an opportunity
+to be safe, and limits the range at which source/player interactions
+need to be considered.
+--]]
+local abdomen_offset = 1
+local cache_scaled_shielding = {}
+local rad_dmg_cutoff = 0.2
+local radiated_players = {}
+
+local armor_enabled = technic.config:get_bool("enable_radiation_protection")
+local entity_damage = technic.config:get_bool("enable_entity_radiation_damage")
+local longterm_damage = technic.config:get_bool("enable_longterm_radiation_damage")
+
+local function apply_fractional_damage(o, dmg)
+ local dmg_int = math.floor(dmg)
+ -- The closer you are to getting one more damage point,
+ -- the more likely it will be added.
+ if math.random() < dmg - dmg_int then
+ dmg_int = dmg_int + 1
+ end
+ if dmg_int > 0 then
+ local new_hp = math.max(o:get_hp() - dmg_int, 0)
+ o:set_hp(new_hp)
+ return new_hp == 0
+ end
+ return false
+end
+
+local function calculate_base_damage(node_pos, object_pos, strength)
+ local shielding = 0
+ local dist = vector.distance(node_pos, object_pos)
+
+ for ray_pos in technic.trace_node_ray(node_pos,
+ vector.direction(node_pos, object_pos), dist) do
+ local shield_name = minetest.get_node(ray_pos).name
+ shielding = shielding + node_radiation_resistance(shield_name) * 0.025
+ end
+
+ local dmg = (strength * strength) /
+ (math.max(0.75, dist * dist) * math.exp(shielding))
+
+ if dmg < rad_dmg_cutoff then return end
+ return dmg
+end
+
+local function calculate_damage_multiplier(object)
+ local ag = object.get_armor_groups and object:get_armor_groups()
+ if not ag then
+ return 0
+ end
+ if ag.immortal then
+ return 0
+ end
+ if ag.radiation then
+ return 0.01 * ag.radiation
+ end
+ if ag.fleshy then
+ return math.sqrt(0.01 * ag.fleshy)
+ end
+ return 0
+end
+
+local function calculate_object_center(object)
+ if object:is_player() then
+ return {x=0, y=abdomen_offset, z=0}
+ end
+ return {x=0, y=0, z=0}
+end
+
+local function dmg_object(pos, object, strength)
+ local obj_pos = vector.add(object:getpos(), calculate_object_center(object))
+ local mul
+ if armor_enabled or entity_damage then
+ -- we need to check may the object be damaged even if armor is disabled
+ mul = calculate_damage_multiplier(object)
+ if mul == 0 then
+ return
+ end
+ end
+ local dmg = calculate_base_damage(pos, obj_pos, strength)
+ if not dmg then
+ return
+ end
+ if armor_enabled then
+ dmg = dmg * mul
+ end
+ apply_fractional_damage(object, dmg)
+ if longterm_damage and object:is_player() then
+ local pn = object:get_player_name()
+ radiated_players[pn] = (radiated_players[pn] or 0) + dmg
+ end
+end
+
+local rad_dmg_mult_sqrt = math.sqrt(1 / rad_dmg_cutoff)
+local function dmg_abm(pos, node)
+ local strength = minetest.get_item_group(node.name, "radioactive")
+ local max_dist = strength * rad_dmg_mult_sqrt
+ for _, o in pairs(minetest.get_objects_inside_radius(pos,
+ max_dist + abdomen_offset)) do
+ if entity_damage or o:is_player() then
+ dmg_object(pos, o, strength)
+ end
+ end
+end
+
+if minetest.setting_getbool("enable_damage") then
+ minetest.register_abm({
+ nodenames = {"group:radioactive"},
+ interval = 1,
+ chance = 1,
+ action = dmg_abm,
+ })
+
+ if longterm_damage then
+ minetest.register_globalstep(function(dtime)
+ for pn, dmg in pairs(radiated_players) do
+ dmg = dmg - (dtime / 8)
+ local player = minetest.get_player_by_name(pn)
+ local killed
+ if player and dmg > rad_dmg_cutoff then
+ killed = apply_fractional_damage(player, (dmg * dtime) / 8)
+ else
+ dmg = nil
+ end
+ -- on_dieplayer will have already set this if the player died
+ if not killed then
+ radiated_players[pn] = dmg
+ end
+ end
+ end)
+
+ minetest.register_on_dieplayer(function(player)
+ radiated_players[player:get_player_name()] = nil
+ end)
+ end
+end
+
+-- Radioactive materials that can result from destroying a reactor
+local griefing = technic.config:get_bool("enable_corium_griefing")
+
+for _, state in pairs({"flowing", "source"}) do
+ minetest.register_node("technic:corium_"..state, {
+ description = S(state == "source" and "Corium Source" or "Flowing Corium"),
+ drawtype = (state == "source" and "liquid" or "flowingliquid"),
+ [state == "source" and "tiles" or "special_tiles"] = {{
+ name = "technic_corium_"..state.."_animated.png",
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 3.0,
+ },
+ }},
+ paramtype = "light",
+ paramtype2 = (state == "flowing" and "flowingliquid" or nil),
+ light_source = (state == "source" and 8 or 5),
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ drop = "",
+ drowning = 1,
+ liquidtype = state,
+ liquid_alternative_flowing = "technic:corium_flowing",
+ liquid_alternative_source = "technic:corium_source",
+ liquid_viscosity = LAVA_VISC,
+ liquid_renewable = false,
+ damage_per_second = 6,
+ post_effect_color = {a=192, r=80, g=160, b=80},
+ groups = {
+ liquid = 2,
+ hot = 3,
+ igniter = (griefing and 1 or 0),
+ radioactive = (state == "source" and 12 or 6),
+ not_in_creative_inventory = (state == "flowing" and 1 or nil),
+ },
+ })
+end
+
+if rawget(_G, "bucket") and bucket.register_liquid then
+ bucket.register_liquid(
+ "technic:corium_source",
+ "technic:corium_flowing",
+ "technic:bucket_corium",
+ "technic_bucket_corium.png",
+ "Corium Bucket"
+ )
+end
+
+minetest.register_node("technic:chernobylite_block", {
+ description = S("Chernobylite Block"),
+ tiles = {"technic_chernobylite_block.png"},
+ is_ground_content = true,
+ groups = {cracky=1, radioactive=4, level=2},
+ sounds = default.node_sound_stone_defaults(),
+ light_source = 2,
+})
+
+minetest.register_abm({
+ nodenames = {"group:water"},
+ neighbors = {"technic:corium_source"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node)
+ minetest.remove_node(pos)
+ end,
+})
+
+minetest.register_abm({
+ nodenames = {"technic:corium_flowing"},
+ neighbors = {"group:water"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node)
+ minetest.set_node(pos, {name="technic:chernobylite_block"})
+ end,
+})
+
+minetest.register_abm({
+ nodenames = {"technic:corium_flowing"},
+ interval = 5,
+ chance = (griefing and 10 or 1),
+ action = function(pos, node)
+ minetest.set_node(pos, {name="technic:chernobylite_block"})
+ end,
+})
+
+if griefing then
+ minetest.register_abm({
+ nodenames = {"technic:corium_source", "technic:corium_flowing"},
+ interval = 4,
+ chance = 4,
+ action = function(pos, node)
+ for _, offset in ipairs({
+ vector.new(1,0,0),
+ vector.new(-1,0,0),
+ vector.new(0,0,1),
+ vector.new(0,0,-1),
+ vector.new(0,-1,0),
+ }) do
+ if math.random(8) == 1 then
+ minetest.dig_node(vector.add(pos, offset))
+ end
+ end
+ end,
+ })
+end
+
diff --git a/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg b/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg
index 3d290b0..1f21a16 100644
--- a/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg
+++ b/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg
Binary files differ
diff --git a/technic/textures/technic_stone_dust.png b/technic/textures/technic_stone_dust.png
new file mode 100644
index 0000000..ce9d9e4
--- /dev/null
+++ b/technic/textures/technic_stone_dust.png
Binary files differ
diff --git a/technic/textures/technicx32/technic_stone_dust.png b/technic/textures/technicx32/technic_stone_dust.png
new file mode 100644
index 0000000..3c49fe6
--- /dev/null
+++ b/technic/textures/technicx32/technic_stone_dust.png
Binary files differ
diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua
index 8a25abe..ad60d1a 100644
--- a/technic/tools/mining_drill.lua
+++ b/technic/tools/mining_drill.lua
@@ -252,10 +252,9 @@ local function mining_drill_mk2_setmode(user,itemstack)
mode=mode+1
if mode>=5 then mode=1 end
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode)..": "..mining_drill_mode_text[mode][1])
- item["name"]="technic:mining_drill_mk2_"..mode
+ itemstack:set_name("technic:mining_drill_mk2_"..mode);
meta["mode"]=mode
- item["metadata"]=minetest.serialize(meta)
- itemstack:replace(item)
+ itemstack:set_metadata(minetest.serialize(meta))
return itemstack
end
@@ -276,10 +275,9 @@ local function mining_drill_mk3_setmode(user,itemstack)
mode=mode+1
if mode>=6 then mode=1 end
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode)..": "..mining_drill_mode_text[mode][1])
- item["name"]="technic:mining_drill_mk3_"..mode
+ itemstack:set_name("technic:mining_drill_mk3_"..mode);
meta["mode"]=mode
- item["metadata"]=minetest.serialize(meta)
- itemstack:replace(item)
+ itemstack:set_metadata(minetest.serialize(meta))
return itemstack
end
@@ -296,7 +294,7 @@ local function mining_drill_mk2_handler(itemstack, user, pointed_thing)
end
local charge_to_take = cost_to_use(2, meta.mode)
if meta.charge >= charge_to_take then
- local pos = minetest.get_pointed_thing_position(pointed_thing, above)
+ local pos = minetest.get_pointed_thing_position(pointed_thing, false)
drill_dig_it(pos, user, meta.mode)
if not technic.creative_mode then
meta.charge = meta.charge - charge_to_take
@@ -319,7 +317,7 @@ local function mining_drill_mk3_handler(itemstack, user, pointed_thing)
end
local charge_to_take = cost_to_use(3, meta.mode)
if meta.charge >= charge_to_take then
- local pos = minetest.get_pointed_thing_position(pointed_thing, above)
+ local pos = minetest.get_pointed_thing_position(pointed_thing, false)
drill_dig_it(pos, user, meta.mode)
if not technic.creative_mode then
meta.charge = meta.charge - charge_to_take
@@ -348,7 +346,7 @@ minetest.register_tool("technic:mining_drill", {
end
local charge_to_take = cost_to_use(1, 1)
if meta.charge >= charge_to_take then
- local pos = minetest.get_pointed_thing_position(pointed_thing, above)
+ local pos = minetest.get_pointed_thing_position(pointed_thing, false)
drill_dig_it(pos, user, 1)
if not technic.creative_mode then
meta.charge = meta.charge - charge_to_take
diff --git a/technic_chests/common.lua b/technic_chests/common.lua
index 47054f5..b8e30a4 100644
--- a/technic_chests/common.lua
+++ b/technic_chests/common.lua
@@ -65,7 +65,31 @@ function technic.chests.on_inv_take(pos, listname, index, stack, player)
..minetest.pos_to_string(pos))
end
-function has_locked_chest_privilege(meta, player)
- return player:get_player_name() == meta:get_string("owner")
+local function has_locked_chest_privilege(meta, player)
+ if player then
+ if minetest.check_player_privs(player, "protection_bypass") then
+ return true
+ end
+ else
+ return false
+ end
+
+ -- is player wielding the right key?
+ local item = player:get_wielded_item()
+ if item:get_name() == "default:key" then
+ local key_meta = minetest.parse_json(item:get_metadata())
+ local secret = meta:get_string("key_lock_secret")
+ if secret ~= key_meta.secret then
+ return false
+ end
+
+ return true
+ end
+
+ if player:get_player_name() ~= meta:get_string("owner") then
+ return false
+ end
+
+ return true
end
diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua
index a4fe2dd..f3a88e4 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=1000},
+ groups = {cracky=3, radioactive=1},
sounds = default.node_sound_stone_defaults(),
drop = "technic:uranium_lump",
})
@@ -74,7 +74,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=3000},
+ groups = {uranium_block=1, cracky=1, level=2, radioactive=2},
sounds = default.node_sound_stone_defaults()
})
diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua
index 795f0ec..c6782e6 100644
--- a/technic_worldgen/oregen.lua
+++ b/technic_worldgen/oregen.lua
@@ -54,13 +54,13 @@ minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_zinc",
wherein = "default:stone",
- clust_scarcity = 8*8*8,
- clust_num_ores = 4,
- clust_size = 3,
+ clust_scarcity = 9*9*9,
+ clust_num_ores = 5,
+ clust_size = 7,
y_min = -32,
y_max = 2,
- noise_params = zinc_params,
- noise_threshhold = zinc_threshhold,
+ noise_params = lead_params,
+ noise_threshhold = lead_threshhold,
})
minetest.register_ore({