Fission reactor parameters play-around, other tweaks

This commit is contained in:
Evert Prants 2019-01-22 17:07:04 +02:00
parent f47aeeda7d
commit 1b4453fae3
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
8 changed files with 54 additions and 19 deletions

View File

@ -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},

View File

@ -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"},
}
})

View File

@ -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",

View File

@ -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",

View File

@ -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", {

View File

@ -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)

View File

@ -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",

View File

@ -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