A ton of changes including bug fixes, new craftable items, altar with favor system added. Info for player and base added.

This commit is contained in:
Storm Dragon
2026-01-18 22:25:38 -05:00
parent 95a3f4a96c
commit 489408a181
40 changed files with 3910 additions and 1046 deletions
+92 -27
View File
@@ -132,10 +132,28 @@ class Tree {
}
Tree@[] trees;
bool tree_too_close(int pos) {
for (uint i = 0; i < trees.length(); i++) {
int distance = trees[i].position - pos;
if (distance < 0) distance = -distance;
if (distance <= 5) {
return true;
}
}
return false;
}
void spawn_trees(int grass_start, int grass_end) {
int pos = random(grass_start, grass_end);
Tree@ t = Tree(pos);
trees.insert_last(t);
int attempts = 10;
for (int i = 0; i < attempts; i++) {
int pos = random(grass_start, grass_end);
if (tree_too_close(pos)) {
continue;
}
Tree@ t = Tree(pos);
trees.insert_last(t);
return;
}
}
void update_environment() {
@@ -225,11 +243,11 @@ void perform_search(int current_x)
WorldSnare@ s = get_snare_at(check_x);
if (s != null) {
if (s.has_catch) {
if (inv_small_game >= MAX_ITEM_STACK) {
if (inv_small_game >= get_personal_stack_limit()) {
screen_reader_speak("You can't carry any more small game.", true);
return;
}
if (inv_snares >= MAX_ITEM_STACK) {
if (inv_snares >= get_personal_stack_limit()) {
screen_reader_speak("You can't carry any more snares.", true);
return;
}
@@ -238,7 +256,7 @@ void perform_search(int current_x)
inv_snares++; // Recover snare
screen_reader_speak("Collected " + s.catch_type + " and snare.", true);
} else {
if (inv_snares >= MAX_ITEM_STACK) {
if (inv_snares >= get_personal_stack_limit()) {
screen_reader_speak("You can't carry any more snares.", true);
return;
}
@@ -251,7 +269,12 @@ void perform_search(int current_x)
}
}
// Stream banks - Clay (within stream sound range, but not in water)
if (random(1, 100) <= 10) {
screen_reader_speak("Found nothing.", true);
return;
}
// Stream banks - Clay or reeds (within 3 tiles of stream, but not in water)
bool near_stream_bank = false;
for (uint i = 0; i < world_streams.length(); i++) {
if (world_streams[i].contains_position(current_x)) {
@@ -267,10 +290,33 @@ void perform_search(int current_x)
}
if (near_stream_bank) {
if (inv_clay < MAX_ITEM_STACK) {
bool found_reed = random(1, 100) <= 30;
if (found_reed) {
if (inv_reeds < get_personal_stack_limit()) {
inv_reeds++;
p.play_stationary("sounds/items/stick.ogg", false);
screen_reader_speak("Found a reed.", true);
return;
}
} else {
if (inv_clay < get_personal_stack_limit()) {
inv_clay++;
p.play_stationary("sounds/items/clay.ogg", false);
screen_reader_speak("Found clay.", true);
return;
}
}
if (!found_reed && inv_reeds < get_personal_stack_limit()) {
inv_reeds++;
p.play_stationary("sounds/items/stick.ogg", false);
screen_reader_speak("Found a reed.", true);
} else if (found_reed && inv_clay < get_personal_stack_limit()) {
inv_clay++;
p.play_stationary("sounds/items/clay.ogg", false);
screen_reader_speak("Found clay.", true);
} else if (found_reed) {
screen_reader_speak("You can't carry any more reeds.", true);
} else {
screen_reader_speak("You can't carry any more clay.", true);
}
@@ -309,28 +355,47 @@ void perform_search(int current_x)
if(nearest.sticks > 0 || nearest.vines > 0)
{
bool find_stick = (nearest.vines <= 0) || (nearest.sticks > 0 && random(0, 1) == 0);
if(find_stick)
{
if (inv_sticks >= MAX_ITEM_STACK) {
screen_reader_speak("You can't carry any more sticks.", true);
return;
bool took_item = false;
if (find_stick) {
if (nearest.sticks > 0 && inv_sticks < get_personal_stack_limit()) {
nearest.sticks--;
inv_sticks++;
p.play_stationary("sounds/items/stick.ogg", false);
screen_reader_speak("Found a stick.", true);
took_item = true;
} else if (nearest.vines > 0 && inv_vines < get_personal_stack_limit()) {
nearest.vines--;
inv_vines++;
p.play_stationary("sounds/items/vine.ogg", false);
screen_reader_speak("Found a vine.", true);
took_item = true;
}
} else {
if (nearest.vines > 0 && inv_vines < get_personal_stack_limit()) {
nearest.vines--;
inv_vines++;
p.play_stationary("sounds/items/vine.ogg", false);
screen_reader_speak("Found a vine.", true);
took_item = true;
} else if (nearest.sticks > 0 && inv_sticks < get_personal_stack_limit()) {
nearest.sticks--;
inv_sticks++;
p.play_stationary("sounds/items/stick.ogg", false);
screen_reader_speak("Found a stick.", true);
took_item = true;
}
nearest.sticks--;
inv_sticks++;
p.play_stationary("sounds/items/stick.ogg", false);
screen_reader_speak("Found a stick.", true);
}
else
{
if (inv_vines >= MAX_ITEM_STACK) {
if (!took_item) {
if (nearest.sticks > 0 && nearest.vines > 0) {
screen_reader_speak("You can't carry any more sticks or vines.", true);
} else if (nearest.sticks > 0) {
screen_reader_speak("You can't carry any more sticks.", true);
} else {
screen_reader_speak("You can't carry any more vines.", true);
return;
}
nearest.vines--;
inv_vines++;
p.play_stationary("sounds/items/vine.ogg", false);
screen_reader_speak("Found a vine.", true);
return;
}
if(nearest.sticks == 0 && nearest.vines == 0) {
@@ -349,7 +414,7 @@ void perform_search(int current_x)
// Gravel Area - Stones (20-34)
if (current_x >= 20 && current_x <= 34)
{
if (inv_stones < MAX_ITEM_STACK)
if (inv_stones < get_personal_stack_limit())
{
inv_stones++;
p.play_stationary("sounds/items/stone.ogg", false);