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
24 commits
Select commit Hold shift + click to select a range
f2cea57
Adds Greentext achievement
Altoids1 Jan 16, 2020
c784b0b
Adds clockwork greentext achievements
Altoids1 Jan 16, 2020
94a3ce7
Minor abductor win condition optimization
Altoids1 Jan 16, 2020
682a0ef
Adds Cult greentext achievements
Altoids1 Jan 16, 2020
e4f2e78
Adds Rev & RevHead greentext achievemetns
Altoids1 Jan 16, 2020
e831e7a
Adds Blob greentext achievement
Altoids1 Jan 16, 2020
cf754f3
Makes all greentext achievements implicitly reward the generic one
Altoids1 Jan 16, 2020
274d696
Makes several existant greentext achievements of type :achievement/gr…
Altoids1 Jan 17, 2020
c7d4836
Adds clown-op greentext achievement, makes nukewin a greentext achiev…
Altoids1 Jan 17, 2020
a7b7df6
Adds var for antag datums to mark which greentext achievement to give
Altoids1 Jan 17, 2020
6b1194f
Adds EAA and IAA greentext achievements via greentext_achieve
Altoids1 Jan 17, 2020
907202e
Adds achievement for wizard... losing
Altoids1 Jan 17, 2020
69b58ec
Adds greentext achievement for gangs
Altoids1 Jan 17, 2020
2f3ceb1
Makes wizard loss achievement hidden
Altoids1 Jan 17, 2020
b7accd8
Fixes compiletimes in the new greentext achievements
Altoids1 Jan 17, 2020
fe11b78
Adds greentext_achieve functionality to traitor antag types
Altoids1 Jan 17, 2020
0358b9f
Fixes all antags getting "Delta Alert" achievement upon greentext
Altoids1 Jan 17, 2020
17e3e61
Adds achievement for greentexting as Sentient Disease
Altoids1 Jan 17, 2020
3063852
Adds greentext achievement for pirates
Altoids1 Jan 17, 2020
1b6f404
Fixes runtime in greentext achievements due to not passing client arg
Altoids1 Jan 17, 2020
1f49b27
Adds greentext achievements for Revenants and Vampires
Altoids1 Jan 17, 2020
d0386a7
Adds offset defines to achievements.dm, for tidyness sake
Altoids1 Jan 17, 2020
41dec61
Adds an offset define for redtexts too, just in case
Altoids1 Jan 17, 2020
58a03d0
#undef REDTEXT
Altoids1 Jan 17, 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
4 changes: 3 additions & 1 deletion code/controllers/subsystem/achievements.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ SUBSYSTEM_DEF(achievements)
if(!achievement)
log_sql("Achievement [achievementPath] not found in list of achievements when trying to unlock for [C.ckey]")
return FALSE
if(istype(achievement,/datum/achievement/greentext) && achievementPath != /datum/achievement/greentext)
Copy link

Choose a reason for hiding this comment

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

bruh

Copy link
Contributor

Choose a reason for hiding this comment

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

lol

unlock_achievement(/datum/achievement/greentext,C) // Oooh, a little bit recursive!
if(!has_achievement(achievementPath, C))
var/datum/DBQuery/medalQuery = SSdbcore.NewQuery("INSERT INTO [format_table_name("earned_achievements")] (ckey, id) VALUES ('[C.ckey]', '[achievement.id]')")
medalQuery.Execute()
Expand Down Expand Up @@ -90,6 +92,6 @@ SUBSYSTEM_DEF(achievements)

/datum/controller/subsystem/achievements/proc/get_achievement(achievementPath)
for(var/datum/achievement/i in achievements)
if(istype(i, achievementPath))
if(i.type == achievementPath) // Can't use istype() here since it needs to be the EXACT correct type.
return i
return FALSE
119 changes: 115 additions & 4 deletions code/datums/achievements/achievements.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//OFFSETS - Used so that each general like "group" of achievements can be added to w/o fucking up the whole incremental pattern we got going on.
//DO NOT MAKE OFFSET VALUES THAT ARE GREATER THAN 2^15 OR LESS THAN 128.
//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.

