Tweaked fishing a bit. Fixed bug with residents letting fires go out.

This commit is contained in:
Storm Dragon
2026-01-24 19:22:19 -05:00
parent 32a8d86f33
commit cbacdd7a26
4 changed files with 12 additions and 2 deletions

View File

@@ -116,7 +116,8 @@ void attempt_resident_fish_smoking() {
void keep_base_fires_fed() { void keep_base_fires_fed() {
if (residents_count <= 0) return; if (residents_count <= 0) return;
if (get_storage_count(ITEM_MEAT) <= 0) return; int total_food = get_storage_count(ITEM_MEAT) + get_storage_count(ITEM_SMOKED_FISH);
if (total_food <= 0) return;
if (get_storage_count(ITEM_STICKS) <= 0 && get_storage_count(ITEM_LOGS) <= 0) return; if (get_storage_count(ITEM_STICKS) <= 0 && get_storage_count(ITEM_LOGS) <= 0) return;
for (uint i = 0; i < world_fires.length(); i++) { for (uint i = 0; i < world_fires.length(); i++) {

View File

@@ -38,6 +38,7 @@ void reset_fishing_session() {
is_reeling = false; is_reeling = false;
cast_position = -1; cast_position = -1;
reel_position = -1; reel_position = -1;
line_position = -1;
cast_origin_x = -1; cast_origin_x = -1;
cast_direction = 0; cast_direction = 0;
reel_direction = 0; reel_direction = 0;
@@ -203,12 +204,14 @@ void release_cast() {
if (is_any_water_at(cast_position)) { if (is_any_water_at(cast_position)) {
line_in_water = true; line_in_water = true;
line_position = cast_position;
catch_chance = 0; catch_chance = 0;
fishing_checks_done = 0; fishing_checks_done = 0;
fishing_timer.restart(); fishing_timer.restart();
p.play_stationary("sounds/actions/start_fishing.ogg", false); p.play_stationary("sounds/actions/start_fishing.ogg", false);
} else { } else {
p.play_stationary("sounds/actions/bad_cast.ogg", false); p.play_stationary("sounds/actions/bad_cast.ogg", false);
line_position = -1;
if (random(1, 100) <= FISHING_BAD_CAST_BREAK_CHANCE) { if (random(1, 100) <= FISHING_BAD_CAST_BREAK_CHANCE) {
break_fishing_pole("Your fishing pole broke."); break_fishing_pole("Your fishing pole broke.");
return; return;
@@ -234,7 +237,7 @@ void update_waiting_for_fish() {
if (catch_chance > 0 && random(1, 100) <= catch_chance) { if (catch_chance > 0 && random(1, 100) <= catch_chance) {
line_in_water = false; line_in_water = false;
fish_on_line = true; fish_on_line = true;
reel_position = get_random_stream_tile(); reel_position = (line_position >= 0) ? line_position : get_random_stream_tile();
reel_direction = 0; reel_direction = 0;
hooked_fish_type = get_random_fish_type(); hooked_fish_type = get_random_fish_type();
speak_with_history("A fish is on the line!", true); speak_with_history("A fish is on the line!", true);
@@ -245,6 +248,9 @@ void update_waiting_for_fish() {
void start_reeling() { void start_reeling() {
if (!fish_on_line || is_reeling) return; if (!fish_on_line || is_reeling) return;
if (reel_position < 0) {
reel_position = (line_position >= 0) ? line_position : get_random_stream_tile();
}
is_reeling = true; is_reeling = true;
reel_start_direction = (reel_position < x) ? 1 : -1; reel_start_direction = (reel_position < x) ? 1 : -1;
reel_direction = reel_start_direction; reel_direction = reel_start_direction;
@@ -385,6 +391,7 @@ void update_fishing() {
if (line_in_water) { if (line_in_water) {
if (ctrl_pressed && !fish_on_line && !is_reeling) { if (ctrl_pressed && !fish_on_line && !is_reeling) {
line_in_water = false; line_in_water = false;
line_position = -1;
catch_chance = 0; catch_chance = 0;
fishing_checks_done = 0; fishing_checks_done = 0;
fishing_timer.restart(); fishing_timer.restart();

View File

@@ -42,6 +42,7 @@ bool fish_on_line = false; // Fish caught, reeling phase
bool is_reeling = false; // Holding control during reel bool is_reeling = false; // Holding control during reel
int cast_position = -1; // Current position of cast cursor int cast_position = -1; // Current position of cast cursor
int reel_position = -1; // Position of fish during reel int reel_position = -1; // Position of fish during reel
int line_position = -1; // Where the line landed in the water
int cast_origin_x = -1; // Player position when casting started int cast_origin_x = -1; // Player position when casting started
int cast_direction = 0; // 1 = moving toward stream, -1 = moving back int cast_direction = 0; // 1 = moving toward stream, -1 = moving back
int reel_direction = 0; // 1 = moving toward player, -1 = moving past int reel_direction = 0; // 1 = moving toward player, -1 = moving past

View File

@@ -179,6 +179,7 @@ void reset_game_state() {
is_reeling = false; is_reeling = false;
cast_position = -1; cast_position = -1;
reel_position = -1; reel_position = -1;
line_position = -1;
cast_origin_x = -1; cast_origin_x = -1;
cast_direction = 0; cast_direction = 0;
reel_direction = 0; reel_direction = 0;