Initial implementation of fishing system. A couple bugs fixed, e.g. zombies that are killed by residents actually die.

This commit is contained in:
Storm Dragon
2026-01-24 14:01:38 -05:00
parent 63cf759002
commit 0d711095c1
23 changed files with 837 additions and 47 deletions

View File

@@ -91,17 +91,31 @@ void expand_regular_area() {
expanded_terrain_types.insert_last(terrain_type);
}
// Place exactly one feature: either a stream or a tree
bool place_stream = (terrain_type != "grass") || (random(0, 1) == 0);
// Place features based on terrain type
// Forests get trees, other terrain gets streams or trees
bool place_tree = false;
if (terrain_type == "deep_forest") {
// Deep forest: 80% tree, 20% stream
place_tree = (random(1, 100) <= 80);
} else if (terrain_type == "forest") {
// Forest: 60% tree, 40% stream
place_tree = (random(1, 100) <= 60);
} else if (terrain_type == "grass") {
// Grass: 50% tree, 50% stream
place_tree = (random(0, 1) == 0);
} else {
// Stone/snow: no trees, always stream
place_tree = false;
}
if (place_stream) {
if (place_tree) {
// Try to place a tree with proper spacing and per-area limits
spawn_tree_in_area(new_start, new_end);
} else {
int stream_width = random(1, 5);
int stream_start = random(0, EXPANSION_SIZE - stream_width);
int actual_start = new_start + stream_start;
add_world_stream(actual_start, stream_width);
} else {
// Try to place a tree with proper spacing and per-area limits
spawn_tree_in_area(new_start, new_end);
}
area_expanded_today = true;
@@ -360,6 +374,10 @@ void update_time() {
invasion_roll_done_today = false;
invasion_scheduled_hour = -1;
quest_roll_done_today = false;
}
// Residents consume food every 8 hours (at midnight, 8am, 4pm)
if (current_hour % 8 == 0) {
consume_food_for_residents();
}
@@ -405,6 +423,8 @@ void update_time() {
check_weather_transition();
attempt_resident_collection();
attempt_resident_snare_retrieval();
attempt_resident_fishing();
attempt_resident_fish_smoking();
if (current_hour == 6) {
save_game_state();
}