mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +01:00
Adds a score for all species of fish that you've caught. (#86049)
## About The Pull Request I'm adding a score that tracks which types of fish you've caught across multiple rounds. To do so, I had to add a new score subtype that manages the score value not being a number. Thankfully the achievement code is fairly flexible so not a whole lot had to be done, although I've to add a new column to the achievements table in the DB, because the 'value' is for integers, while we need one for text strings ~~(the contents of the list are converted to text with a delimiter before being saved cuz I'm not sure if and how our DM slash SQL integration handles using lists directly and I don't want to waste time finding it out)~~. EDIT: It's mostly done beside the reviews that are going to point out things that need to be changed. The UI changes are done. It's time for reviews. Here are screenshots of the UI with all fish still uncatched beside one (I've since then the typo on its name and removed an extra zero from the index number, as well as a nit with the spacing between cells):   ## Why It's Good For The Game We have about dozens over dozens of different fish in the game now, many of which are just fluff anyway. It's getting to the point it's perhaps doable to add a score or something to be a braggard about. ## Changelog 🆑 add: Added a new score that keeps track of all different fish that you've caught between shifts. server: Added a new schema table to store the aforementioned entries and the ckeys associated to them, with an additional timestamp column. /🆑
This commit is contained in:
@@ -3,15 +3,37 @@ PROCESSING_SUBSYSTEM_DEF(fishing)
|
||||
name = "Fishing"
|
||||
flags = SS_BACKGROUND|SS_POST_FIRE_TIMING
|
||||
wait = 0.05 SECONDS // If you raise it to 0.1 SECONDS, you better also modify [datum/fish_movement/move_fish()]
|
||||
///A list of cached fish icons
|
||||
var/list/cached_fish_icons
|
||||
///A list of cached fish icons turns into outlines with a queston mark in the middle, denoting fish you haven't caught yet.
|
||||
var/list/cached_unknown_fish_icons
|
||||
///An assoc list of identifier strings and the path of a fish that can be gotten from fish sources.
|
||||
var/list/catchable_fish
|
||||
///Cached fish properties so we don't have to initalize fish every time
|
||||
var/list/fish_properties
|
||||
///A cache of fish that can be caught by each type of fishing lure
|
||||
var/list/lure_catchables
|
||||
|
||||
/datum/controller/subsystem/processing/fishing/Initialize()
|
||||
///init the properties
|
||||
..()
|
||||
cached_fish_icons = list()
|
||||
cached_unknown_fish_icons = list()
|
||||
fish_properties = list()
|
||||
for(var/fish_type in subtypesof(/obj/item/fish))
|
||||
|
||||
var/icon/questionmark = icon('icons/effects/random_spawners.dmi', "questionmark")
|
||||
var/list/mark_dimension = get_icon_dimensions(questionmark)
|
||||
for(var/obj/item/fish/fish_type as anything in subtypesof(/obj/item/fish))
|
||||
var/list/fish_dimensions = get_icon_dimensions(fish_type::icon)
|
||||
var/icon/fish_icon = icon(fish_type::icon, fish_type::icon_state, frame = 1, moving = FALSE)
|
||||
cached_fish_icons[fish_type] = icon2base64(fish_icon)
|
||||
var/icon/unknown_icon = icon(fish_icon)
|
||||
unknown_icon.Blend("#FFFFFF", ICON_SUBTRACT)
|
||||
unknown_icon.Blend("#070707", ICON_ADD)
|
||||
var/width = 1 + (fish_dimensions["width"] - mark_dimension["width"]) * 0.5
|
||||
var/height = 1 + (fish_dimensions["height"] - mark_dimension["height"]) * 0.5
|
||||
unknown_icon.Blend(questionmark, ICON_OVERLAY, x = width, y = height)
|
||||
cached_unknown_fish_icons[fish_type] = icon2base64(unknown_icon)
|
||||
|
||||
var/obj/item/fish/fish = new fish_type(null, FALSE)
|
||||
var/list/properties = list()
|
||||
fish_properties[fish_type] = properties
|
||||
@@ -47,6 +69,25 @@ PROCESSING_SUBSYSTEM_DEF(fishing)
|
||||
|
||||
qdel(fish)
|
||||
|
||||
catchable_fish = list()
|
||||
var/list/all_catchables = list()
|
||||
for(var/source_type as anything in GLOB.preset_fish_sources)
|
||||
var/datum/fish_source/source = GLOB.preset_fish_sources[source_type]
|
||||
if(!(source.fish_source_flags & FISH_SOURCE_FLAG_SKIP_CATCHABLES))
|
||||
all_catchables |= source.fish_table
|
||||
for(var/thing in all_catchables)
|
||||
if(!ispath(thing, /obj/item/fish))
|
||||
continue
|
||||
var/obj/item/fish/fishie = thing
|
||||
var/fish_id = initial(fishie.fish_id)
|
||||
if(!fish_id)
|
||||
stack_trace("[fishie] doesn't have a set 'fish_id' variable despite being a catchable fish")
|
||||
continue
|
||||
if(catchable_fish[fish_id])
|
||||
stack_trace("[fishie] has a 'fish_id' value already assigned to [catchable_fish[fish_id]]. fish_id: [fish_id]")
|
||||
continue
|
||||
catchable_fish[fish_id] = fishie
|
||||
|
||||
///init the list of things lures can catch
|
||||
lure_catchables = list()
|
||||
var/list/fish_types = subtypesof(/obj/item/fish)
|
||||
|
||||
Reference in New Issue
Block a user