From a11ba58db7058fb6bbcdb7e021c8d553c2f748fc Mon Sep 17 00:00:00 2001 From: thgvr <81882910+thgvr@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:41:42 -0800 Subject: [PATCH] maybe fixes fishing (#2739) ## About The Pull Request This might fix fishing it worked locally ## Changelog :cl: fix: Fishing shouldn't fail constantly anymore fix: Fish on the floor will die again /:cl: --- code/modules/fishing/fish/_fish.dm | 12 ++++++------ code/modules/fishing/fishing_minigame.dm | 7 ++++++- code/modules/fishing/fishing_rod.dm | 4 ++-- tgui/packages/tgui/interfaces/Fishing.tsx | 4 +--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/code/modules/fishing/fish/_fish.dm b/code/modules/fishing/fish/_fish.dm index 48219cf98f2f..82edb0698208 100644 --- a/code/modules/fishing/fish/_fish.dm +++ b/code/modules/fishing/fish/_fish.dm @@ -33,7 +33,7 @@ /// What type of reagent this fish needs to be fed. var/food = /datum/reagent/consumable/nutriment /// How often the fish needs to be fed - var/feeding_frequency = 20 MINUTES + var/feeding_frequency = 30 MINUTES /// Time of last feedeing var/last_feeding @@ -263,12 +263,14 @@ /obj/item/fish/proc/process_health(delta_time) var/health_change_per_second = 0 + if(!proper_environment()) health_change_per_second -= 3 //Dying here - if(world.time - last_feeding <= feeding_frequency) - health_change_per_second += 0.5 //Slowly healing + if(world.time - last_feeding >= feeding_frequency) + health_change_per_second -= 0.5 //Starving else - return + health_change_per_second += 0.5 //Slowly healing + adjust_health(health + health_change_per_second) /obj/item/fish/proc/adjust_health(amt) @@ -291,8 +293,6 @@ return if(length(aquarium.tracked_fish) >= AQUARIUM_MAX_BREEDING_POPULATION) //so aquariums full of fish don't need to do these expensive checks return - if(world.time - last_feeding >= feeding_frequency) - return var/list/other_fish_of_same_type = list() for(var/obj/item/fish/fish_in_aquarium in aquarium) if(fish_in_aquarium == src || fish_in_aquarium.type != type) diff --git a/code/modules/fishing/fishing_minigame.dm b/code/modules/fishing/fishing_minigame.dm index 18db513aa6ee..eeb0696315ed 100644 --- a/code/modules/fishing/fishing_minigame.dm +++ b/code/modules/fishing/fishing_minigame.dm @@ -71,6 +71,9 @@ QDEL_NULL(fishing_line) if(lure) QDEL_NULL(lure) + SStgui.close_uis(src) + user = null + used_rod = null . = ..() /datum/fishing_challenge/proc/start(mob/user) @@ -105,6 +108,8 @@ complete(FALSE) /datum/fishing_challenge/proc/complete(win = FALSE, perfect_win = FALSE) + if(completed) + return deltimer(next_phase_timer) completed = TRUE if(user) @@ -125,7 +130,7 @@ if(reward_path != FISHING_DUD) playsound(lure, 'sound/effects/bigsplash.ogg', 100) else - user.balloon_alert(user, "it got away") + user.balloon_alert(user, "it got away!") SEND_SIGNAL(src, COMSIG_FISHING_CHALLENGE_COMPLETED, user, win, perfect_win) qdel(src) diff --git a/code/modules/fishing/fishing_rod.dm b/code/modules/fishing/fishing_rod.dm index aa6841f7f355..cfcf3d9e6126 100644 --- a/code/modules/fishing/fishing_rod.dm +++ b/code/modules/fishing/fishing_rod.dm @@ -51,7 +51,7 @@ /obj/item/fishing_rod/proc/fish_bonus(fish_type) return 0 -/obj/item/fishing_rod/proc/consume_bait() +/obj/item/fishing_rod/proc/consume_bait(atom/movable/reward) if(bait) QDEL_NULL(bait) update_appearance() @@ -137,7 +137,7 @@ SIGNAL_HANDLER . = NONE - if(!CheckToolReach(src, source.target, cast_range)) + if(!isturf(source.origin) || !isturf(source.target) || !CheckToolReach(src, source.target, cast_range)) SEND_SIGNAL(source, COMSIG_FISHING_LINE_SNAPPED) //Stepped out of range or los interrupted return BEAM_CANCEL_DRAW diff --git a/tgui/packages/tgui/interfaces/Fishing.tsx b/tgui/packages/tgui/interfaces/Fishing.tsx index 2bd9e0426733..22215bf47492 100644 --- a/tgui/packages/tgui/interfaces/Fishing.tsx +++ b/tgui/packages/tgui/interfaces/Fishing.tsx @@ -8,7 +8,7 @@ import { import { useDispatch } from 'common/redux'; import { Component } from 'inferno'; import { resolveAsset } from '../assets'; -import { backendSuspendStart, useBackend } from '../backend'; +import { useBackend } from '../backend'; import { Icon } from '../components'; import { globalEvents } from '../events'; import { Window } from '../layouts'; @@ -360,10 +360,8 @@ class FishingMinigame extends Component< if (newCompletion <= 0) { this.props.lose(); - dispatch(backendSuspendStart()); } else if (newCompletion >= 100) { this.props.win(this.perfect); - dispatch(backendSuspendStart()); } return newState;