/datum/achievement
var/name = "achievement"
var/desc = "Please make an issue on github, including this achievement's name and how you got it."
Expand Down Expand Up @@ -30,7 +36,7 @@
desc = "As a member of the Crew, deal a Humiliating defeat to Nuclear Team"
id = 5

/datum/achievement/nukewin
/datum/achievement/greentext/nukewin
name = "Delta Alert"
desc = "As a Nuclear Operative, score a Major or Minor Victory"
id = 6
Expand All @@ -52,7 +58,7 @@
id = 9
hidden = TRUE

/datum/achievement/wizwin
/datum/achievement/greentext/wizwin
name = "Scholars of the Arcane"
desc = "As a wizard, complete your objectives"
id = 10
Expand All @@ -68,12 +74,12 @@
id = 12
hidden = TRUE

/datum/achievement/changelingwin
/datum/achievement/greentext/changelingwin
name = "The Thing"
desc = "As a changeling, complete your objectives"
id = 13

/datum/achievement/slingascend
/datum/achievement/greentext/slingascend
name = "The Dark Shadow"
desc = "As a shadowling, ascend successfully"
id = 14
Expand Down Expand Up @@ -131,3 +137,108 @@
name = "Duke of Ducats"
desc = "As the QM, have a million cargo credits by the end of the round" //Cargoking-junior
id = 22

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

/datum/achievement/greentext
name = "Green Text"
desc = "As an Antagonist achieve your first green text"
id = GREENTEXT + 1

/datum/achievement/greentext/ratvar
name = "Clock Work"
desc = "As a Servant of Ratvar summon Ratvar"
id = GREENTEXT + 2

/datum/achievement/greentext/ratvar/eminence
name = "Clock Work"
desc = "As the Eminence, summon Ratvar"
id = GREENTEXT + 3

/datum/achievement/greentext/narsie
name = "Blood Rites"
desc = "As a member of Blood Cult summon Nar-Sie"
id = GREENTEXT + 4

/datum/achievement/greentext/narsie/master
name = "Master of Blood"
desc = "As a Cult Master, summon Nar-Sie"
id = GREENTEXT + 5

/datum/achievement/greentext/revolution
name = "Down with Nanotrasen"
desc = "As a Revolutionary, complete your objectives"
id = GREENTEXT + 6

/datum/achievement/greentext/revolution/head
name = "Viva la Revolution!"
desc = "As a Head Revolutionary, complete your objectives"
id = GREENTEXT + 7

/datum/achievement/greentext/gang
name = "Turf War"
desc = "As a Gang Member, take over the station"
id = GREENTEXT + 8

/datum/achievement/greentext/gangleader
name = "\"I have built my organization upon fear.\""
desc = "As a Gang Leader, take over the station"
id = GREENTEXT + 9

/datum/achievement/greentext/blob
name = "Grey Goo"
desc = "As a Blob complete your objectives"
id = GREENTEXT + 10

/datum/achievement/greentext/clownop
name = "\"You wouldn't get it\""
desc = "As a Clown Operative score a Major or Minor Victory"
id = GREENTEXT + 11

/datum/achievement/greentext/internal
name = "Triple Cross"
desc = "As an Internal Affairs Agent, complete your objectives"
id = GREENTEXT + 12

/datum/achievement/greentext/external
name = "Quadruple Cross"
desc = "As an External Affairs Agent, complete your objectives"
id = GREENTEXT + 13

/datum/achievement/greentext/disease
name = "Space Aids"
desc = "As Sentient Disease, survive and complete your objectives"
id = GREENTEXT + 14

/datum/achievement/greentext/pirate
name = "Yaaaahr!"
desc = "As member of the Pirate crew, collect sufficient bounty from the crew"
id = GREENTEXT + 15

