Files
Bubberstation/code/datums/components/fishing_spot.dm
T
3f95ebbd5e [MIRROR] Fishing, Version 1 [MDB IGNORE] (#14370)
* Fishing, Version 1 (#67691)

Adds fishing and fishing minigame.
You use fishing rod to fish.
Equipping specific bait/hook/reels will affect your success chances.
You can fish out fish,items and other things.

Fishing Equipment
Fishing rods have three slots: Bait, Reel and Hook.
Any food can be used as bait but dedicated bait makes fishing easier.
You can buy hook and line sets
New bait types:

Worms : Buy can of them at cargo (alternative acquirement method pending)
Doughballs : Use knife on flat piece of dough to get five of them.
Fishing rod types:

Basic : Print these at the lathe, nothing fancy here.
Tech: Experimental tech. Provides infinite bait
Fishing rods can also hook and reel normal items.

Equipment screen and reeling video
Fishing spots
Keep in mind this PR is meant to add the basic systems and i intend to fill these with more fish in future PR's so wait with suggestions until then.

Lavaland lava (no fish here right now, just other stuff), requires reinforced line to fish in.
Maintenance moisture traps.
Beach away mission water.
Fishing portal available for purchase from cargo - This is stopgap until we fill more spots.
Difficulty depends on fishing spot, fish type, and the fish traits and rod setup combinations.
All fish types can have specific traits, most common ones being favourite and disliked bait types/categories.

Other
Fishing catalog now lists fishing related info
New admin debug verb, fishing calculator that show probabilities with different setups so it's easier to balance this.
Fish now have average weight and size. Make sure to boast if you catch a big one.
Adds tgui mouse passthrough
Screens
Sprites:

Fishing portal sprite by @ ArcaneMusic
Other sprites by @ Mey-Ha-Zah
Bad ones by me. (Could still use better fishing minigame backgrounds)
Sounds:

https://freesound.org/people/soundscalpel.com/sounds/110393/
https://freesound.org/people/soundslikewillem/sounds/343748/

* Fishing, Version 1

Co-authored-by: AnturK <AnturK@users.noreply.github.com>
2022-06-17 00:30:40 +01:00

63 lines
2.5 KiB
Plaintext

// A thing you can fish in
/datum/component/fishing_spot
/// Defines the probabilities and fish availibilty
var/datum/fish_source/fish_source
/datum/component/fishing_spot/Initialize(configuration)
if(ispath(configuration,/datum/fish_source))
//Create new one of the given type
fish_source = new configuration
else if(istype(configuration,/datum/fish_source))
//Use passed in instance
fish_source = configuration
else
/// Check if it's a preset key
var/datum/fish_source/preset_configuration = GLOB.preset_fish_sources[configuration]
if(!preset_configuration)
stack_trace("Invalid fishing spot configuration \"[configuration]\" passed down to fishing spot component.")
return COMPONENT_INCOMPATIBLE
fish_source = preset_configuration
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/handle_attackby)
RegisterSignal(parent, COMSIG_FISHING_ROD_CAST, .proc/handle_cast)
/datum/component/fishing_spot/proc/handle_cast(datum/source, obj/item/fishing_rod/rod, mob/user)
SIGNAL_HANDLER
if(try_start_fishing(rod,user))
return FISHING_ROD_CAST_HANDLED
return NONE
/datum/component/fishing_spot/proc/handle_attackby(datum/source, obj/item/item, mob/user, params)
SIGNAL_HANDLER
if(try_start_fishing(item,user))
return COMPONENT_NO_AFTERATTACK
return NONE
/datum/component/fishing_spot/proc/try_start_fishing(obj/item/possibly_rod, mob/user)
SIGNAL_HANDLER
var/obj/item/fishing_rod/rod = possibly_rod
if(!istype(rod))
return
if(HAS_TRAIT(user,TRAIT_GONE_FISHING) || rod.currently_hooked_item)
user.balloon_alert(user, "already fishing")
return COMPONENT_NO_AFTERATTACK
var/denial_reason = fish_source.can_fish(rod, user)
if(denial_reason)
to_chat(user, span_warning(denial_reason))
return COMPONENT_NO_AFTERATTACK
start_fishing_challenge(rod, user)
return COMPONENT_NO_AFTERATTACK
/datum/component/fishing_spot/proc/start_fishing_challenge(obj/item/fishing_rod/rod, mob/user)
/// Roll what we caught based on modified table
var/result = fish_source.roll_reward(rod, user)
var/datum/fishing_challenge/challenge = new(parent, result, rod, user)
challenge.background = fish_source.background
challenge.difficulty = fish_source.calculate_difficulty(result, rod, user)
RegisterSignal(challenge, COMSIG_FISHING_CHALLENGE_COMPLETED, .proc/fishing_completed)
challenge.start(user)
/datum/component/fishing_spot/proc/fishing_completed(datum/fishing_challenge/source, mob/user, success, perfect)
if(success)
fish_source.dispense_reward(source.reward_path, user)