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:
39
src/base_system.nvgt
Normal file
39
src/base_system.nvgt
Normal file
@@ -0,0 +1,39 @@
|
||||
// Base automation helpers
|
||||
int get_daily_food_requirement() {
|
||||
if (residents_count <= 0) return 0;
|
||||
return (residents_count + 1) / 2;
|
||||
}
|
||||
|
||||
void consume_food_for_residents() {
|
||||
int needed = get_daily_food_requirement();
|
||||
if (needed <= 0) return;
|
||||
if (storage_meat >= needed) {
|
||||
storage_meat -= needed;
|
||||
} else {
|
||||
storage_meat = 0;
|
||||
if (x <= BASE_END) {
|
||||
notify("No food, residents are hungry.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void keep_base_fires_fed() {
|
||||
if (residents_count <= 0) return;
|
||||
if (storage_meat <= 0) return;
|
||||
if (storage_sticks <= 0 && storage_logs <= 0) return;
|
||||
|
||||
for (uint i = 0; i < world_fires.length(); i++) {
|
||||
if (world_fires[i].position > BASE_END) continue;
|
||||
if (!world_fires[i].is_burning()) continue;
|
||||
if (world_fires[i].fuel_remaining > 300000) continue;
|
||||
|
||||
if (storage_sticks > 0) {
|
||||
storage_sticks--;
|
||||
world_fires[i].add_fuel(300000); // 5 minutes
|
||||
} else if (storage_logs > 0) {
|
||||
storage_logs--;
|
||||
world_fires[i].add_fuel(720000); // 12 minutes
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user