diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 9e14c1c1212..681f525bd5e 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -4,6 +4,8 @@ #define PERSONAL_LAST_ROUND "personal last round" #define SERVER_LAST_ROUND "server last round" +GLOBAL_LIST_INIT(achievements_unlocked, list()) + /datum/controller/subsystem/ticker/proc/gather_roundend_feedback() gather_antag_data() record_nuke_disk_location() @@ -322,6 +324,8 @@ parts += goal_report() //Economy & Money parts += market_report() + //Player Achievements + parts += cheevo_report() list_clear_nulls(parts) @@ -809,3 +813,25 @@ return qdel(query_update_everything_ranks) qdel(query_check_everything_ranks) + +/datum/controller/subsystem/ticker/proc/cheevo_report() + var/list/parts = list() + if(length(GLOB.achievements_unlocked)) + parts += "Achievement Get!
" + parts += "Total Achievements Earned: [length(GLOB.achievements_unlocked)]!
" + parts += "" + return "
" + +///A datum containing the info necessary for an achievement readout, reported and added to the global list in /datum/award/achievement/on_unlock(mob/user) +/datum/achievement_report + ///The winner of this achievement. + var/winner + ///The achievement that was won. + var/cheevo + ///The ckey of our winner + var/winner_key + ///The name of the area we earned this cheevo in + var/award_location diff --git a/code/datums/achievements/_awards.dm b/code/datums/achievements/_awards.dm index 6c207a120a4..2c9f0908d4c 100644 --- a/code/datums/achievements/_awards.dm +++ b/code/datums/achievements/_awards.dm @@ -89,6 +89,19 @@ to_chat(user, span_greenannounce("Achievement unlocked: [name]!")) user.client.give_award(/datum/award/score/achievements_score, user, 1) + var/datum/achievement_report/new_report = new /datum/achievement_report() + + new_report.winner = "[(user.real_name == user.name) ? user.real_name : "[user.real_name], as [user.name]"]" + new_report.cheevo = name + if(user.ckey) + new_report.winner_key = user.ckey + else + stack_trace("[name] achievement earned by [user], who did not have a ckey.") + + new_report.award_location = "[get_area_name(user)]" + + GLOB.achievements_unlocked += new_report + ///Scores are for leaderboarded things, such as killcount of a specific boss /datum/award/score desc = "you did it sooo many times."