Achievements
Vars | |
CE | The current guy that SSachievements believes to be the CE. See /datum/controller/subsystem/achievements/proc/fire |
---|---|
achievements | List of all the achievement instances, one for each achievement. Access through /datum/controller/subsystem/achievements/proc/get_achievement |
achievementsEarned | Dictionary of all achievements earned this round. Key is a username, value is a list of achievements that have been earnt by that username. |
browsers | Dictionary of all achievement browsers. Key is a username, value is the given browser. See /datum/achievement_browser and /datum/controller/subsystem/achievements/get_browser |
cached_achievements | Dictionary of cached achievements. Key is a username, value is a dictionary where the keys are achievements and the values are booleans signifying completion. See /datum/controller/subsystem/achievements/proc/cache_achievements |
Procs | |
Initialize | Sets up all the lists used by the subsystem and updates the database |
cache_achievements | Creates a cache of all achievements and whether or not they're unlocked for the given ckey |
fire | Subsystem firing, checks solar panel achievement |
get_achievement | Gets the achievement instance for the given achievement path |
get_browser | Gets the achievement browser for the given client. See /datum/achievement_browser |
has_achievement | Checks whether the client has an achievement. |
unlock_achievement | Unlocks the given achievement for the given client. |
Var Details
CE
The current guy that SSachievements believes to be the CE. See /datum/controller/subsystem/achievements/proc/fire
achievements
List of all the achievement instances, one for each achievement. Access through /datum/controller/subsystem/achievements/proc/get_achievement
achievementsEarned
Dictionary of all achievements earned this round. Key is a username, value is a list of achievements that have been earnt by that username.
browsers
Dictionary of all achievement browsers. Key is a username, value is the given browser. See /datum/achievement_browser and /datum/controller/subsystem/achievements/get_browser
cached_achievements
Dictionary of cached achievements. Key is a username, value is a dictionary where the keys are achievements and the values are booleans signifying completion. See /datum/controller/subsystem/achievements/proc/cache_achievements
Proc Details
Initialize
Sets up all the lists used by the subsystem and updates the database
First it creates all the achievement instances, then it updates the database to remove old achievements and add any new ones It also updates old achievement name/descriptions in the database to the new ones
Arguments:
- timeofday - Time of initialization, used to calculate how long SS initialization took
cache_achievements
Creates a cache of all achievements and whether or not they're unlocked for the given ckey
Will likely not work if admins call this proc, since SQL calls as a result of admin calls are blocked
Arguments:
- C - Client that you're caching for, See /client
fire
Subsystem firing, checks solar panel achievement
Checks whether there's currently a CE, if there isn't, it tries to find one Otherwise, it checks to see whether /datum/achievement/engineering/scotty should be triggered. It then calls /datum/controller/subsystem/proc/fire
Arguments:
- resumed - Whether or not this was resumed from last tick (unlikely with this subsystem)
get_achievement
Gets the achievement instance for the given achievement path
Will return false if it doesn't exist, otherwise it'll get that exact achievement (subtypes aren't accepted)
Arguments:
- achievementPath - The typepath for the achievement you're trying to get. See /datum/achievement
get_browser
Gets the achievement browser for the given client. See /datum/achievement_browser
If the achievement_browser doesn't exist, it'll create it and then return it
Arguments:
- C - Client that you're getting the browser for, See /client
has_achievement
Checks whether the client has an achievement.
Will create a cache of the given client's achievements if it doesn't already exist
Arguments:
- achievementPath - The typepath for the achievement you're checking. See /datum/achievement
- C - Client that you're checking it for, See /client
unlock_achievement
Unlocks the given achievement for the given client.
Will log if the achievement getting unlocked doesn't exist. Will unlock the given achievement, save it to the DB and cache it for the round. This won't work if you're admin calling the proc, since SQL blocks admin-called queries
Arguments:
- achievementPath - The typepath for the achievement you're trying to unlock. See /datum/achievement
- C - Client that you're unlocking it for, See /client