/datum/achievement/greentext/vampire
name = "Count de Ville"
desc = "As a Vampire, complete your objectives"
id = GREENTEXT + 16

/datum/achievement/greentext/revenant
name = "From The Shadows"
desc = "As a Revenant, complete your objectives"
id = GREENTEXT + 17

//end-greentext

//start-redtext
/datum/achievement/redtext
name = "Mission Failed, We'll Get'em Next Time"
desc = "As an antagonist, fail your objectives."
id = REDTEXT + 1

/datum/achievement/redtext/winlost
name = "Arcane Failure"
desc = "As a Wizard, fail your objectives."
id = REDTEXT + 2
hidden = TRUE
//end-redtext

#undef GREENTEXT
#undef REDTEXT
5 changes: 5 additions & 0 deletions code/modules/antagonists/_common/antag_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GLOBAL_LIST_EMPTY(antagonists)
var/show_in_antagpanel = TRUE //This will hide adding this antag type in antag panel, use only for internal subtypes that shouldn't be added directly but still show if possessed by mind
var/antagpanel_category = "Uncategorized" //Antagpanel will display these together, REQUIRED
var/show_name_in_check_antagonists = FALSE //Will append antagonist name in admin listings - use for categories that share more than one antag type
var/datum/achievement/greentext/greentext_achieve // The achievement received for greentexting as this antag type. Not all antag types use this to distribute their achievements.

/datum/antagonist/New()
GLOB.antagonists += src
Expand Down Expand Up @@ -142,6 +143,10 @@ GLOBAL_LIST_EMPTY(antagonists)

if(objectives.len == 0 || objectives_complete)
report += "<span class='greentext big'>The [name] was successful!</span>"
if(istype(greentext_achieve))
SSachievements.unlock_achievement(greentext_achieve,owner.current)
else // The above still does award the generic greentext achievement, just implicitly.
SSachievements.unlock_achievement(/datum/achievement/greentext,owner.current.client)
else
report += "<span class='redtext big'>The [name] has failed!</span>"

Expand Down
1 change: 1 addition & 0 deletions code/modules/antagonists/abductor/abductor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
for(var/datum/objective/O in objectives)
if(!O.check_completion())
won = FALSE
break
if(won)
result += "<span class='greentext big'>[name] team fulfilled its mission!</span>"
else
Expand Down
2 changes: 2 additions & 0 deletions code/modules/antagonists/blob/blob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
if(!overmind.victory_in_progress) //if it won this doesn't really matter
var/point_report = "<br><b>[owner.name]</b> took over [overmind.max_count] tiles at the height of its growth."
return basic_report+point_report
else
SSachievements.unlock_achievement(/datum/achievement/greentext/blob,overmind.client)
return basic_report

/datum/antagonist/blob/greet()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/changeling/changeling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@

if(changelingwin)
parts += "<span class='greentext'>The changeling was successful!</span>"
SSachievements.unlock_achievement(/datum/achievement/changelingwin, owner.current.client) //changeling wins, give achivement
SSachievements.unlock_achievement(/datum/achievement/greentext/changelingwin, owner.current.client) //changeling wins, give achivement
else
parts += "<span class='redtext'>The changeling has failed.</span>"

Expand Down
4 changes: 4 additions & 0 deletions code/modules/antagonists/clockcult/clockcult.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@

if(check_clockwork_victory())
parts += "<span class='greentext big'>Ratvar's servants defended the Ark until its activation!</span>"
for(var/mind in SSticker.mode.servants_of_ratvar)
var/datum/mind/M = mind
SSachievements.unlock_achievement(/datum/achievement/greentext/ratvar,M.current.client)
SSachievements.unlock_achievement(/datum/achievement/greentext/ratvar/eminence,eminence.current.client)
else
parts += "<span class='redtext big'>The Ark was destroyed! Ratvar will rust away for all eternity!</span>"
parts += " "
Expand Down
5 changes: 5 additions & 0 deletions code/modules/antagonists/cult/cult.dm
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@

