Weather system added, mostly decoration. Some tweaks to residents. Moved altar to its own menu, s for sacrifice. You can no longer burn incense outside the base.

This commit is contained in:
Storm Dragon
2026-01-20 12:30:26 -05:00
parent 9b7fbc8266
commit 4caa5caefb
28 changed files with 1973 additions and 72 deletions
+54 -17
View File
@@ -1,3 +1,34 @@
// Centralized falling damage system
// Safe fall height is 10 feet or less
// Each foot above 10 has a chance to deal 0-4 damage
// This means falling from great heights is VERY dangerous but not guaranteed fatal
const int SAFE_FALL_HEIGHT = 10;
const int FALL_DAMAGE_MIN = 0;
const int FALL_DAMAGE_MAX = 4;
void apply_falling_damage(int fall_height) {
// Always play the hit ground sound
p.play_stationary("sounds/actions/hit_ground.ogg", false);
if (fall_height <= SAFE_FALL_HEIGHT) {
screen_reader_speak("Landed safely.", true);
return;
}
// Calculate damage: roll 0-4 for each foot above 10
int damage = 0;
for (int i = SAFE_FALL_HEIGHT; i < fall_height; i++) {
damage += random(FALL_DAMAGE_MIN, FALL_DAMAGE_MAX);
}
// Apply damage
player_health -= damage;
if (player_health < 0) player_health = 0;
// Feedback
screen_reader_speak("Fell " + fall_height + " feet! Took " + damage + " damage. " + player_health + " health remaining.", true);
}
// Tree Object
class Tree {
int position;
@@ -45,7 +76,7 @@ class Tree {
int tree_distance = x - position;
if (tree_distance < 0) tree_distance = -tree_distance;
if (tree_distance <= 4) {
if (tree_distance <= TREE_SOUND_RANGE) {
if (sound_handle == -1 || !p.sound_is_active(sound_handle)) {
sound_handle = p.play_1d("sounds/environment/tree.ogg", x, position, true);
if (sound_handle != -1) {
@@ -140,10 +171,16 @@ class Tree {
Tree@[] trees;
bool tree_too_close(int pos) {
// Check distance from base (must be at least 5 tiles away)
if (pos <= BASE_END + 5) {
return true;
}
// Check distance from other trees (must be at least 10 tiles apart)
for (uint i = 0; i < trees.length(); i++) {
int distance = trees[i].position - pos;
if (distance < 0) distance = -distance;
if (distance <= 5) {
if (distance < 10) {
return true;
}
}
@@ -235,6 +272,19 @@ void damage_tree(int target_x, int damage) {
void perform_search(int current_x)
{
// First priority: Check for world drops on this tile or adjacent
for (int check_x = current_x - 1; check_x <= current_x + 1; check_x++) {
WorldDrop@ drop = get_drop_at(check_x);
if (drop != null) {
if (!try_pickup_world_drop(drop)) {
return;
}
p.play_stationary("sounds/items/miscellaneous.ogg", false);
remove_drop_at(check_x);
return;
}
}
// Check for snares nearby (adjacent within range)
for (int check_x = current_x - SNARE_COLLECT_RANGE; check_x <= current_x + SNARE_COLLECT_RANGE; check_x++) {
// Skip current x? User said "beside". If on top, it breaks.
@@ -543,23 +593,10 @@ void land_on_ground(int ground_level) {
fall_sound_handle = -1;
}
p.play_stationary("sounds/actions/hit_ground.ogg", false);
// Calculate fall damage
// Calculate fall damage using centralized function (also plays hit_ground sound)
int fall_height = fall_start_y - ground_level;
y = ground_level;
if (fall_height > 10) {
int damage = 0;
for (int i = 10; i < fall_height; i++) {
damage += random(1, 3);
}
player_health -= damage;
screen_reader_speak("Fell " + fall_height + " feet! Took " + damage + " damage. " + player_health + " health remaining.", true);
} else {
screen_reader_speak("Landed safely.", true);
}
apply_falling_damage(fall_height);
fall_start_y = 0;
}