From 3ed5bf4ec76179d6dedf3ce57cb7d62cbeabb7f1 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 19:01:37 -0600 Subject: [PATCH 01/19] Adds an achievement for setting up some solars as Engineer --- code/datums/achievements/achievements.dm | 9 +++++++++ code/modules/power/solar.dm | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index 26b13ea155ef..552aeb55305f 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -3,6 +3,7 @@ //TO BE HONEST THIS OFFSET DOESN'T EVEN NEED TO BE POWER OF TWO, THOUGH. #define GREENTEXT 256 // An offset for new greentext-related achievements, to keep the incremental pattern. #define REDTEXT 512 // Offset for redtexts. +#define ENGINEERING 768 // Offset for engineering-related achievements. /datum/achievement var/name = "achievement" @@ -240,5 +241,13 @@ hidden = TRUE //end-redtext +//start-engineering +/datum/achievement/engineering/solar + name = "Honest Work" + desc = "Set up one of the solar arrays as part of the Engineering team." + id = ENGINEERING + 2 +//end-engineering + #undef GREENTEXT #undef REDTEXT +#undef ENGINEERING \ No newline at end of file diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 9316a145251a..94ac64e8eb2e 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -273,6 +273,7 @@ var/nexttime = 0 // time for a panel to rotate of 1 degree in manual tracking var/obj/machinery/power/tracker/connected_tracker = null var/list/connected_panels = list() + var/mob/living/carbon/human/last_user // The last guy to open up the console /obj/machinery/power/solar_control/Initialize() . = ..() @@ -344,6 +345,8 @@ if(!ui) ui = new(user, src, ui_key, "solar_control", name, 380, 230, master_ui, state) ui.open() + if(ishuman(user)) + last_user = user /obj/machinery/power/solar_control/ui_data() var/data = list() @@ -398,7 +401,11 @@ set_panels(targetdir) return TRUE if(action == "refresh") + var/was_not_connected = !(connected_tracker && connected_panels.len) search_for_connected() + if(was_not_connected && connected_tracker && connected_panels.len) // If this guy finished up the solars + if(!(last_user.stat == DEAD) && (last_user?.mind.assigned_role in GLOB.engineering_positions)) // and he's an engineer who isn't long-dead or adminbussing + SSachievements.unlock_achievement(/datum/achievement/engineering/solar, last_user.client) // Give him the achievement if(connected_tracker && track == 2) connected_tracker.set_angle(SSsun.angle) set_panels(currentdir) From 011f7f969e44ac352e06494786bcc9b730d8eaf4 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 19:02:28 -0600 Subject: [PATCH 02/19] Makes emagging the PA an engineering-type achievement This is a surprise tool that will help us later! --- code/datums/achievements/achievements.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index 552aeb55305f..47afc99eb4c1 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -26,7 +26,7 @@ desc = "Successfully defibrillate someone" id = 3 -/datum/achievement/pa_emag //Should be hidden but that's not a thing yet +/datum/achievement/engineering/pa_emag name = "Catastrophe" desc = "Emag a Particle Accelerator" id = 4 From 0e73a996bcbcd2588ef52d742ad84fb45166c702 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 20:14:18 -0600 Subject: [PATCH 03/19] Fixes compiletime with PA emag achievement --- .../power/singularity/particle_accelerator/particle_control.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yogstation/code/modules/power/singularity/particle_accelerator/particle_control.dm b/yogstation/code/modules/power/singularity/particle_accelerator/particle_control.dm index 64b7b68c32d4..0ec34ca74ed2 100644 --- a/yogstation/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/yogstation/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -5,7 +5,7 @@ if(obj_flags & EMAGGED) return to_chat(user, "The laws of physics no longer apply in the future, god help you...") - SSachievements.unlock_achievement(/datum/achievement/pa_emag, user.client) + SSachievements.unlock_achievement(/datum/achievement/engineering/pa_emag, user.client) do_sparks(5, 0, src) obj_flags |= EMAGGED From 01e949c01d19fb6f11c680fee8572fd72fba3e9d Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 20:15:35 -0600 Subject: [PATCH 04/19] Adds new achieve for CEs getting 3 MW on a station powernet A lot of shit had to happen in order to make this work. I had to add a new specification to powernets to mark what Z-level they exist on, to ensure that I only scan powernets that're on the station Z-level. Additionally, SSachievements now is SS_BACKGROUND instead of SS_NO_FIRE, since I didn't want to have this CE achievement bullshit happen in the middle of the very important SSmachine tick. --- code/controllers/subsystem/achievements.dm | 20 +++++++++++++++++++- code/controllers/subsystem/machines.dm | 4 ++-- code/datums/achievements/achievements.dm | 4 ++++ code/modules/power/cable.dm | 16 ++++++++-------- code/modules/power/powernet.dm | 4 +++- 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/code/controllers/subsystem/achievements.dm b/code/controllers/subsystem/achievements.dm index 2119f9c2e20c..69bce336ad71 100644 --- a/code/controllers/subsystem/achievements.dm +++ b/code/controllers/subsystem/achievements.dm @@ -1,10 +1,11 @@ SUBSYSTEM_DEF(achievements) name = "Achievements" - flags = SS_NO_FIRE + flags = SS_BACKGROUND var/list/achievements = list() var/list/cached_achievements = list() var/list/browsers = list() var/list/achievementsEarned = list() + var/mob/living/carbon/human/CE // The current guy that SSachievements believes to be the CE. /datum/controller/subsystem/achievements/Initialize(timeofday) for(var/i in subtypesof(/datum/achievement)) @@ -47,6 +48,23 @@ SUBSYSTEM_DEF(achievements) qdel(ridOldChieves) return ..() +/datum/controller/subsystem/achievements/fire(resumed) + //The solar panel achievement + if(!CE) + for(var/x in GLOB.player_list) + if(ishuman(x)) + var/mob/living/carbon/human/H = x + if(H?.mind.assigned_role == "Chief Engineer") + CE = H + break + else + for(var/n in SSmachines.powernets) + var/datum/powernet/net = n + if(net.z == 2) // If the powernet is on the station z-level + if(net.avail == 3000 && CE.stat != DEAD && CE.client) // If there's 3 MW available (Value is in kW) + unlock_achievement(/datum/achievement/engineering/scotty, CE.client) + +//Ad-hoc procs /datum/controller/subsystem/achievements/proc/unlock_achievement(achievementPath, client/C) var/datum/achievement/achievement = get_achievement(achievementPath) if(!achievement) diff --git a/code/controllers/subsystem/machines.dm b/code/controllers/subsystem/machines.dm index c4b09d1b8741..8ebe7b4eedb8 100644 --- a/code/controllers/subsystem/machines.dm +++ b/code/controllers/subsystem/machines.dm @@ -18,7 +18,7 @@ SUBSYSTEM_DEF(machines) for(var/obj/structure/cable/PC in GLOB.cable_list) if(!PC.powernet) - var/datum/powernet/NewPN = new() + var/datum/powernet/NewPN = new(PC.loc.z) NewPN.add_cable(PC) propagate_network(PC,PC.powernet) @@ -53,7 +53,7 @@ SUBSYSTEM_DEF(machines) for(var/A in cables) var/obj/structure/cable/PC = A if(!PC.powernet) - var/datum/powernet/NewPN = new() + var/datum/powernet/NewPN = new(PC.loc.z) NewPN.add_cable(PC) propagate_network(PC,PC.powernet) diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index 47afc99eb4c1..c71a986aaca5 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -246,6 +246,10 @@ name = "Honest Work" desc = "Set up one of the solar arrays as part of the Engineering team." id = ENGINEERING + 2 +/datum/achievement/engineering/scotty + name = "\"I'm givin' it all she's got, Captain!\"" + desc = "As Chief Engineer, produce more than three megawatts of power." + id = ENGINEERING + 3 //end-engineering #undef GREENTEXT diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 22e5b0bcce8f..d42110d582a1 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -260,7 +260,7 @@ By design, d1 is the smallest direction and d2 is the highest if(C.d1 == (direction^3) || C.d2 == (direction^3)) //we've got a diagonally matching cable if(!C.powernet) //if the matching cable somehow got no powernet, make him one (should not happen for cables) - var/datum/powernet/newPN = new() + var/datum/powernet/newPN = new(C.loc.z) newPN.add_cable(C) if(powernet) //if we already have a powernet, then merge the two powernets @@ -280,7 +280,7 @@ By design, d1 is the smallest direction and d2 is the highest continue if(C.d1 == (direction^12) || C.d2 == (direction^12)) //we've got a diagonally matching cable if(!C.powernet) //if the matching cable somehow got no powernet, make him one (should not happen for cables) - var/datum/powernet/newPN = new() + var/datum/powernet/newPN = new(C.loc.z) newPN.add_cable(C) if(powernet) //if we already have a powernet, then merge the two powernets @@ -308,7 +308,7 @@ By design, d1 is the smallest direction and d2 is the highest if(C.d1 == fdir || C.d2 == fdir) //we've got a matching cable in the neighbor turf if(!C.powernet) //if the matching cable somehow got no powernet, make him one (should not happen for cables) - var/datum/powernet/newPN = new() + var/datum/powernet/newPN = new(C.loc.z) newPN.add_cable(C) if(powernet) //if we already have a powernet, then merge the two powernets @@ -321,7 +321,7 @@ By design, d1 is the smallest direction and d2 is the highest var/list/to_connect = list() if(!powernet) //if we somehow have no powernet, make one (should not happen for cables) - var/datum/powernet/newPN = new() + var/datum/powernet/newPN = new(loc.z) newPN.add_cable(src) //first let's add turf cables to our powernet @@ -410,7 +410,7 @@ By design, d1 is the smallest direction and d2 is the highest var/list/powerlist = power_list(T1,src,0,0) //find the other cables that ended in the centre of the turf, with or without a powernet if(powerlist.len>0) - var/datum/powernet/PN = new() + var/datum/powernet/PN = new(loc.z) propagate_network(powerlist[1],PN) //propagates the new powernet beginning at the source cable if(PN.is_empty()) //can happen with machines made nodeless when smoothing cables @@ -418,7 +418,7 @@ By design, d1 is the smallest direction and d2 is the highest /obj/structure/cable/proc/auto_propogate_cut_cable(obj/O) if(O && !QDELETED(O)) - var/datum/powernet/newPN = new()// creates a new powernet... + var/datum/powernet/newPN = new(loc.z)// creates a new powernet... propagate_network(O, newPN)//... and propagates it to the other side of the cable // cut the cable's powernet at this cable and updates the powergrid @@ -620,7 +620,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai C.update_icon() //create a new powernet with the cable, if needed it will be merged later - var/datum/powernet/PN = new() + var/datum/powernet/PN = new(loc.z) PN.add_cable(C) C.mergeConnectedNetworks(C.d2) //merge the powernet with adjacents powernets @@ -692,7 +692,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai NC.update_icon() //create a new powernet with the cable, if needed it will be merged later - var/datum/powernet/newPN = new() + var/datum/powernet/newPN = new(loc.z) newPN.add_cable(NC) NC.mergeConnectedNetworks(NC.d2) //merge the powernet with adjacents powernets diff --git a/code/modules/power/powernet.dm b/code/modules/power/powernet.dm index 9660e8359c55..64727cd9edf0 100644 --- a/code/modules/power/powernet.dm +++ b/code/modules/power/powernet.dm @@ -14,9 +14,11 @@ var/viewload = 0 // the load as it appears on the power console (gradually updated) var/netexcess = 0 // excess power on the powernet (typically avail-load)/////// var/delayedload = 0 // load applied to powernet between power ticks. + var/z = 0 // the Z coordinate of this powernet. Only used by some random achievement, at the moment. -/datum/powernet/New() +/datum/powernet/New(newz) SSmachines.powernets += src + z = newz /datum/powernet/Destroy() //Go away references, you suck! From f5eaa8d35df80de27c7fcba32a741c2428c033c9 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 20:41:20 -0600 Subject: [PATCH 05/19] Adds achievement for being set on fire while fire-resistant --- code/datums/achievements/achievements.dm | 4 ++++ code/modules/mob/living/carbon/human/life.dm | 2 ++ 2 files changed, 6 insertions(+) diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index c71a986aaca5..db5b64244da5 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -250,6 +250,10 @@ name = "\"I'm givin' it all she's got, Captain!\"" desc = "As Chief Engineer, produce more than three megawatts of power." id = ENGINEERING + 3 +/datum/achievement/engineering/toasty + name = "Nice and Toasty" + desc = "Get set on fire in a fire-resistant suit." + id = ENGINEERING + 4 //end-engineering #undef GREENTEXT diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 4f213e55d98a..19a17b1496fd 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -150,6 +150,8 @@ //If have no DNA or can be Ignited, call parent handling to light user //If firestacks are high enough if(!dna || dna.species.CanIgniteMob(src)) + if(get_thermal_protection() > 30000) // If they're resistant to fire + SSachievements.unlock_achievement(/datum/achievement/engineering/toasty,src.client) // Fear the reaper man! return ..() . = FALSE //No ignition From 87b7d1172697da9ca9f4e314d82c3b426f4e5738 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 20:52:43 -0600 Subject: [PATCH 06/19] Adds achieve for surviving as part of the engie department I needed *something* to put in for /datum/achievement/engineering, so... --- code/__HELPERS/roundend.dm | 2 ++ code/datums/achievements/achievements.dm | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 04bdb0d8e177..564ca4b57f7a 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -335,6 +335,8 @@ else parts += "
" parts += "You managed to survive the events on [station_name()] as [M.real_name]." + if(M.mind.assigned_role && (M.mind.assigned_role in GLOB.engineering_positions)) + SSachievements.unlock_achievement(/datum/achievement/engineering, C) else parts += "
" diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index db5b64244da5..d334e8e30945 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -242,6 +242,10 @@ //end-redtext //start-engineering +/datum/achievement/engineering + name = "Issac Clarke" + desc = "Survive a full round as part of the Engineering team." + id = ENGINEERING + 1 /datum/achievement/engineering/solar name = "Honest Work" desc = "Set up one of the solar arrays as part of the Engineering team." From 3bed9f8ce94d1583da391891721a7e5641998bcc Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 20:59:23 -0600 Subject: [PATCH 07/19] Adds achievement for dabbing --- code/datums/achievements/achievements.dm | 6 ++++++ yogstation/code/modules/mob/living/emote.dm | 1 + 2 files changed, 7 insertions(+) diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index d334e8e30945..c4121709eb1f 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -139,6 +139,12 @@ desc = "As the QM, have a million cargo credits by the end of the round" //Cargoking-junior id = 22 +/datum/achievement/dab + name = "Brain Damage" + desc = "Dab." + id = 23 + hidden = TRUE + // The achievements that are basically just "greentext as this sort of antag" /datum/achievement/greentext diff --git a/yogstation/code/modules/mob/living/emote.dm b/yogstation/code/modules/mob/living/emote.dm index ee6e02e506e4..1f3d9c7a0098 100644 --- a/yogstation/code/modules/mob/living/emote.dm +++ b/yogstation/code/modules/mob/living/emote.dm @@ -74,3 +74,4 @@ var/light_dab_speed = rand(3,7) H.DabAnimation(angle = light_dab_angle , speed = light_dab_speed) H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 5) + SSachievements.unlock_achievement(/datum/achievement/dab,H.client) From 38dccedfc0e5835d2e49e9c651908a7ea9e9465d Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 21:22:18 -0600 Subject: [PATCH 08/19] Fixes bug where the Scotty achievement would only fire... ...if you got *EXACTLY* 3000 kW of power in a powernet --- code/controllers/subsystem/achievements.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/achievements.dm b/code/controllers/subsystem/achievements.dm index 69bce336ad71..34542f02ff61 100644 --- a/code/controllers/subsystem/achievements.dm +++ b/code/controllers/subsystem/achievements.dm @@ -61,7 +61,7 @@ SUBSYSTEM_DEF(achievements) for(var/n in SSmachines.powernets) var/datum/powernet/net = n if(net.z == 2) // If the powernet is on the station z-level - if(net.avail == 3000 && CE.stat != DEAD && CE.client) // If there's 3 MW available (Value is in kW) + if(net.avail >= 3000 && CE.stat != DEAD && CE.client) // If there's 3 MW available (Value is in kW) unlock_achievement(/datum/achievement/engineering/scotty, CE.client) //Ad-hoc procs From 629e6d7915e617df3a73e82cb875abafef59dd17 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 21:33:10 -0600 Subject: [PATCH 09/19] Fixes define overwrite issue with sound.dm and achievements.dm --- code/datums/achievements/achievements.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index e1e09c2cfc78..54981fbfabc7 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -3,7 +3,7 @@ //TO BE HONEST THIS OFFSET DOESN'T EVEN NEED TO BE POWER OF TWO, THOUGH. #define GREENTEXT 256 // An offset for new greentext-related achievements, to keep the incremental pattern. #define REDTEXT 512 // Offset for redtexts. -#define ENGINEERING 768 // Offset for engineering-related achievements. +#define ENGIEDEPT 768 // Offset for engineering-related achievements. /datum/achievement var/name = "achievement" @@ -256,21 +256,21 @@ /datum/achievement/engineering name = "Issac Clarke" desc = "Survive a full round as part of the Engineering team." - id = ENGINEERING + 1 + id = ENGIEDEPT + 1 /datum/achievement/engineering/solar name = "Honest Work" desc = "Set up one of the solar arrays as part of the Engineering team." - id = ENGINEERING + 2 + id = ENGIEDEPT + 2 /datum/achievement/engineering/scotty name = "\"I'm givin' it all she's got, Captain!\"" desc = "As Chief Engineer, produce more than three megawatts of power." - id = ENGINEERING + 3 + id = ENGIEDEPT + 3 /datum/achievement/engineering/toasty name = "Nice and Toasty" desc = "Get set on fire in a fire-resistant suit." - id = ENGINEERING + 4 + id = ENGIEDEPT + 4 //end-engineering #undef GREENTEXT #undef REDTEXT -#undef ENGINEERING +#undef ENGIEDEPT From 2e40601ab9cf134f6bb1156098b3e463f3d1d543 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 21:47:38 -0600 Subject: [PATCH 10/19] Fixes misspell of Isaac Clarke's name --- code/datums/achievements/achievements.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index 54981fbfabc7..c7f22a57c9f0 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -254,7 +254,7 @@ //start-engineering /datum/achievement/engineering - name = "Issac Clarke" + name = "Isaac Clarke" desc = "Survive a full round as part of the Engineering team." id = ENGIEDEPT + 1 /datum/achievement/engineering/solar From 3c83194f3f8e4733a573331636621fff82915c21 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 22:20:51 -0600 Subject: [PATCH 11/19] Makes the Poly achievements be of /engineering/ type --- code/datums/achievements/achievements.dm | 4 ++-- yogstation/code/game/machinery/telecomms/machines/server.dm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/datums/achievements/achievements.dm b/code/datums/achievements/achievements.dm index c7f22a57c9f0..458bf0476cfc 100644 --- a/code/datums/achievements/achievements.dm +++ b/code/datums/achievements/achievements.dm @@ -101,13 +101,13 @@ id = 17 hidden = TRUE -/datum/achievement/Poly_silent +/datum/achievement/engineering/Poly_silent name = "Silence Bird!" desc = "As a signal technician, create a script that mutes poly" id = 18 hidden = TRUE -/datum/achievement/Poly_loud +/datum/achievement/engineering/Poly_loud name = "Embrace the Bird!" desc = "As a signal technician, create a script that makes poly LOUD" id = 19 diff --git a/yogstation/code/game/machinery/telecomms/machines/server.dm b/yogstation/code/game/machinery/telecomms/machines/server.dm index f2e348e8f4b5..cdc61ebbb943 100644 --- a/yogstation/code/game/machinery/telecomms/machines/server.dm +++ b/yogstation/code/game/machinery/telecomms/machines/server.dm @@ -75,7 +75,7 @@ signal.data["reject"] = 0 Compiler.Run(signal) if(signal.data["reject"] == 0) - SSachievements.unlock_achievement(/datum/achievement/Poly_silent, user.client) + SSachievements.unlock_achievement(/datum/achievement/engineering/Poly_silent, user.client) else for(var/sample in signal.data["spans"]) if(sample == SPAN_COMMAND) @@ -84,6 +84,6 @@ Compiler.Run(signal) for(var/S in signal.data["spans"]) if(S == SPAN_COMMAND) - SSachievements.unlock_achievement(/datum/achievement/Poly_loud, user.client) + SSachievements.unlock_achievement(/datum/achievement/engineering/Poly_loud, user.client) return compileerrors //end-NTSL From 4d6f5047c26794bb8a4505ff223df556873eb9f4 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 22:22:53 -0600 Subject: [PATCH 12/19] Polishes syntax in solar.dm --- code/modules/power/solar.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 94ac64e8eb2e..9fe74abddbfb 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -404,7 +404,7 @@ var/was_not_connected = !(connected_tracker && connected_panels.len) search_for_connected() if(was_not_connected && connected_tracker && connected_panels.len) // If this guy finished up the solars - if(!(last_user.stat == DEAD) && (last_user?.mind.assigned_role in GLOB.engineering_positions)) // and he's an engineer who isn't long-dead or adminbussing + if(last_user.stat != DEAD && (last_user?.mind.assigned_role in GLOB.engineering_positions)) // and he's an engineer who isn't long-dead or adminbussing SSachievements.unlock_achievement(/datum/achievement/engineering/solar, last_user.client) // Give him the achievement if(connected_tracker && track == 2) connected_tracker.set_angle(SSsun.angle) From 8fae2064e61aa9a895b48f272b4cd42af4000664 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 28 Jan 2020 22:37:09 -0600 Subject: [PATCH 13/19] Fixes potential DoS exploit with a Poly achievement Also ends up lowering the amount of requirements for the Poly_loud achievement. This code in general smells like ass and needs to be reworked to no longer make several NTSL calls to do its fuckin job. --- .../code/game/machinery/telecomms/machines/server.dm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/yogstation/code/game/machinery/telecomms/machines/server.dm b/yogstation/code/game/machinery/telecomms/machines/server.dm index cdc61ebbb943..80bc569aa9eb 100644 --- a/yogstation/code/game/machinery/telecomms/machines/server.dm +++ b/yogstation/code/game/machinery/telecomms/machines/server.dm @@ -79,11 +79,7 @@ else for(var/sample in signal.data["spans"]) if(sample == SPAN_COMMAND) - signal.data["name"] = "" - signal.data["spans"] = list() - Compiler.Run(signal) - for(var/S in signal.data["spans"]) - if(S == SPAN_COMMAND) - SSachievements.unlock_achievement(/datum/achievement/engineering/Poly_loud, user.client) + SSachievements.unlock_achievement(/datum/achievement/engineering/Poly_loud, user.client) + break // Not having this break leaves us open to a potential DoS attack. return compileerrors //end-NTSL From c0da9f683530845629e8a8b0793a11df36427491 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Wed, 29 Jan 2020 22:01:33 -0600 Subject: [PATCH 14/19] Switches to is_station_level() instead of (z == 2) --- code/controllers/subsystem/achievements.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/achievements.dm b/code/controllers/subsystem/achievements.dm index 34542f02ff61..0b0998eff3a3 100644 --- a/code/controllers/subsystem/achievements.dm +++ b/code/controllers/subsystem/achievements.dm @@ -60,7 +60,7 @@ SUBSYSTEM_DEF(achievements) else for(var/n in SSmachines.powernets) var/datum/powernet/net = n - if(net.z == 2) // If the powernet is on the station z-level + if(is_station_level(net.z)) // If the powernet is on the station z-level if(net.avail >= 3000 && CE.stat != DEAD && CE.client) // If there's 3 MW available (Value is in kW) unlock_achievement(/datum/achievement/engineering/scotty, CE.client) From c491c26bdaf2ba43e1d33c6753677a8bee89f19d Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Wed, 29 Jan 2020 22:01:42 -0600 Subject: [PATCH 15/19] Fixes misuse of ?. operator --- code/controllers/subsystem/achievements.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/achievements.dm b/code/controllers/subsystem/achievements.dm index 0b0998eff3a3..49d5f01757c2 100644 --- a/code/controllers/subsystem/achievements.dm +++ b/code/controllers/subsystem/achievements.dm @@ -54,7 +54,7 @@ SUBSYSTEM_DEF(achievements) for(var/x in GLOB.player_list) if(ishuman(x)) var/mob/living/carbon/human/H = x - if(H?.mind.assigned_role == "Chief Engineer") + if(H.mind?.assigned_role == "Chief Engineer") CE = H break else From 65800002526cb6b718c2931dd3b69ceb0d02172f Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Fri, 31 Jan 2020 16:54:34 -0600 Subject: [PATCH 16/19] Fixes potential runtimes with solar_control --- code/modules/power/solar.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 9fe74abddbfb..3b02b03d4cfc 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -403,8 +403,8 @@ if(action == "refresh") var/was_not_connected = !(connected_tracker && connected_panels.len) search_for_connected() - if(was_not_connected && connected_tracker && connected_panels.len) // If this guy finished up the solars - if(last_user.stat != DEAD && (last_user?.mind.assigned_role in GLOB.engineering_positions)) // and he's an engineer who isn't long-dead or adminbussing + if(last_user && was_not_connected && connected_tracker && connected_panels.len) // If this guy finished up the solars + if(last_user.stat != DEAD && (last_user.mind?.assigned_role in GLOB.engineering_positions)) // and he's an engineer who isn't long-dead or adminbussing SSachievements.unlock_achievement(/datum/achievement/engineering/solar, last_user.client) // Give him the achievement if(connected_tracker && track == 2) connected_tracker.set_angle(SSsun.angle) From 1812d1a5dfae81e7cb33b736bd6858126d361189 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Fri, 31 Jan 2020 16:54:53 -0600 Subject: [PATCH 17/19] Makes use of FIRE_SUIT_MAX_TEMP_PROTECT in fire achievement --- code/modules/mob/living/carbon/human/life.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 19a17b1496fd..57320f133592 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -150,7 +150,7 @@ //If have no DNA or can be Ignited, call parent handling to light user //If firestacks are high enough if(!dna || dna.species.CanIgniteMob(src)) - if(get_thermal_protection() > 30000) // If they're resistant to fire + if(get_thermal_protection() > FIRE_SUIT_MAX_TEMP_PROTECT*0.95) // If they're resistant to fire (slightly undercut to make sure get_thermal_protection doesn't fuck over this achievement due to floating-point errors SSachievements.unlock_achievement(/datum/achievement/engineering/toasty,src.client) // Fear the reaper man! return ..() . = FALSE //No ignition From ce39c001f1481164ace3df51c7dac0740fc5d0c3 Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Fri, 31 Jan 2020 18:19:33 -0600 Subject: [PATCH 18/19] Removes assigned_role test in roundend.dm --- code/__HELPERS/roundend.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 564ca4b57f7a..87799bb075f7 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -335,7 +335,7 @@ else parts += "
" parts += "You managed to survive the events on [station_name()] as [M.real_name]." - if(M.mind.assigned_role && (M.mind.assigned_role in GLOB.engineering_positions)) + if(M.mind.assigned_role in GLOB.engineering_positions) // We don't actually need to even really do a check to see if assigned_role is set to anything. SSachievements.unlock_achievement(/datum/achievement/engineering, C) else From 3e95783e6dacebfe04db879c73cb0f53df97d66a Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Sat, 22 Feb 2020 09:36:33 -0600 Subject: [PATCH 19/19] Adds minor sanity check for Solar achievement --- code/modules/power/solar.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 3b02b03d4cfc..b9f8bf009aaa 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -403,7 +403,7 @@ if(action == "refresh") var/was_not_connected = !(connected_tracker && connected_panels.len) search_for_connected() - if(last_user && was_not_connected && connected_tracker && connected_panels.len) // If this guy finished up the solars + if(last_user && last_user.client && was_not_connected && connected_tracker && connected_panels.len) // If this guy finished up the solars if(last_user.stat != DEAD && (last_user.mind?.assigned_role in GLOB.engineering_positions)) // and he's an engineer who isn't long-dead or adminbussing SSachievements.unlock_achievement(/datum/achievement/engineering/solar, last_user.client) // Give him the achievement if(connected_tracker && track == 2)