if(check_cult_victory())
parts += "<span class='greentext big'>The cult has succeeded! Nar-sie has snuffed out another torch in the void!</span>"
for(var/mind in members)
var/datum/mind/M = mind
SSachievements.unlock_achievement(/datum/achievement/greentext/narsie,M.current.client)
if(M.has_antag_datum(/datum/antagonist/cult/master))
SSachievements.unlock_achievement(/datum/achievement/greentext/narsie/master,M.current.client)
else
parts += "<span class='redtext big'>The staff managed to stop the cult! Dark words and heresy are no match for Nanotrasen's finest!</span>"

Expand Down
2 changes: 2 additions & 0 deletions code/modules/antagonists/disease/disease_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@

if(win)
result += "<span class='greentext'>The [special_role_text] was successful!</span>"
if(istype(owner.current, /mob/camera/disease))
SSachievements.unlock_achievement(/datum/achievement/greentext/disease,owner.current.client)
else
result += "<span class='redtext'>The [special_role_text] has failed!</span>"

Expand Down
8 changes: 6 additions & 2 deletions code/modules/antagonists/nukeop/nukeop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,12 @@
SSachievements.unlock_achievement(/datum/achievement/flukeops, H.client)
if(NUKE_RESULT_NUKE_WIN, NUKE_RESULT_DISK_LOST)
for(var/mob/living/carbon/human/H in GLOB.player_list)
if(is_nuclear_operative(H))
SSachievements.unlock_achievement(/datum/achievement/nukewin, H.client)
var/datum/mind/M = H.mind
if(M && M.has_antag_datum(/datum/antagonist/nukeop))
if(M.has_antag_datum(/datum/antagonist/nukeop/clownop) || M.has_antag_datum(/datum/antagonist/nukeop/leader/clownop))
SSachievements.unlock_achievement(/datum/achievement/greentext/clownop, H.client)
else
SSachievements.unlock_achievement(/datum/achievement/greentext/nukewin, H.client)


/datum/team/nuclear/antag_listing_name()
Expand Down
2 changes: 2 additions & 0 deletions code/modules/antagonists/pirate/pirate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@

if(L.check_completion() && !all_dead)
parts += "<span class='greentext big'>The pirate crew was successful!</span>"
for(var/datum/mind/M in members)
SSachievements.unlock_achievement(/datum/achievement/greentext/pirate,M.current.client)
else
parts += "<span class='redtext big'>The pirate crew has failed.</span>"

Expand Down
1 change: 1 addition & 0 deletions code/modules/antagonists/revenant/revenant_antag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "Revenant"
show_in_antagpanel = FALSE
show_name_in_check_antagonists = TRUE
greentext_achieve = /datum/achievement/greentext/revenant

/datum/antagonist/revenant/greet()
owner.announce_objectives()
Expand Down
13 changes: 13 additions & 0 deletions code/modules/antagonists/revolution/revolution.dm
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@
addtimer(CALLBACK(src,.proc/update_heads),HEAD_UPDATE_PERIOD,TIMER_UNIQUE)


/datum/team/revolution/proc/check_victory()
for(var/datum/objective/O in objectives)
if(!O.check_completion())
return FALSE
return TRUE

/datum/team/revolution/roundend_report()
if(!members.len)
return
Expand All @@ -326,6 +332,13 @@
var/list/targets = list()
var/list/datum/mind/headrevs = get_antag_minds(/datum/antagonist/rev/head)
var/list/datum/mind/revs = get_antag_minds(/datum/antagonist/rev,TRUE)
if(check_victory())
for(var/H in revs)
var/datum/mind/M = H
SSachievements.unlock_achievement(/datum/achievement/greentext/revolution,M.current.client)
if(M.has_antag_datum(/datum/antagonist/rev/head))
SSachievements.unlock_achievement(/datum/achievement/greentext/revolution/head,M.current.client)

