Skip to content

Commit

Permalink
venting work, makes the BSA exempt from Energy mechanics
Browse files Browse the repository at this point in the history
  • Loading branch information
Pockets-byte committed Jun 8, 2024
1 parent 20bd0ed commit 4f6492a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,10 @@
var/mob/living/goodbye = target
goodbye.dust(TRUE, FALSE)
explosion(get_turf(target), 6, 8, 9, 12, ignorecap = TRUE, flame_range = 6) //I have to keep myself from letting it just truncate ships because thats a bit annoying to fix for the receiving side, even if accurate to appearance.


/obj/machinery/ship_weapon/energy/beam/bsa/after_fire() //NT gets to cheat and have no degadation or heating on their weapon because muni has enough to do and the BSA doesn't need buffs/nerfs
. = ..()
heat = 0
alignment = 100
freq = 100
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
circuit = /obj/item/circuitboard/computer/laser_pd
var/obj/machinery/ship_weapon/energy/laser_pd/turret
var/gun_id = 0 // Used for map linkage
max_heat = 1000
heat_per_shot = 80
heat_rate = 30
storage_rate = 100

/obj/machinery/computer/laser_pd/Initialize(mapload)
..()
Expand Down Expand Up @@ -80,6 +76,11 @@
var/gunning_component_type = /datum/component/overmap_gunning/laser_pd
var/mob/gunner = null
var/gun_id = 0 // Used for map linkage
max_heat = 1000
heat_per_shot = 80
heat_rate = 30
storage_rate = 100


/obj/machinery/ship_weapon/energy/laser_pd/proc/start_gunning(mob/user)
if(gunner)
Expand Down
42 changes: 31 additions & 11 deletions nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define STATE(OVERLOAD) 3
#define STATE(VENTING) 2
#define STATE_OVERLOAD 2
#define STATE_VENTING 1
#define STATE_NOTHING 0
//#define STATE(ACTIVE) 1
//#define STATE(INACTIVE) 0 dunno how to adapt somem of these things right now

Expand Down Expand Up @@ -45,7 +46,7 @@
var/storage_amount = 0
heat_rate = 10
var/storage_rate = 100

var/state = STATE_NOTHING

/obj/machinery/ship_weapon/energy/beam
name = "phase cannon"
Expand Down Expand Up @@ -155,7 +156,9 @@
return FALSE
if(charge < charge_per_shot*shots) //Do we have enough ammo?
return FALSE
if(overloaded) //have we overheated?
if(state = STATE_OVERLOAD) //have we overheated?
return FALSE
if(state = STATE_VENTING) //are we venting heat?
return FALSE
if(freq <=10) //is the frequincy of the weapon high enough to fire?
overload()
Expand Down Expand Up @@ -184,7 +187,9 @@

/obj/machinery/ship_weapon/energy/process()
process_heat()
if(overloaded)
if(state = STATE_OVERLOAD)
return
if(state = STATE_VENTING)
return
charge_rate = initial(charge_rate) * power_modifier
max_charge = initial(max_charge) * power_modifier
Expand Down Expand Up @@ -241,18 +246,26 @@


/obj/machinery/ship_weapon/energy/proc/process_heat()//heat management. don't push your weapons too hard. actual heat generation is in _ship_weapons.dm

for(var/obj/machinery/cooling/cooler/C in coolers)
if(!(C.machine_stat & (BROKEN|NOPOWER|MAINT)))
cooling_amount++
for(var/obj/machinery/cooling/storage/C in storages)
if(!(C.machine_stat & (BROKEN|NOPOWER|MAINT)))
storage_amount++
max_heat = initial(max_heat) + (storage_amount*storage_rate)
var/H = heat-cooling_amount*heat_rate
if(heat > 0)
heat = max((heat-cooling_amount*heat_rate),0)
if(overloaded & (heat <= (max_heat/50)))
overloaded = 0
if(overloaded)
heat = max((H),0)
if((state = STATE_OVERLOAD) & (heat <= (max_heat/50)))
state = STATE_NOTHING
if(state = STATE_OVERLOAD)
return
if(state = STATE_VENTING)
if(heat <= max_heat-V)
state = STATE_NOTHING
return
heat = max(((H*1.2)-H),0)
return
if(heat >= max_heat)
overload()
Expand All @@ -262,7 +275,7 @@
playsound(src, malfunction_sound, 100, 1)
playsound(src, overheat_sound, 100, 1)
do_sparks(4, FALSE, src)
overloaded = 1
state = STATE_OVERLOAD
alignment = 0
freq = 0
say("WARNING! Critical heat density, emergency venting and shutdown initiated!")
Expand Down Expand Up @@ -364,4 +377,11 @@




/obj/machinery/ship_weapon/energy/proc/vent
. = ..()
if(max_heat > max_heat/4 )
state = STATE_VENTING
var/V = max_heat - 3(max_heat/4)
if(max_heat <= max_heat/4 )
var/V = max_heat
state = STATE_VENTING

0 comments on commit 4f6492a

Please sign in to comment.