Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bokkiewokkie <[email protected]>
  • Loading branch information
Pockets-byte and Bokkiewokkie authored Sep 7, 2024
1 parent 329b988 commit 1c2eac4
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 63 deletions.
123 changes: 66 additions & 57 deletions nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,18 @@
var/H = heat-cooling_amount*heat_rate
if(heat > 0)
heat = max((H),0)
if((weapon_state == STATE_OVERLOAD) & (heat <= (max_heat/50)))
weapon_state = STATE_NOTHING
if(weapon_state == STATE_OVERLOAD)
return
if(weapon_state == STATE_VENTING)
if(heat <= max_heat-ventnumber)
weapon_state = STATE_NOTHING
switch(weapon_state)
if(STATE_OVERLOAD)
if(heat <= (max_heat/50))
weapon_state = STATE_NOTHING
else
return
if(STATE_VENTING)
if(heat <= max_heat-ventnumber)
weapon_state = STATE_NOTHING
return
heat = max(H*0.2,0)
return
heat = max(((H*1.2)-H),0)
return
if(heat >= max_heat)
overload()

Expand All @@ -301,36 +303,41 @@
var/turf/detonation_turf = get_turf(src)
if(heat >= (3*(max_heat/4)))
freq -= rand(1,4)
if(alignment <= 75)
if(prob(50))
do_sparks(4, FALSE, src)
freq -= rand(1,10)
if(alignment <= 50)
if(prob(45))
do_sparks(4, FALSE, src)
freq -= rand(1,10)
playsound(src, malfunction_sound, 100, 1)
if(prob(5))
playsound(src, malfunction_sound, 100, 1)
freq -= rand(1,10)
explosion(detonation_turf, 0, 0, 2, 3, flame_range = 2)
if(alignment <= 25)
if(prob(25))
do_sparks(4, FALSE, src)
playsound(src, malfunction_sound, 100, 1)
freq -= rand(1,10)
if(prob(25))
playsound(src, malfunction_sound, 100, 1)
freq -= rand(1,10)
explosion(detonation_turf, 0, 0, 3, 4, flame_range = 3)
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:
P.range = 6
P.preparePixelProjectile(pick(shootat_turf), detonation_turf)
P.fire()
freq -= rand(1,10)
switch(alignment)
if(51 to 75)
if(prob(50))
do_sparks(4, FALSE, src)
freq -= rand(1,10)
if(26 to 50)
var/roll = roll(1,20)
switch(roll)
if(1 to 9)
do_sparks(4, FALSE, src)
freq -= rand(1,10)
playsound(src, malfunction_sound, 100, 1)
if(10)
playsound(src, malfunction_sound, 100, 1)
freq -= rand(1,10)
explosion(detonation_turf, 0, 0, 2, 3, flame_range = 2)
if(0 to 25)
var/roll2 = roll(1,4)
switch(roll2)
if(1)
do_sparks(4, FALSE, src)
playsound(src, malfunction_sound, 100, 1)
freq -= rand(1,10)
if(2)
playsound(src, malfunction_sound, 100, 1)
freq -= rand(1,10)
explosion(detonation_turf, 0, 0, 3, 4, flame_range = 3)
if(3,4)
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:
P.range = 6
P.preparePixelProjectile(pick(shootat_turf), detonation_turf)
P.fire()
freq -= rand(1,10)
alignment = max(alignment-(rand(0, 4)),0)


Expand Down Expand Up @@ -369,24 +376,26 @@
combo = null

/obj/machinery/ship_weapon/energy/multitool_act(mob/living/user, obj/item/multitool/I)
if(maint_state == MSTATE_CLOSED)
if (istype(I))
to_chat(user, "<span class='notice'>You log [src] in the multitool's buffer.</span>")
I.buffer = src
return TRUE
if(maint_state == MSTATE_UNSCREWED)
to_chat(user, "<span class='notice'>You must unbolt the protective casing before aligning the lenses!</span>")
if(maint_state == MSTATE_UNBOLTED)
. = TRUE
to_chat(user, "<span class='notice'>You being aligning the lenses.</span>")
while(alignment < 100)
if(!do_after(user, 5, target = src))
return
alignment += rand(1,2)
if(alignment >= 100)
alignment = 100
break

switch(maint_state)
if(MSTATE_CLOSED)
if(istype(I))
to_chat(user, "<span class='notice'>You log [src] in the multitool's buffer.</span>")
I.buffer = src
return TRUE
if(MSTATE_UNSCREWED)
to_chat(user, "<span class='notice'>You must <I>unbolt</I> the protective casing before aligning the lenses!</span>")
return FALSE
if(MSTATE_UNBOLTED)
to_chat(user, "<span class='notice'>You being aligning the lenses.</span>")
while(alignment < 100)
if(!do_after(user, 5, target = src))
return ..()
alignment += rand(1,2)
if(alignment >= 100)
alignment = 100
to_chat(user, "<span class='notice'>You finish aligning the lenses.</span>")
return TRUE
return ..()



Expand Down
6 changes: 3 additions & 3 deletions nsv13/code/modules/research/designs/ship_weapon_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,17 @@

//subspace cooling stuff
/datum/design/board/subspace_cooler
name = "Machine Design (Experemental Subspace Cooling Unit)"
name = "Machine Design (Experimental Subspace Cooling Unit)"
desc = "Allows for the construction of a Subspace Cooling Unit."
id = "subspace_cooler"
build_type = PROTOLATHE|IMPRINTER
materials = list(/datum/material/glass = 2000, /datum/material/copper = 2000, /datum/material/gold = 5000)
build_path = /obj/item/circuitboard/machine/cooling
build_path = /obj/item/circuitboard/machine/cooling/cooler
category = list("Advanced Munitions")
departmental_flags = DEPARTMENTAL_FLAG_MUNITIONS

/datum/design/board/subspace_storage
name = "Machine Design (Experemental Subspace Storage Unit)"
name = "Machine Design (Experimental Subspace Storage Unit)"
desc = "Allows for the construction of a Subspace Storage Unit."
id = "subspace_storage"
build_type = PROTOLATHE|IMPRINTER
Expand Down
4 changes: 2 additions & 2 deletions nsv13/code/modules/research/techweb/all_nsv_nodes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@
export_price = 5000

/// Munitions Upgrade for Energy Weapons
/datum/techweb_node/Weapon_Cooling
id = "Weapon_Cooling"
/datum/techweb_node/weapon_cooling
id = "weapon_cooling"
tech_tier = 4
display_name = "Subspace Manipulation"
description = "Experemental uses of subspace for more than just communications"
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/EnergyWeapons.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const EnergyWeapons = (props, context) => {
<br />
Heat:
<ProgressBar
value={(heat / maxheat * 100) * 0.01}
value={(heat / maxheat)}
ranges={{
good: [-Infinity, 0.2],
average: [0.2, 0.5],
Expand Down

0 comments on commit 1c2eac4

Please sign in to comment.