if(headrevs.len)
var/list/headrev_part = list()
headrev_part += "<span class='header'>The head revolutionaries were:</span>"
Expand Down
3 changes: 2 additions & 1 deletion code/modules/antagonists/traitor/IAA/internal_affairs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
var/syndicate = FALSE
var/last_man_standing = FALSE
var/list/datum/mind/targets_stolen

greentext_achieve = /datum/achievement/greentext/internal

/datum/antagonist/traitor/internal_affairs/proc/give_pinpointer()
if(owner && owner.current)
Expand Down Expand Up @@ -234,6 +234,7 @@
special_role = TRAITOR_AGENT_ROLE
syndicate = TRUE
forge_single_objective()
greentext_achieve = /datum/achievement/greentext/external

/datum/antagonist/traitor/internal_affairs/forge_traitor_objectives()
forge_iaa_objectives()
Expand Down
3 changes: 3 additions & 0 deletions code/modules/antagonists/traitor/datum_traitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@

if(traitorwin)
result += "<span class='greentext'>The [special_role_text] was successful!</span>"
SSachievements.unlock_achievement(/datum/achievement/greentext,owner.current.client)
if(istype(greentext_achieve))
SSachievements.unlock_achievement(greentext_achieve,owner.current)
else
result += "<span class='redtext'>The [special_role_text] has failed!</span>"
SEND_SOUND(owner.current, 'sound/ambience/ambifailure.ogg')
Expand Down
4 changes: 2 additions & 2 deletions code/modules/antagonists/wizard/wizard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,10 @@

if(wizardwin)
parts += "<span class='greentext'>The wizard was successful!</span>"
SSachievements.unlock_achievement(/datum/achievement/wizwin, owner.current.client) //wizard wins, give achievement
SSachievements.unlock_achievement(/datum/achievement/greentext/wizwin, owner.current.client) //wizard wins, give achievement
else
parts += "<span class='redtext'>The wizard has failed!</span>"

SSachievements.unlock_achievement(/datum/achievement/redtext/winlost, owner.current.client) //wizard loses, still give achievement lol
if(owner.spell_list.len>0)
parts += "<B>[owner.name] used the following spells: </B>"
var/list/spell_names = list()
Expand Down
1 change: 1 addition & 0 deletions yogstation/code/datums/antagonists/vampire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@

if(vampwin)
result += "<span class='greentext'>The vampire was successful!</span>"
SSachievements.unlock_achievement(/datum/achievement/greentext/vampire, owner.current.client)
else
result += "<span class='redtext'>The vampire has failed!</span>"
SEND_SOUND(owner.current, 'sound/ambience/ambifailure.ogg')
Expand Down
4 changes: 4 additions & 0 deletions yogstation/code/modules/antagonists/gang/gang.dm
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@
report += "<span class='header'>[name]:</span>"
if(winner)
report += "<span class='greentext'>The [name] gang was successful!</span>"
for(var/datum/mind/M in leaders)
SSachievements.unlock_achievement(/datum/achievement/greentext/gangleader,M.current)
for(var/datum/mind/M in members) // Leaders are included in this too
SSachievements.unlock_achievement(/datum/achievement/greentext/gang,M.current) // and so get the lower achievement, too
else
report += "<span class='redtext'>The [name] gang has failed!</span>"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
SEND_SOUND(M, sound('sound/hallucinations/veryfar_noise.ogg'))
for(var/obj/machinery/power/apc/A in GLOB.apcs_list)
A.overload_lighting()
SSachievements.unlock_achievement(/datum/achievement/slingascend, H.client)
SSachievements.unlock_achievement(/datum/achievement/greentext/slingascend, H.client)
var/mob/A = new /mob/living/simple_animal/ascendant_shadowling(H.loc)
for(var/X in H.mind.spell_list)
var/obj/effect/proc_holder/spell/S = X
Expand Down