From 05c66303f20607a6a5aaf4571a01656bc7e4355b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=9B=88=E1=9B=9F=E1=9A=B2=E1=9A=B2=E1=9B=96=E1=9B=8F?= =?UTF-8?q?=E1=9B=8B?= <55299415+Pockets-byte@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:24:41 -0600 Subject: [PATCH] AAAAAAAAAAAAAA --- nsv13/code/game/machinery/thermalregulator.dm | 100 ++++++++++++++++++ .../ship_weapons/energy_weapons/phaser.dm | 48 +++++---- 2 files changed, 130 insertions(+), 18 deletions(-) create mode 100644 nsv13/code/game/machinery/thermalregulator.dm diff --git a/nsv13/code/game/machinery/thermalregulator.dm b/nsv13/code/game/machinery/thermalregulator.dm new file mode 100644 index 00000000000..b3f788c7ebd --- /dev/null +++ b/nsv13/code/game/machinery/thermalregulator.dm @@ -0,0 +1,100 @@ +#define COOLANT_INPUT_GATE airs[1] +#define COOLANT_OUTPUT_GATE airs[2] + +/obj/machinery/atmospherics/components/binary/thermal_regulator + name = "thermal regulator" + desc = "The heat regulator that helps cool energy weapons" + icon = 'nsv13/icons/obj/machinery/reactor_parts.dmi' + icon_state = "plasma_condenser" + pixel_y = 5 //So it lines up with layer 3 piping + layer = OBJ_LAYER + density = TRUE + dir = WEST + initialize_directions = WEST + pipe_flags = PIPING_ONE_PER_TURF + active_power_usage = 200 + var/obj/machinery/ship_weapon/energy/linked_gun + var/temperature = 0 + var/gas_absorption_effectiveness = 0.5 + var/gas_absorption_constant = 0.5 + var/last_coolant_temperature = 0 + var/last_output_temperature = 0 + var/last_heat_delta = 0 + +/obj/machinery/atmospherics/components/binary/thermal_regulator/on_construction() + var/obj/item/circuitboard/machine/thermomachine/board = circuit + if(board) + piping_layer = board.pipe_layer + ..(dir, piping_layer) + +/obj/machinery/atmospherics/components/binary/thermal_regulator/attack_hand(mob/user) + . = ..() + if(panel_open) + to_chat(user, "You must turn close the panel on [src] before turning it on.") + return + to_chat(user, "You press [src]'s power button.") + on = !on + update_icon() + +/obj/machinery/atmospherics/components/binary/thermal_regulator/update_icon() + cut_overlays() + if(panel_open) + icon_state = "plasma_condenser_screw" + else if(on) + icon_state = "plasma_condenser_active" + else + icon_state = "plasma_condenser" + +/obj/machinery/atmospherics/components/binary/thermal_regulator/ComponentInitialize() + . = ..() + AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ) + gas_absorption_effectiveness = rand(5, 6)/10 //All reactors are slightly different. This will result in you having to figure out what the balance is for K. + gas_absorption_constant = gas_absorption_effectiveness //And set this up for the rest of the round. + +/obj/machinery/atmospherics/components/binary/thermal_regulator/process() + update_parents() //Update the pipenet to register new gas mixes + if(next_slowprocess < world.time) + slowprocess() + next_slowprocess = world.time + 1 SECONDS + +/obj/machinery/atmospherics/components/binary/thermal_regulator/process_atmos() + ..() + if(!on) + return + if(!linked_gun) + return + + + + + +/obj/machinery/atmospherics/components/binary/thermal_regulator/proc/slowprocess() + ..() + if(!on) + return + if(!linked_gun) + return + + //Let's get our gasses sorted out. + var/datum/gas_mixture/coolant_input = COOLANT_INPUT_GATE + var/datum/gas_mixture/coolant_output = COOLANT_OUTPUT_GATE + + temperature = linked_gun.heat + + //Firstly, heat up the reactor based off of K. + var/input_moles = coolant_input.total_moles() //Firstly. Do we have enough moles of coolant? + if(input_moles >= minimum_coolant_level) + last_coolant_temperature = KELVIN_TO_CELSIUS(coolant_input.return_temperature()) + //Important thing to remember, once you slot in the fuel rods, this thing will not stop making heat, at least, not unless you can live to be thousands of years old which is when the spent fuel finally depletes fully. + var/heat_delta = (KELVIN_TO_CELSIUS(coolant_input.return_temperature()) / 100) * gas_absorption_effectiveness //Take in the gas as a cooled input, cool the reactor a bit. The optimum, 100% balanced reaction sits at K=1, coolant input temp of 200K / -73 celsius. + last_heat_delta = heat_delta + temperature += heat_delta + coolant_output.merge(coolant_input) //And now, shove the input into the output. + coolant_input.clear() //Clear out anything left in the input gate. + + + //Now, heat up the output and set our pressure. + coolant_output.set_temperature(CELSIUS_TO_KELVIN(temperature)) //Heat the coolant output gas that we just had pass through us. + last_output_temperature = KELVIN_TO_CELSIUS(coolant_output.return_temperature()) + + heat = linked_gun.heat diff --git a/nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm b/nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm index c56e255b294..ee74623a87c 100644 --- a/nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm +++ b/nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm @@ -24,6 +24,8 @@ var/alignment = 100 //stolen from railguns and the plasma gun var/freq = 100 max_heat = 5000 + max_integrity = 1200 //don't blow up before we're ready + obj_integrity = 1200 heat_per_shot = 300 heat_rate = 100 var/max_freq = 100 @@ -32,10 +34,9 @@ var/combo = null var/combocount = 0 //How far into the combo are they? var/overheat_sound = 'sound/effects/smoke.ogg' + var/obj/machinery/atmospherics/components/binary/thermal_regulator/regulator + -/obj/machinery/ship_weapon/energy/Initialize() - . = ..() - combo_target = "[pick(letters)][pick(letters)][pick(letters)][pick(letters)][pick(letters)]" //actually making the random sequince /obj/machinery/ship_weapon/energy/beam @@ -54,6 +55,12 @@ heat_rate = 100 +/obj/machinery/ship_weapon/energy/Initialize() + . = ..() + combo_target = "[pick(letters)][pick(letters)][pick(letters)][pick(letters)][pick(letters)]" //actually making the random sequince + regulator = locate(/obj/machinery/atmospherics/components/binary/thermal_regulator) in orange(1, src) + regulator.linked_gun = src + /obj/machinery/ship_weapon/energy/examine(mob/user) . = ..() if(in_range(user, src) || isobserver(user)) @@ -72,7 +79,6 @@ var/list/options = letters for(var/option in options) options[option] = image(icon = 'nsv13/icons/actions/engine_actions.dmi', icon_state = "[option]") - Repeat var/dowhat = show_radial_menu(user,src,options) if(!dowhat) return @@ -81,20 +87,21 @@ to_chat(user, "You inputted [dowhat] into the command sequence.") playsound(src, 'sound/machines/sm/supermatter3.ogg', 20, 1) if(combocount <= 4) - goto Repeat -// addtimer(CALLBACK(src, .proc/attack_self, user), 2) I don't have a CLUE how to fix this + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom,screwdriver_act ),2)) // *scream addtimer(CALLBACK(object|null, GLOBAL_PROC_REF(type/path|procstring), arg1, arg2, ... argn), time, timertype) if(combocount >= 5) //Completed the sequence if(combo == combo_target) to_chat(user, "Realignment of weapon energy direction matrix complete.") playsound(src, 'sound/machines/sm/supermatter1.ogg', 30, 1) freq = max_freq - else - to_chat(user, "Realignment failed. Continued failure risks dangerous heat overload. Rotating command sequence.") - playsound(src, 'nsv13/sound/effects/warpcore/overload.ogg', 100, 1) - combo_target = "[pick(letters)][pick(letters)][pick(letters)][pick(letters)][pick(letters)]" - heat =max(heat+(heat_per_shot*4),max_heat) //Penalty for fucking it up. You risk destroying the crystal... //well... actually overheating the gun - combocount = 0 - combo = null + combo = null + combocount = 0 + else + to_chat(user, "Realignment failed. Continued failure risks dangerous heat overload. Rotating command sequence.") + playsound(src, 'nsv13/sound/effects/warpcore/overload.ogg', 100, 1) + combo_target = "[pick(letters)][pick(letters)][pick(letters)][pick(letters)][pick(letters)]" + heat =max(heat+(heat_per_shot*4),max_heat) //Penalty for fucking it up. You risk destroying the crystal... //well... actually overheating the gun + combocount = 0 + combo = null @@ -195,7 +202,7 @@ P.damage *= power_modifier P.damage *= (freq/100) -/obj/machinery/ship_weapon/energy/process() +/obj/machinery/ship_weapon/energy/process() //heat overload management. don't push your weapons too hard. actual heat generation is in _ship_weapons.dm if(heat > 0) heat = max(heat-heat_rate, 0) if(overloaded & (heat <= (max_heat/50))) @@ -209,7 +216,8 @@ overloaded = 1 alignment = 0 freq = 0 - (atmos_spawn_air("h2o=1000;TEMP=1000")) + say("WARNING! Critical heat density, emergency venting and shutdown initiated!") + atmos_spawn_air("water_vapor=150;TEMP=1000") heat = max_heat return charge_rate = initial(charge_rate) * power_modifier @@ -245,11 +253,11 @@ do_sparks(4, FALSE, src) freq -= rand(1,10) if(alignment <= 50) - if(prob(25)) + if(prob(45)) do_sparks(4, FALSE, src) freq -= rand(1,10) playsound(src, malfunction_sound, 100, 1) - if(prob(25)) + if(prob(5)) playsound(src, malfunction_sound, 100, 1) freq -= rand(1,10) explosion(detonation_turf, 0, 0, 2, 3, flame_range = 2) @@ -262,7 +270,7 @@ playsound(src, malfunction_sound, 100, 1) freq -= rand(1,10) explosion(detonation_turf, 0, 0, 3, 4, flame_range = 3) - if(prob(25)) + if(prob(50)) var/list/shootat_turf = RANGE_TURFS(5,detonation_turf) - RANGE_TURFS(4, detonation_turf) var/obj/item/projectile/beam/laser/P = new(detonation_turf) //Shooting Code: @@ -272,6 +280,10 @@ freq -= rand(1,10) alignment = max(alignment-(rand(0, 8)),0) if(alignment == 0) + for(var/mob/living/M in get_hearers_in_view(7, src)) //burn out eyes in view + if(M.stat != DEAD && M.get_eye_protection() < 2) //checks for eye protec + M.flash_act(10) + to_chat(M, "You have a second to watch the casing of the gun glow a dull red before it erupts in a blinding flash as it self-destructs") // stealing this from the plasmagun as well explosion(detonation_turf, 0, 1, 3, 5, flame_range = 4) heat += max_heat ..()