New flying game turkey added. Zombie swarms added. Enemies from areas can now be encountered in those areas they do not leave the area unless invading.
This commit is contained in:
@@ -625,6 +625,13 @@ void reset_game_state() {
|
||||
invasion_triggered_today = false;
|
||||
invasion_roll_done_today = false;
|
||||
invasion_scheduled_hour = -1;
|
||||
invasion_started_once = false;
|
||||
zombie_swarm_active = false;
|
||||
zombie_swarm_start_hour = -1;
|
||||
zombie_swarm_scheduled_hour = -1;
|
||||
zombie_swarm_triggered_today = false;
|
||||
zombie_swarm_roll_done_today = false;
|
||||
zombie_swarm_duration_hours = 0;
|
||||
quest_roll_done_today = false;
|
||||
quest_queue.resize(0);
|
||||
playerItemBreakChance = PLAYER_ITEM_BREAK_CHANCE_MIN;
|
||||
@@ -687,7 +694,7 @@ string serialize_stream(WorldStream@ stream) {
|
||||
}
|
||||
|
||||
string serialize_bandit(Bandit@ bandit) {
|
||||
return bandit.position + "|" + bandit.health + "|" + bandit.weapon_type + "|" + bandit.behavior_state + "|" + bandit.wander_direction + "|" + bandit.move_interval + "|" + bandit.invader_type;
|
||||
return bandit.position + "|" + bandit.health + "|" + bandit.weapon_type + "|" + bandit.behavior_state + "|" + bandit.wander_direction + "|" + bandit.move_interval + "|" + bandit.invader_type + "|" + bandit.home_start + "|" + bandit.home_end;
|
||||
}
|
||||
|
||||
string serialize_mountain(MountainRange@ mountain) {
|
||||
@@ -879,6 +886,13 @@ bool save_game_state() {
|
||||
saveData.set("time_invasion_roll_done_today", invasion_roll_done_today);
|
||||
saveData.set("time_invasion_scheduled_hour", invasion_scheduled_hour);
|
||||
saveData.set("time_invasion_enemy_type", invasion_enemy_type);
|
||||
saveData.set("time_invasion_started_once", invasion_started_once);
|
||||
saveData.set("time_zombie_swarm_active", zombie_swarm_active);
|
||||
saveData.set("time_zombie_swarm_start_hour", zombie_swarm_start_hour);
|
||||
saveData.set("time_zombie_swarm_scheduled_hour", zombie_swarm_scheduled_hour);
|
||||
saveData.set("time_zombie_swarm_triggered_today", zombie_swarm_triggered_today);
|
||||
saveData.set("time_zombie_swarm_roll_done_today", zombie_swarm_roll_done_today);
|
||||
saveData.set("time_zombie_swarm_duration_hours", zombie_swarm_duration_hours);
|
||||
saveData.set("player_item_break_chance", playerItemBreakChance);
|
||||
saveData.set("player_item_breaks_today", playerItemBreaksToday);
|
||||
saveData.set("player_item_break_pending", playerItemBreakPending);
|
||||
@@ -1306,10 +1320,29 @@ bool load_game_state_from_file(const string&in filename) {
|
||||
if (invasion_enemy_type == "") {
|
||||
invasion_enemy_type = "bandit";
|
||||
}
|
||||
bool loaded_invasion_started = false;
|
||||
if (saveData.get("time_invasion_started_once", loaded_invasion_started)) {
|
||||
invasion_started_once = loaded_invasion_started;
|
||||
} else {
|
||||
invasion_started_once = (expanded_area_start != -1);
|
||||
}
|
||||
zombie_swarm_active = get_bool(saveData, "time_zombie_swarm_active", false);
|
||||
zombie_swarm_start_hour = int(get_number(saveData, "time_zombie_swarm_start_hour", -1));
|
||||
zombie_swarm_scheduled_hour = int(get_number(saveData, "time_zombie_swarm_scheduled_hour", -1));
|
||||
zombie_swarm_triggered_today = get_bool(saveData, "time_zombie_swarm_triggered_today", false);
|
||||
zombie_swarm_roll_done_today = get_bool(saveData, "time_zombie_swarm_roll_done_today", false);
|
||||
zombie_swarm_duration_hours = int(get_number(saveData, "time_zombie_swarm_duration_hours", 0));
|
||||
if (invasion_chance < 0) invasion_chance = 0;
|
||||
if (invasion_chance > 100) invasion_chance = 100;
|
||||
if (invasion_scheduled_hour < -1) invasion_scheduled_hour = -1;
|
||||
if (invasion_scheduled_hour > 23) invasion_scheduled_hour = -1;
|
||||
if (zombie_swarm_start_hour < -1 || zombie_swarm_start_hour > 23) zombie_swarm_start_hour = -1;
|
||||
if (zombie_swarm_scheduled_hour < -1 || zombie_swarm_scheduled_hour > 23) zombie_swarm_scheduled_hour = -1;
|
||||
if (zombie_swarm_duration_hours < 0) zombie_swarm_duration_hours = 0;
|
||||
if (!zombie_swarm_active) {
|
||||
zombie_swarm_start_hour = -1;
|
||||
zombie_swarm_duration_hours = 0;
|
||||
}
|
||||
playerItemBreakChance = float(get_number(saveData, "player_item_break_chance", PLAYER_ITEM_BREAK_CHANCE_MIN));
|
||||
playerItemBreaksToday = int(get_number(saveData, "player_item_breaks_today", 0));
|
||||
playerItemBreakPending = get_bool(saveData, "player_item_break_pending", false);
|
||||
@@ -1484,13 +1517,28 @@ bool load_game_state_from_file(const string&in filename) {
|
||||
int wander_dir = parse_int(parts[4]);
|
||||
int move_int = parse_int(parts[5]);
|
||||
string invader_type = "bandit";
|
||||
int home_start = pos;
|
||||
int home_end = pos;
|
||||
if (parts.length() >= 7) {
|
||||
invader_type = parts[6];
|
||||
if (invader_type == "") invader_type = "bandit";
|
||||
}
|
||||
if (parts.length() >= 9) {
|
||||
home_start = parse_int(parts[7]);
|
||||
home_end = parse_int(parts[8]);
|
||||
} else {
|
||||
if (expanded_area_start != -1 && pos >= expanded_area_start) {
|
||||
int area_start = -1;
|
||||
int area_end = -1;
|
||||
if (get_audio_area_bounds_for_position(pos, area_start, area_end)) {
|
||||
home_start = area_start;
|
||||
home_end = area_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create bandit with dummy expansion area (position will be overridden)
|
||||
Bandit@ b = Bandit(pos, pos, pos, invader_type);
|
||||
Bandit@ b = Bandit(pos, home_start, home_end, invader_type);
|
||||
b.position = pos;
|
||||
b.health = health;
|
||||
b.weapon_type = weapon;
|
||||
|
||||
Reference in New Issue
Block a user