From 1c2eac4e17354e02318832953a3c63d823aabef1 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: Fri, 6 Sep 2024 21:42:33 -0600 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Bokkiewokkie <43698041+Bokkiewokkie@users.noreply.github.com> --- .../ship_weapons/energy_weapons/phaser.dm | 123 ++++++++++-------- .../research/designs/ship_weapon_designs.dm | 6 +- .../modules/research/techweb/all_nsv_nodes.dm | 4 +- .../packages/tgui/interfaces/EnergyWeapons.js | 2 +- 4 files changed, 72 insertions(+), 63 deletions(-) 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 d630cc28985..a4c5a0b7e7f 100644 --- a/nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm +++ b/nsv13/code/modules/munitions/ship_weapons/energy_weapons/phaser.dm @@ -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() @@ -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) @@ -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, "You log [src] in the multitool's buffer.") - I.buffer = src - return TRUE - if(maint_state == MSTATE_UNSCREWED) - to_chat(user, "You must unbolt the protective casing before aligning the lenses!") - if(maint_state == MSTATE_UNBOLTED) - . = TRUE - to_chat(user, "You being aligning the lenses.") - 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, "You log [src] in the multitool's buffer.") + I.buffer = src + return TRUE + if(MSTATE_UNSCREWED) + to_chat(user, "You must unbolt the protective casing before aligning the lenses!") + return FALSE + if(MSTATE_UNBOLTED) + to_chat(user, "You being aligning the lenses.") + while(alignment < 100) + if(!do_after(user, 5, target = src)) + return ..() + alignment += rand(1,2) + if(alignment >= 100) + alignment = 100 + to_chat(user, "You finish aligning the lenses.") + return TRUE + return ..() diff --git a/nsv13/code/modules/research/designs/ship_weapon_designs.dm b/nsv13/code/modules/research/designs/ship_weapon_designs.dm index 1d9af9bfe4d..2516abee062 100644 --- a/nsv13/code/modules/research/designs/ship_weapon_designs.dm +++ b/nsv13/code/modules/research/designs/ship_weapon_designs.dm @@ -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 diff --git a/nsv13/code/modules/research/techweb/all_nsv_nodes.dm b/nsv13/code/modules/research/techweb/all_nsv_nodes.dm index 420ba531d79..08e543064bd 100644 --- a/nsv13/code/modules/research/techweb/all_nsv_nodes.dm +++ b/nsv13/code/modules/research/techweb/all_nsv_nodes.dm @@ -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" diff --git a/tgui/packages/tgui/interfaces/EnergyWeapons.js b/tgui/packages/tgui/interfaces/EnergyWeapons.js index 35c2834e06b..cdd658295dd 100644 --- a/tgui/packages/tgui/interfaces/EnergyWeapons.js +++ b/tgui/packages/tgui/interfaces/EnergyWeapons.js @@ -44,7 +44,7 @@ export const EnergyWeapons = (props, context) => {
Heat: