Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3ed5bf4
Adds an achievement for setting up some solars as Engineer
Altoids1 Jan 29, 2020
011f7f9
Makes emagging the PA an engineering-type achievement
Altoids1 Jan 29, 2020
0e73a99
Fixes compiletime with PA emag achievement
Altoids1 Jan 29, 2020
01e949c
Adds new achieve for CEs getting 3 MW on a station powernet
Altoids1 Jan 29, 2020
f5eaa8d
Adds achievement for being set on fire while fire-resistant
Altoids1 Jan 29, 2020
87b7d11
Adds achieve for surviving as part of the engie department
Altoids1 Jan 29, 2020
3bed9f8
Adds achievement for dabbing
Altoids1 Jan 29, 2020
e2cdc88
Merge branch 'master' into achievement-get
Altoids1 Jan 29, 2020
38dcced
Fixes bug where the Scotty achievement would only fire...
Altoids1 Jan 29, 2020
629e6d7
Fixes define overwrite issue with sound.dm and achievements.dm
Altoids1 Jan 29, 2020
2e40601
Fixes misspell of Isaac Clarke's name
Altoids1 Jan 29, 2020
3c83194
Makes the Poly achievements be of /engineering/ type
Altoids1 Jan 29, 2020
4d6f504
Polishes syntax in solar.dm
Altoids1 Jan 29, 2020
8fae206
Fixes potential DoS exploit with a Poly achievement
Altoids1 Jan 29, 2020
c0da9f6
Switches to is_station_level() instead of (z == 2)
Altoids1 Jan 30, 2020
c491c26
Fixes misuse of ?. operator
Altoids1 Jan 30, 2020
6580000
Fixes potential runtimes with solar_control
Altoids1 Jan 31, 2020
1812d1a
Makes use of FIRE_SUIT_MAX_TEMP_PROTECT in fire achievement
Altoids1 Jan 31, 2020
ce39c00
Removes assigned_role test in roundend.dm
Altoids1 Feb 1, 2020
3e95783
Adds minor sanity check for Solar achievement
Altoids1 Feb 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__HELPERS/roundend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@
else
parts += "<div class='panel greenborder'>"
parts += "<span class='greentext'>You managed to survive the events on [station_name()] as [M.real_name].</span>"
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
parts += "<div class='panel redborder'>"
Expand Down
20 changes: 19 additions & 1 deletion code/controllers/subsystem/achievements.dm
Original file line number Diff line number Diff line change
@@ -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))
Expand Down Expand Up @@ -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(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)

//Ad-hoc procs
/datum/controller/subsystem/achievements/proc/unlock_achievement(achievementPath, client/C)
var/datum/achievement/achievement = get_achievement(achievementPath)
if(!achievement)
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
35 changes: 31 additions & 4 deletions code/datums/achievements/achievements.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ENGIEDEPT 768 // Offset for engineering-related achievements.

/datum/achievement
var/name = "achievement"
Expand All @@ -25,7 +26,7 @@
desc = "Successfully defibrillate someone"
id = 3

/datum/achievement/pa_emag
/datum/achievement/engineering/pa_emag
name = "Catastrophe"
desc = "Emag a particle accelerator"
id = 4
Expand Down Expand Up @@ -100,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
Expand Down Expand Up @@ -143,6 +144,12 @@
desc = "Trigger a keycard authentication device event, by yourself."
id = 23

/datum/achievement/dab
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not control the rate at which spacemen dab

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undocumented change, PR denied

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please no, im downvoting this shit until this gets yeeted out

name = "Brain Damage"
desc = "Dab."
id = 24
hidden = TRUE

// The achievements that are basically just "greentext as this sort of antag"

/datum/achievement/greentext
Expand Down Expand Up @@ -245,5 +252,25 @@
hidden = TRUE
//end-redtext

//start-engineering
/datum/achievement/engineering
name = "Isaac Clarke"
desc = "Survive a full round as part of the Engineering team."
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 = 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 = ENGIEDEPT + 3
/datum/achievement/engineering/toasty
name = "Nice and Toasty"
desc = "Get set on fire in a fire-resistant suit."
id = ENGIEDEPT + 4
//end-engineering

#undef GREENTEXT
#undef REDTEXT
#undef REDTEXT
#undef ENGIEDEPT
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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() > 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

Expand Down
16 changes: 8 additions & 8 deletions code/modules/power/cable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -410,15 +410,15 @@ 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
qdel(PN)

/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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion code/modules/power/powernet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
7 changes: 7 additions & 0 deletions code/modules/power/solar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
. = ..()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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(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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify his client exists here

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)
Expand Down
10 changes: 3 additions & 7 deletions yogstation/code/game/machinery/telecomms/machines/server.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,11 @@
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)
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/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
1 change: 1 addition & 0 deletions yogstation/code/modules/mob/living/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not control the rate at which spacemen dab

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
if(obj_flags & EMAGGED)
return
to_chat(user, "<span class='danger'>The laws of physics no longer apply in the future, god help you...</span>")
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

Expand Down