From 1b4453fae3425ec0d7fa8d2db88c305abf6c8210 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Tue, 22 Jan 2019 17:07:04 +0200 Subject: [PATCH] Fission reactor parameters play-around, other tweaks --- elepower_dynamics/craftitems.lua | 2 +- elepower_machines/crafting.lua | 4 +- elepower_machines/machines/steam_turbine.lua | 1 + elepower_nuclear/crafting.lua | 10 ++++ .../machines/enrichment_plant.lua | 1 + elepower_nuclear/machines/fission_reactor.lua | 51 ++++++++++++++----- elepower_nuclear/machines/heat_exchanger.lua | 2 +- elepower_papi/machine.lua | 2 +- 8 files changed, 54 insertions(+), 19 deletions(-) diff --git a/elepower_dynamics/craftitems.lua b/elepower_dynamics/craftitems.lua index 8ad8d50..0de8ffe 100644 --- a/elepower_dynamics/craftitems.lua +++ b/elepower_dynamics/craftitems.lua @@ -137,7 +137,7 @@ minetest.register_craftitem("elepower_dynamics:pcb", { }) minetest.register_craftitem("elepower_dynamics:acidic_compound", { - description = "Acidic Compound\nUsed to make Etching Acid", + description = "Acidic Compound\nRight-Click on Water to turn it into Etching Acid", inventory_image = "elepower_acidic_compound.png", liquids_pointable = true, groups = {acid = 1, static_component = 1}, diff --git a/elepower_machines/crafting.lua b/elepower_machines/crafting.lua index 5ea6ad9..565f214 100644 --- a/elepower_machines/crafting.lua +++ b/elepower_machines/crafting.lua @@ -652,9 +652,9 @@ minetest.register_craft({ minetest.register_craft({ output = "elepower_machines:advanced_machine_block 8", recipe = { - {"elepower_dynamics:electrum_plate", "elepower_dynamics:brass_plate", "elepower_dynamics:electrum_plate"}, + {"elepower_dynamics:electrum_plate", "elepower_dynamics:induction_coil_advanced", "elepower_dynamics:electrum_plate"}, {"elepower_dynamics:brass_plate", "elepower_machines:machine_block", "elepower_dynamics:brass_plate"}, - {"elepower_dynamics:electrum_plate", "elepower_dynamics:brass_plate", "elepower_dynamics:electrum_plate"}, + {"elepower_dynamics:electrum_plate", "elepower_dynamics:induction_coil_advanced", "elepower_dynamics:electrum_plate"}, } }) diff --git a/elepower_machines/machines/steam_turbine.lua b/elepower_machines/machines/steam_turbine.lua index 294bead..b0d7740 100644 --- a/elepower_machines/machines/steam_turbine.lua +++ b/elepower_machines/machines/steam_turbine.lua @@ -15,6 +15,7 @@ end ele.register_fluid_generator("elepower_machines:steam_turbine", { description = "Steam Turbine", ele_usage = 128, + ele_output = 128, tiles = { "elepower_machine_top.png^elepower_power_port.png", "elepower_machine_base.png", "elepower_machine_side.png", "elepower_machine_side.png", "elepower_turbine_side.png", "elepower_turbine_side.png", diff --git a/elepower_nuclear/crafting.lua b/elepower_nuclear/crafting.lua index 31eddb0..8a5c19f 100644 --- a/elepower_nuclear/crafting.lua +++ b/elepower_nuclear/crafting.lua @@ -69,6 +69,16 @@ minetest.register_craft({ } }) +-- Solar Neutron Activator +minetest.register_craft({ + output = "elepower_nuclear:solar_neutron_activator", + recipe = { + {"elepower_dynamics:hardened_glass", "elepower_dynamics:hardened_glass", "elepower_dynamics:hardened_glass"}, + {"elepower_dynamics:servo_valve", "elepower_nuclear:machine_block", "elepower_dynamics:portable_tank"}, + {"elepower_dynamics:brass_plate", "elepower_dynamics:copper_plate", "elepower_dynamics:brass_plate"}, + } +}) + -- Empty Fuel Rod minetest.register_craft({ output = "elepower_nuclear:fuel_rod_empty", diff --git a/elepower_nuclear/machines/enrichment_plant.lua b/elepower_nuclear/machines/enrichment_plant.lua index cfd6d8f..2b06368 100644 --- a/elepower_nuclear/machines/enrichment_plant.lua +++ b/elepower_nuclear/machines/enrichment_plant.lua @@ -25,6 +25,7 @@ end elepm.register_craft_type("enrichment", { description = "Enrichment", inputs = 1, + icon = "elenuclear_enrichment_plant.png", }) elepm.register_crafter("elepower_nuclear:enrichment_plant", { diff --git a/elepower_nuclear/machines/fission_reactor.lua b/elepower_nuclear/machines/fission_reactor.lua index 2752294..178d4bc 100644 --- a/elepower_nuclear/machines/fission_reactor.lua +++ b/elepower_nuclear/machines/fission_reactor.lua @@ -70,7 +70,7 @@ local function calculate_fitness(pos) return 100 - math.floor(100 * hu / nodes), hu end -local function fuel_after_depletion(inv) +local function fuel_after_depletion(inv, power) local fuel_count = 0 local change = false @@ -269,8 +269,9 @@ local function reactor_core_timer(pos) end end + -- Deplete fuel if power_setting > 0 then - fuel_reactor = fuel_after_depletion(inv) + fuel_reactor = fuel_after_depletion(inv, power_setting) if fuel_reactor == 0 then -- Enforce zero power setting when no fuel present power_setting = 0 @@ -284,19 +285,25 @@ local function reactor_core_timer(pos) local heat = meta:get_int("heat") -- Calculate heat - if hp < 75 and power_setting > 0 then - heat = heat + (math.floor(((100-(hp/100))*power_setting)) + 1) - elseif power_setting > 5 then + -- I dont really know what I'm doing here, just playing around with the numbers + -- to get something workable + if power_setting > 5 then local ceiling = math.floor(power_setting / 2) - if heat ~= ceiling then - if heat > ceiling then - heat = heat - 1 - else - heat = heat + fuel_reactor + if heat > ceiling and hp > 75 then + -- Remove heat when the heat goes above power setting and there's sufficient coolant + heat = heat + math.floor(((74 - hp)/2)/ceiling) + else + -- Heat up the reactor by the amount of fuel + -- If the reactor coolant is insufficient, add that factor to play + heat = heat + fuel_reactor + math.floor(80 * (1-(hp/100))) + + -- Catch up to the power setting + if heat < ceiling then + heat = heat + math.floor((ceiling - heat) / 2) end end elseif heat > 0 then - heat = heat - 1 + heat = heat + math.floor((-hp)/4) end if heat >= 100 then @@ -305,6 +312,10 @@ local function reactor_core_timer(pos) return false end + if heat < 0 then + heat = 0 + end + -- Nothing left to do in this timer, exit if power_setting == 0 and heat == 0 then meta:set_int("heat", heat) @@ -319,10 +330,13 @@ local function reactor_core_timer(pos) if fluid_port_node ~= nil and fluid_port_node.name == "elepower_nuclear:reactor_fluid_port" then local fpmeta = minetest.get_meta(fluid_port_pos) + -- Calculate how much heat is given to the fluid port + local burst_strength = math.max(math.floor((heat / 100) * 64), 1) + if fpmeta:get_int("burst") == 0 and heat > 0 then - fpmeta:set_int("burst", 1) + fpmeta:set_int("burst", burst_strength) minetest.get_node_timer(fluid_port_pos):start(1.0) - heat = heat - 1 + heat = heat - burst_strength end end @@ -425,7 +439,16 @@ local function reactor_port_timer(pos) if heat_burst > 0 then -- Convert a bucket of cold coolant into hot coolant - local coolant = math.min(cool.amount, 1000) + local heat_take = math.floor(cool.capacity * (heat_burst/100)) + local coolant = heat_take + if coolant > cool.amount then + coolant = cool.amount + end + + if hot.amount + coolant > hot.capacity and hot.amount < hot.capacity then + coolant = hot.capacity - hot.amount + end + if coolant > 0 and hot.amount + coolant < hot.capacity then meta:set_int("burst", 0) diff --git a/elepower_nuclear/machines/heat_exchanger.lua b/elepower_nuclear/machines/heat_exchanger.lua index 77ed3c4..56cccb8 100644 --- a/elepower_nuclear/machines/heat_exchanger.lua +++ b/elepower_nuclear/machines/heat_exchanger.lua @@ -18,7 +18,7 @@ end local heat_recipes = { ["elepower_nuclear:hot_coolant_source"] = { out = "elepower_nuclear:coolant_source", - factor = 1, + factor = 4, }, ["elepower_nuclear:helium_plasma"] = { out = "elepower_nuclear:helium", diff --git a/elepower_papi/machine.lua b/elepower_papi/machine.lua index bee7916..61f71d6 100644 --- a/elepower_papi/machine.lua +++ b/elepower_papi/machine.lua @@ -395,7 +395,7 @@ function ele.register_base_device(nodename, nodedef) -- Mesecons support if mc then nodedef["mesecons"] = mesecons_def - if nodedef.groups["state_machine"] ~= 0 then + if nodedef.states and nodedef.states["mesecons"] ~= false then nodedef.states["mesecons"] = true end end