Skip to content

Commit

Permalink
maybe fixes fishing (#2739)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
This might fix fishing it worked locally
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Changelog

:cl:
fix: Fishing shouldn't fail constantly anymore
fix: Fish on the floor will die again
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
thgvr authored Mar 4, 2024
1 parent 200d2b3 commit a11ba58
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
12 changes: 6 additions & 6 deletions code/modules/fishing/fish/_fish.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion code/modules/fishing/fishing_minigame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions code/modules/fishing/fishing_rod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions tgui/packages/tgui/interfaces/Fishing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a11ba58

Please sign in to comment.