Aquariums are now potential fishing spots. (#88243)

## About The Pull Request
You can now fish from aquariums if you wish to. This includes some
backend changes to make it possible for the fish table from
get_fish_table() to contain instances, and all that it entails up to
spawn_reward(), which is a requirement for the gimmick to respect the
various traits and other variables of the already instantiated fish
rather than read from cached properties.

## Why It's Good For The Game
The fish progress score/index had only little nasty flaw that has been
nagging me since day one: Not all fish species can be caught. Skipping
McGill, which is a peculiar case that for cheevo purposes should be
considered a standard goldfish, there is the one, unsignificant yet rare
purple sludgefish which can only be gotten as a rare evolution of the
generic sludgefish. Talk about petty, but this may be a long-term nit I
prefer to handle right now.

Also why not? The 'unmarine mastodon' is near impossible to get unless
you somehow find a oil well which is locked behind a specific ruin.

## Changelog

🆑
fix: Aquariums are now potential fishing spots.
/🆑
This commit is contained in:
Ghom
2024-11-29 04:33:18 +01:00
committed by GitHub
parent ccc2533380
commit 1dff5f6de3
19 changed files with 221 additions and 130 deletions
@@ -19,10 +19,13 @@ PROCESSING_SUBSYSTEM_DEF(fishing)
cached_fish_icons = list()
cached_unknown_fish_icons = list()
fish_properties = list()
catchable_fish = list()
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/spawned_fish = list()
var/list/fish_subtypes = sortTim(subtypesof(/obj/item/fish), GLOBAL_PROC_REF(cmp_init_name_asc))
for(var/obj/item/fish/fish_type as anything in fish_subtypes)
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)
@@ -35,6 +38,7 @@ PROCESSING_SUBSYSTEM_DEF(fishing)
cached_unknown_fish_icons[fish_type] = icon2base64(unknown_icon)
var/obj/item/fish/fish = new fish_type(null, FALSE)
spawned_fish += fish
var/list/properties = list()
fish_properties[fish_type] = properties
properties[FISH_PROPERTIES_FAV_BAIT] = fish.favorite_bait.Copy()
@@ -67,36 +71,35 @@ PROCESSING_SUBSYSTEM_DEF(fishing)
properties[FISH_PROPERTIES_BEAUTY_SCORE] = beauty_score
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)
var/fish_id
if(fish.fish_id_redirect_path)
var/obj/item/fish/other_path = fish.fish_id_redirect_path
if(!ispath(other_path, /obj/item/fish))
stack_trace("[fish.type] has a set 'fish_id_redirect_path' variable but it isn't a fish path but [other_path]")
continue
fish_id = initial(other_path.fish_id)
else
fish_id = fish.fish_id
if(!fish_id)
stack_trace("[fishie] doesn't have a set 'fish_id' variable despite being a catchable fish")
stack_trace("[fish.type] doesn't have a set 'fish_id' variable despite being a catchable fish")
continue
if(fish.fish_id_redirect_path)
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]")
stack_trace("[fish.type] has a 'fish_id' value already assigned to [catchable_fish[fish_id]]. fish_id: [fish_id]")
continue
catchable_fish[fish_id] = fishie
catchable_fish[fish_id] = fish.type
///init the list of things lures can catch
lure_catchables = list()
var/list/fish_types = subtypesof(/obj/item/fish)
for(var/lure_type in typesof(/obj/item/fishing_lure))
var/obj/item/fishing_lure/lure = new lure_type
lure_catchables[lure_type] = list()
for(var/obj/item/fish/fish_type as anything in fish_types)
if(lure.is_catchable_fish(fish_type, fish_properties[fish_type]))
lure_catchables[lure_type] += fish_type
for(var/obj/item/fish/fish as anything in spawned_fish)
if(lure.is_catchable_fish(fish, fish_properties[fish.type]))
lure_catchables[lure_type] += fish.type
qdel(lure)
QDEL_LIST(spawned_fish)
return SS_INIT_SUCCESS