|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
|
#define FUSION_ENERGY_PER_K 20
|
|
|
|
|
#define FUSION_MAX_ENVIRO_HEAT 5000 //raise this if you want the reactor to dump more energy into the atmosphere
|
|
|
|
|
#define PLASMA_TEMP_RADIATION_DIVISIOR 15 //radiation divisior. plasma temp / divisor = radiation.
|
|
|
|
|
#define PLASMA_TEMP_RADIATION_DIVISIOR 20 //radiation divisior. plasma temp / divisor = radiation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/obj/effect/fusion_em_field
|
|
|
|
|
name = "electromagnetic field"
|
|
|
|
@@ -19,6 +20,8 @@
|
|
|
|
|
var/tick_instability = 0
|
|
|
|
|
var/percent_unstable = 0
|
|
|
|
|
var/stable = 1
|
|
|
|
|
var/id_tag
|
|
|
|
|
var/critical = 0
|
|
|
|
|
|
|
|
|
|
var/obj/machinery/power/fusion_core/owned_core
|
|
|
|
|
var/list/dormant_reactant_quantities = list()
|
|
|
|
@@ -31,7 +34,8 @@
|
|
|
|
|
/obj/structure/cable,
|
|
|
|
|
/obj/machinery/atmospherics,
|
|
|
|
|
/obj/machinery/air_sensor,
|
|
|
|
|
/mob/observer/dead
|
|
|
|
|
/mob/observer/dead,
|
|
|
|
|
/obj/machinery/power/hydromagnetic_trap
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var/light_min_range = 2
|
|
|
|
@@ -52,7 +56,7 @@
|
|
|
|
|
owned_core = new_owned_core
|
|
|
|
|
if(!owned_core)
|
|
|
|
|
qdel(src)
|
|
|
|
|
|
|
|
|
|
id_tag = owned_core.id_tag
|
|
|
|
|
//create the gimmicky things to handle field collisions
|
|
|
|
|
var/obj/effect/fusion_particle_catcher/catcher
|
|
|
|
|
|
|
|
|
@@ -194,37 +198,46 @@
|
|
|
|
|
if(percent_unstable >= 1)
|
|
|
|
|
owned_core.Shutdown(force_rupture=1)
|
|
|
|
|
else
|
|
|
|
|
if(percent_unstable > 0.5 && prob(percent_unstable*100))
|
|
|
|
|
if(percent_unstable > 0.1 && prob(percent_unstable*100))
|
|
|
|
|
if(plasma_temperature < 2000)
|
|
|
|
|
visible_message("<span class='danger'>\The [src] ripples uneasily, like a disturbed pond.</span>")
|
|
|
|
|
else
|
|
|
|
|
var/flare
|
|
|
|
|
var/fuel_loss
|
|
|
|
|
var/rupture
|
|
|
|
|
if(percent_unstable < 0.2)
|
|
|
|
|
if(percent_unstable > 0.2)
|
|
|
|
|
visible_message("<span class='danger'>\The [src] ripples uneasily, like a disturbed pond.</span>")
|
|
|
|
|
fuel_loss = prob(5)
|
|
|
|
|
flare = prob(50)
|
|
|
|
|
else if(percent_unstable < 0.9)
|
|
|
|
|
flare = prob(25)
|
|
|
|
|
else if(percent_unstable > 0.5)
|
|
|
|
|
visible_message("<span class='danger'>\The [src] undulates violently, shedding plumes of plasma!</span>")
|
|
|
|
|
flare = prob(50)
|
|
|
|
|
fuel_loss = prob(20)
|
|
|
|
|
rupture = prob(5)
|
|
|
|
|
else
|
|
|
|
|
else if(percent_unstable > 0.8)
|
|
|
|
|
visible_message("<span class='danger'>\The [src] is wracked by a series of horrendous distortions, buckling and twisting like a living thing!</span>")
|
|
|
|
|
flare = 1
|
|
|
|
|
fuel_loss = prob(50)
|
|
|
|
|
rupture = prob(25)
|
|
|
|
|
|
|
|
|
|
if(rupture)
|
|
|
|
|
owned_core.Shutdown(force_rupture=1)
|
|
|
|
|
if(prob(80))
|
|
|
|
|
MagneticQuench()
|
|
|
|
|
return
|
|
|
|
|
else if(prob(15))
|
|
|
|
|
MRC()
|
|
|
|
|
return
|
|
|
|
|
else if(prob(5))
|
|
|
|
|
QuantumFluxCascade()
|
|
|
|
|
return
|
|
|
|
|
else if(prob(5))
|
|
|
|
|
BluespaceQuenchEvent()
|
|
|
|
|
return
|
|
|
|
|
else
|
|
|
|
|
var/lost_plasma = (plasma_temperature*percent_unstable)
|
|
|
|
|
radiation += lost_plasma
|
|
|
|
|
if(flare)
|
|
|
|
|
radiation += plasma_temperature/2
|
|
|
|
|
plasma_temperature -= lost_plasma
|
|
|
|
|
|
|
|
|
|
spawn(1)
|
|
|
|
|
emflare()
|
|
|
|
|
if(fuel_loss)
|
|
|
|
|
for(var/particle in dormant_reactant_quantities)
|
|
|
|
|
var/lost_fuel = dormant_reactant_quantities[particle]*percent_unstable
|
|
|
|
@@ -234,17 +247,19 @@
|
|
|
|
|
dormant_reactant_quantities.Remove(particle)
|
|
|
|
|
Radiate()
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
/obj/effect/fusion_em_field/proc/Rupture()
|
|
|
|
|
visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>")
|
|
|
|
|
set_light(15, 15, "#CCCCFF")
|
|
|
|
|
empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
|
|
|
|
sleep(5)
|
|
|
|
|
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
|
|
|
|
|
RadiateAll()
|
|
|
|
|
explosion(get_turf(owned_core),-1,-1,8,10) // Blow out all the windows.
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
/*/obj/effect/fusion_em_field/proc/CheckCriticality()
|
|
|
|
|
if (plasma_temperature > 70000)
|
|
|
|
|
critical += 0.2
|
|
|
|
|
else if (instability > 0.45)
|
|
|
|
|
critical += 0.6
|
|
|
|
|
if(critical >= 25 && prob(percent_unstable*100))
|
|
|
|
|
if (critical >= 90)
|
|
|
|
|
visible_message("<span class='danger'>\The [src] rumbles and quivers violently, threatening to break free!</span>")
|
|
|
|
|
else if(critical >= 50)
|
|
|
|
|
visible_message("<span class='danger'>\The [src] rumbles and quivers energetically, the walls distorting slightly.</span>")
|
|
|
|
|
else if(critical >= 25)
|
|
|
|
|
visible_message("<span class='danger'>\The [src] rumbles and quivers slightly, vibrating the deck.</span>")
|
|
|
|
|
*/
|
|
|
|
|
/obj/effect/fusion_em_field/proc/ChangeFieldStrength(var/new_strength)
|
|
|
|
|
var/calc_size = 1
|
|
|
|
|
if(new_strength <= 50)
|
|
|
|
@@ -490,19 +505,19 @@
|
|
|
|
|
//All procs below this point are called in _core.dm, starting at line 41.
|
|
|
|
|
//Stability monitoring. Gives radio annoucements if field stability is below 80%
|
|
|
|
|
/obj/effect/fusion_em_field/proc/stability_monitor()
|
|
|
|
|
var/warnpoint = 0.10
|
|
|
|
|
var/warnpoint = 0.10 //start warning at 10% instability
|
|
|
|
|
var/warnmessage = "Warning! Field unstable! Instability at [percent_unstable * 100]%, plasma temperature at [plasma_temperature + 295]k."
|
|
|
|
|
var/stablemessage = "Containment field returning to stable conditions."
|
|
|
|
|
|
|
|
|
|
if(percent_unstable >= warnpoint)
|
|
|
|
|
if(percent_unstable >= warnpoint) //we're unstable, start warning engineering
|
|
|
|
|
global_announcer.autosay(warnmessage, "Field Stability Monitor", "Engineering")
|
|
|
|
|
stable = 0
|
|
|
|
|
sleep(20 SECONDS)
|
|
|
|
|
return
|
|
|
|
|
if(percent_unstable < warnpoint && stable == 0)
|
|
|
|
|
stable = 0 //we know we're not stable, so let's not state the safe message.
|
|
|
|
|
sleep(20)
|
|
|
|
|
return
|
|
|
|
|
if(percent_unstable < warnpoint && stable == 0) //The field is stable again. Let's set our safe variable and state the safe message.
|
|
|
|
|
global_announcer.autosay(stablemessage, "Field Stability Monitor", "Engineering")
|
|
|
|
|
stable = 1
|
|
|
|
|
return
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
//Reaction radiation is fairly buggy and there's at least three procs dealing with radiation here, this is to ensure constant radiation output.
|
|
|
|
|
/obj/effect/fusion_em_field/proc/radiation_scale()
|
|
|
|
@@ -513,7 +528,8 @@
|
|
|
|
|
if(owned_core && owned_core.loc)
|
|
|
|
|
var/datum/gas_mixture/environment = owned_core.loc.return_air()
|
|
|
|
|
if(environment && environment.temperature < (T0C+FUSION_MAX_ENVIRO_HEAT))
|
|
|
|
|
environment.add_thermal_energy(plasma_temperature*20000)
|
|
|
|
|
environment.add_thermal_energy(plasma_temperature*5000)
|
|
|
|
|
check_instability()
|
|
|
|
|
|
|
|
|
|
//Temperature changes depending on color.
|
|
|
|
|
/obj/effect/fusion_em_field/proc/temp_color()
|
|
|
|
@@ -538,8 +554,121 @@
|
|
|
|
|
light_max_range = 5
|
|
|
|
|
light_max_power = 5
|
|
|
|
|
return
|
|
|
|
|
//moved the flare to a proc for various reasons. Called on line 225.
|
|
|
|
|
/obj/effect/fusion_em_field/proc/emflare()
|
|
|
|
|
radiation += plasma_temperature/2
|
|
|
|
|
light_color = "#ff0000"
|
|
|
|
|
light_max_power = 30
|
|
|
|
|
light_min_power = 30
|
|
|
|
|
light_min_range = 30
|
|
|
|
|
light_max_range = 30
|
|
|
|
|
visible_message("<span class='danger'>\The [src] flares to eye-searing brightness!</span>")
|
|
|
|
|
sleep(60)
|
|
|
|
|
temp_color()
|
|
|
|
|
//plasma_temperature -= lost_plasma
|
|
|
|
|
return
|
|
|
|
|
//Rupture() is no longer the end all be all. Fear the magnetic resonance cascade and quantum flux cascade
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/obj/effect/fusion_em_field/proc/Rupture()
|
|
|
|
|
visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>")
|
|
|
|
|
set_light(15, 15, "#CCCCFF")
|
|
|
|
|
empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
|
|
|
|
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
|
|
|
|
|
RadiateAll()
|
|
|
|
|
var/list/things_in_range = range(10, owned_core)
|
|
|
|
|
var/list/turfs_in_range = list()
|
|
|
|
|
var/turf/T
|
|
|
|
|
for (T in things_in_range)
|
|
|
|
|
turfs_in_range.Add(T)
|
|
|
|
|
|
|
|
|
|
explosion(pick(things_in_range), -1, 5, 5, 5)
|
|
|
|
|
empulse(pick(things_in_range), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
|
|
|
|
spawn(25)
|
|
|
|
|
explosion(pick(things_in_range), -1, 5, 5, 5)
|
|
|
|
|
spawn(25)
|
|
|
|
|
explosion(pick(things_in_range), -1, 5, 5, 5)
|
|
|
|
|
spawn(25)
|
|
|
|
|
explosion(pick(things_in_range), -1, 5, 5, 5)
|
|
|
|
|
spawn(10)
|
|
|
|
|
explosion(pick(things_in_range), -1, 5, 5, 5)
|
|
|
|
|
spawn(10)
|
|
|
|
|
explosion(pick(things_in_range), -1, 5, 5, 5)
|
|
|
|
|
spawn(10)
|
|
|
|
|
explosion(pick(things_in_range), -1, 5, 5, 5)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
/obj/effect/fusion_em_field/proc/MRC() //spews electromagnetic pulses in an area around the core.
|
|
|
|
|
visible_message("<span class='danger'>\The [src] glows an extremely bright pink and flares out of existance!</span>")
|
|
|
|
|
global_announcer.autosay("Warning! Magnetic Resonance Cascade detected! Brace for electronic system distruption.", "Field Stability Monitor")
|
|
|
|
|
set_light(15, 15, "#ff00d8")
|
|
|
|
|
var/list/things_in_range = range(15, owned_core)
|
|
|
|
|
var/list/turfs_in_range = list()
|
|
|
|
|
var/turf/T
|
|
|
|
|
for (T in things_in_range)
|
|
|
|
|
turfs_in_range.Add(T)
|
|
|
|
|
for(var/loopcount = 1 to 10)
|
|
|
|
|
spawn(200)
|
|
|
|
|
empulse(pick(things_in_range), 10, 15)
|
|
|
|
|
Destroy()
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
/obj/effect/fusion_em_field/proc/QuantumFluxCascade() //spews hot phoron and oxygen in a radius around the RUST. Will probably set fire to things
|
|
|
|
|
global_announcer.autosay("Warning! Quantum fluxuation detected! Flammable gas release expected.", "Field Stability Monitor")
|
|
|
|
|
var/list/things_in_range = range(15, owned_core)
|
|
|
|
|
var/list/turfs_in_range = list()
|
|
|
|
|
var/turf/T
|
|
|
|
|
for (T in things_in_range)
|
|
|
|
|
turfs_in_range.Add(T)
|
|
|
|
|
for(var/loopcount = 1 to 10)
|
|
|
|
|
var/turf/TT = get_turf(pick(turfs_in_range))
|
|
|
|
|
if(istype(TT))
|
|
|
|
|
var/datum/gas_mixture/plasma = new
|
|
|
|
|
plasma.adjust_gas("oxygen", (size*100), 0)
|
|
|
|
|
plasma.adjust_gas("phoron", (size*100), 0)
|
|
|
|
|
plasma.temperature = (plasma_temperature/2)
|
|
|
|
|
plasma.update_values()
|
|
|
|
|
TT.assume_air(plasma)
|
|
|
|
|
TT.hotspot_expose(plasma_temperature)
|
|
|
|
|
plasma = null
|
|
|
|
|
Destroy()
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
/obj/effect/fusion_em_field/proc/MagneticQuench() //standard hard shutdown. dumps hot oxygen/phoron into the core's area and releases an EMP in the area around the core.
|
|
|
|
|
global_announcer.autosay("Warning! Magnetic Quench event detected, engaging hard shutdown.", "Field Stability Monitor")
|
|
|
|
|
empulse(owned_core, 10, 15)
|
|
|
|
|
var/turf/TT = get_turf(owned_core)
|
|
|
|
|
if(istype(TT))
|
|
|
|
|
var/datum/gas_mixture/plasma = new
|
|
|
|
|
plasma.adjust_gas("oxygen", (size*100), 0)
|
|
|
|
|
plasma.adjust_gas("phoron", (size*100), 0)
|
|
|
|
|
plasma.temperature = (plasma_temperature/2)
|
|
|
|
|
plasma.update_values()
|
|
|
|
|
TT.assume_air(plasma)
|
|
|
|
|
TT.hotspot_expose(plasma_temperature)
|
|
|
|
|
plasma = null
|
|
|
|
|
Destroy()
|
|
|
|
|
owned_core.Shutdown()
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
/obj/effect/fusion_em_field/proc/BluespaceQuenchEvent() //!!FUN!! causes a number of explosions in an area around the core. Will likely destory or heavily damage the reactor.
|
|
|
|
|
visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>")
|
|
|
|
|
set_light(15, 15, "#CCCCFF")
|
|
|
|
|
empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
|
|
|
|
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
|
|
|
|
|
RadiateAll()
|
|
|
|
|
var/list/things_in_range = range(10, owned_core)
|
|
|
|
|
var/list/turfs_in_range = list()
|
|
|
|
|
var/turf/T
|
|
|
|
|
for (T in things_in_range)
|
|
|
|
|
turfs_in_range.Add(T)
|
|
|
|
|
for(var/loopcount = 1 to 10)
|
|
|
|
|
explosion(pick(things_in_range), -1, 5, 5, 5)
|
|
|
|
|
empulse(pick(things_in_range), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
|
|
|
|
Destroy()
|
|
|
|
|
owned_core.Shutdown()
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
#undef FUSION_HEAT_CAP
|
|
|
|
|
#undef FUSION_MAX_ENVIRO_HEAT
|
|
|
|
|
#undef PLASMA_TEMP_RADIATION_DIVISIOR
|