Fixes for invasions and terrain generation.
This commit is contained in:
@@ -251,6 +251,32 @@ void perform_search(int current_x)
|
||||
}
|
||||
}
|
||||
|
||||
// Stream banks - Clay (within stream sound range, 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)) {
|
||||
continue;
|
||||
}
|
||||
int center = world_streams[i].get_center_position();
|
||||
int distance = center - current_x;
|
||||
if (distance < 0) distance = -distance;
|
||||
if (distance <= 3) {
|
||||
near_stream_bank = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (near_stream_bank) {
|
||||
if (inv_clay < MAX_ITEM_STACK) {
|
||||
inv_clay++;
|
||||
p.play_stationary("sounds/items/clay.ogg", false);
|
||||
screen_reader_speak("Found clay.", true);
|
||||
} else {
|
||||
screen_reader_speak("You can't carry any more clay.", true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Trees (Sticks/Vines) - Check for nearby tree anywhere
|
||||
Tree@ nearest = null;
|
||||
int nearest_distance = 999;
|
||||
|
||||
@@ -3,6 +3,7 @@ int inv_stones = 0;
|
||||
int inv_sticks = 0;
|
||||
int inv_vines = 0;
|
||||
int inv_logs = 0;
|
||||
int inv_clay = 0;
|
||||
int inv_small_game = 0; // Total small game caught (any type)
|
||||
string[] inv_small_game_types; // Array to track what types of small game we have
|
||||
|
||||
@@ -89,6 +90,7 @@ void show_inventory() {
|
||||
info += inv_vines + " vines, ";
|
||||
info += inv_stones + " stones, ";
|
||||
info += inv_logs + " logs, ";
|
||||
info += inv_clay + " clay, ";
|
||||
info += inv_small_game + " small game, ";
|
||||
info += inv_meat + " meat, ";
|
||||
info += inv_skins + " skins. ";
|
||||
@@ -105,6 +107,7 @@ void run_inventory_menu() {
|
||||
"Vines: " + inv_vines,
|
||||
"Stones: " + inv_stones,
|
||||
"Logs: " + inv_logs,
|
||||
"Clay: " + inv_clay,
|
||||
"Small Game: " + inv_small_game,
|
||||
"Meat: " + inv_meat,
|
||||
"Skins: " + inv_skins,
|
||||
|
||||
@@ -137,6 +137,7 @@ void reset_game_state() {
|
||||
inv_sticks = 0;
|
||||
inv_vines = 0;
|
||||
inv_logs = 0;
|
||||
inv_clay = 0;
|
||||
inv_small_game = 0;
|
||||
inv_small_game_types.resize(0);
|
||||
inv_meat = 0;
|
||||
@@ -223,6 +224,7 @@ bool save_game_state() {
|
||||
saveData.set("inventory_sticks", inv_sticks);
|
||||
saveData.set("inventory_vines", inv_vines);
|
||||
saveData.set("inventory_logs", inv_logs);
|
||||
saveData.set("inventory_clay", inv_clay);
|
||||
saveData.set("inventory_small_game", inv_small_game);
|
||||
saveData.set("inventory_meat", inv_meat);
|
||||
saveData.set("inventory_skins", inv_skins);
|
||||
@@ -351,6 +353,7 @@ bool load_game_state() {
|
||||
inv_sticks = int(get_number(saveData, "inventory_sticks", 0));
|
||||
inv_vines = int(get_number(saveData, "inventory_vines", 0));
|
||||
inv_logs = int(get_number(saveData, "inventory_logs", 0));
|
||||
inv_clay = int(get_number(saveData, "inventory_clay", 0));
|
||||
inv_small_game = int(get_number(saveData, "inventory_small_game", 0));
|
||||
inv_meat = int(get_number(saveData, "inventory_meat", 0));
|
||||
inv_skins = int(get_number(saveData, "inventory_skins", 0));
|
||||
|
||||
Reference in New Issue
Block a user