Files
Bubberstation/code/datums/achievements/misc_scores.dm
Kapu1178 a0e862d575 Base implementation of /datum/persistent_client (#89449)
## About The Pull Request
Converts `/datum/player_details` into `/datum/persistent_client`.
Persistent Clients persist across connections. The only time a mob's
persistent client will change is if the ckey it's bound to logs into a
different mob, or the mob is deleted (duh).

Also adds PossessByPlayer() so that transfering mob control is cleaner
and makes more immediate sense if you don't know byond-fu.

## Why It's Good For The Game
Clients are an abstract representation of a connection that can be
dropped at almost any moment so putting things that should be stable to
access at any time onto an undying object is ideal. This allows for
future expansions like abstracting away client.screen and managing
everything cleanly.
2025-02-25 13:52:24 -06:00

95 lines
3.3 KiB
Plaintext

///How many times did we survive being a cripple?
/datum/award/score/hardcore_random
name = "Hardcore random points"
desc = "Well, I might be a blind, deaf, crippled guy, but hey, at least I'm alive."
database_id = HARDCORE_RANDOM_SCORE
///How many maintenance pills did you eat?
/datum/award/score/maintenance_pill
name = "Maintenance Pills Consumed"
desc = "Wait why?"
database_id = MAINTENANCE_PILL_SCORE
///How high of a score on the Intento did we get?
/datum/award/score/intento_score
name = "Intento Score"
desc = "A blast from the future?"
database_id = INTENTO_SCORE
/// What's the highest amount of style points we've gotten?
/datum/award/score/style_score
name = "Style Score"
desc = "You might not be a robot, but you were damn close."
database_id = STYLE_SCORE
/datum/award/score/progress/fish
name = "Fish Species Caught"
desc = "How many different species of fish you've caught so far. Gotta fish 'em all."
database_id = FISH_SCORE
var/list/early_entries_to_validate = list()
/datum/award/score/progress/fish/New()
. = ..()
RegisterSignal(SSfishing, COMSIG_SUBSYSTEM_POST_INITIALIZE, PROC_REF(validate_early_joiners))
/datum/award/score/progress/fish/get_table()
return "fish_progress"
/datum/award/score/progress/fish/proc/validate_early_joiners(datum/source)
for(var/client/client as anything in GLOB.clients)
var/datum/achievement_data/holder = client.persistent_client.achievements
if(!holder?.initialized)
continue
var/list/entries = holder.data[/datum/award/score/progress/fish]
var/list_copied = FALSE
for(var/fish_id in entries)
if(SSfishing.catchable_fish[fish_id])
continue
//make a new list, unbound from the cached awards data, so that the score can be updated at the end of the round.
if(!list_copied)
entries = entries.Copy()
holder.data[/datum/award/score/progress/fish] = entries
list_copied = TRUE
entries -= fish_id
/datum/award/score/progress/fish/validate_entries(list/entries, list/validated_entries)
. = ..()
if(!SSfishing.initialized)
return
for(var/fish_id in validated_entries)
if(!(SSfishing.catchable_fish[fish_id]))
validated_entries -= fish_id
. = FALSE
/datum/award/score/progress/fish/get_progress(datum/achievement_data/holder)
var/list/data = list(
"name" = "Fishdex",
"percent" = 0,
"value_text" = "Subsystems still initializing...",
"entries" = list(),
)
if(!SSfishing.initialized)
return data
var/list/catched_fish = holder.data[type]
var/catched_len = length(catched_fish)
var/catchable_len = length(SSfishing.catchable_fish)
data["percent"] = catched_len/catchable_len
data["value_text"] = "[catched_len] / [catchable_len]"
var/index = 1
var/max_zeros = round(log(10, catchable_len))
for(var/fish_id in SSfishing.catchable_fish)
var/obj/item/fish/fish = SSfishing.catchable_fish[fish_id]
var/catched = (fish_id in catched_fish)
var/entry_name = "◦[prefix_zeros_to_number(index, max_zeros)]◦ [catched ? full_capitalize(initial(fish.name)) : "??????" ]"
var/list/icon_dimensions = get_icon_dimensions(initial(fish.icon))
data["entries"] += list(list(
"name" = entry_name,
"icon" = catched ? SSfishing.cached_fish_icons[fish] : SSfishing.cached_unknown_fish_icons[fish],
"height" = icon_dimensions["height"] * 2,
"width" = icon_dimensions["width"] * 2,
))
index++
return data