Skip to content

Commit

Permalink
AAAAAAAAAAAAAA
Browse files Browse the repository at this point in the history
  • Loading branch information
Pockets-byte committed Jun 5, 2024
1 parent ff8852a commit 05c6630
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 18 deletions.
100 changes: 100 additions & 0 deletions nsv13/code/game/machinery/thermalregulator.dm
Original file line number Diff line number Diff line change
@@ -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, "<span class='notice'>You must turn close the panel on [src] before turning it on.</span>")
return
to_chat(user, "<span class='notice'>You press [src]'s power button.</span>")
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
48 changes: 30 additions & 18 deletions nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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))
Expand All @@ -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
Expand All @@ -81,20 +87,21 @@
to_chat(user, "<span class='warning'>You inputted [dowhat] into the command sequence.</span>")
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, "<span class='warning'>Realignment of weapon energy direction matrix complete.</span>")
playsound(src, 'sound/machines/sm/supermatter1.ogg', 30, 1)
freq = max_freq
else
to_chat(user, "<span class='warning'>Realignment failed. Continued failure risks dangerous heat overload. Rotating command sequence.</span>")
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, "<span class='warning'>Realignment failed. Continued failure risks dangerous heat overload. Rotating command sequence.</span>")
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



Expand Down Expand Up @@ -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)))
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand All @@ -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, "<span class='warning'>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</span>") // stealing this from the plasmagun as well
explosion(detonation_turf, 0, 1, 3, 5, flame_range = 4)
heat += max_heat
..()
Expand Down

0 comments on commit 05c6630

Please sign in to comment.