Lots of changes, forgot to add the heal scroll sound. Sounds for when enemies come in and go out of range. Menu filtering added.
This commit is contained in:
@@ -291,7 +291,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;
|
||||
return bandit.position + "|" + bandit.health + "|" + bandit.weapon_type + "|" + bandit.behavior_state + "|" + bandit.wander_direction + "|" + bandit.move_interval + "|" + bandit.invader_type;
|
||||
}
|
||||
|
||||
string serialize_mountain(MountainRange@ mountain) {
|
||||
@@ -420,6 +420,12 @@ bool save_game_state() {
|
||||
}
|
||||
saveData.set("equipment_quick_slots", join_string_array(quickSlotData));
|
||||
|
||||
string[] itemCountSlotData;
|
||||
for (uint i = 0; i < item_count_slots.length(); i++) {
|
||||
itemCountSlotData.insert_last("" + item_count_slots[i]);
|
||||
}
|
||||
saveData.set("item_count_slots", join_string_array(itemCountSlotData));
|
||||
|
||||
// Rune system data
|
||||
saveData.set("rune_swiftness_unlocked", rune_swiftness_unlocked);
|
||||
saveData.set("unicorn_boss_defeated", unicorn_boss_defeated);
|
||||
@@ -467,6 +473,7 @@ bool save_game_state() {
|
||||
saveData.set("time_invasion_triggered_today", invasion_triggered_today);
|
||||
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("quest_roll_done_today", quest_roll_done_today);
|
||||
string[] questData;
|
||||
for (uint i = 0; i < quest_queue.length(); i++) {
|
||||
@@ -735,6 +742,18 @@ bool load_game_state() {
|
||||
}
|
||||
}
|
||||
|
||||
string[] loadedItemCountSlots = get_string_list_or_split(saveData, "item_count_slots");
|
||||
uint count_slot_count = loadedItemCountSlots.length();
|
||||
if (count_slot_count > item_count_slots.length()) count_slot_count = item_count_slots.length();
|
||||
for (uint i = 0; i < count_slot_count; i++) {
|
||||
int slot_value = parse_int(loadedItemCountSlots[i]);
|
||||
if (slot_value >= 0 && slot_value < ITEM_COUNT) {
|
||||
item_count_slots[i] = slot_value;
|
||||
} else if (is_runed_item_type(slot_value)) {
|
||||
item_count_slots[i] = slot_value;
|
||||
}
|
||||
}
|
||||
|
||||
// Load rune system data
|
||||
rune_swiftness_unlocked = get_bool(saveData, "rune_swiftness_unlocked", false);
|
||||
unicorn_boss_defeated = get_bool(saveData, "unicorn_boss_defeated", false);
|
||||
@@ -825,6 +844,15 @@ bool load_game_state() {
|
||||
invasion_triggered_today = get_bool(saveData, "time_invasion_triggered_today", false);
|
||||
invasion_roll_done_today = get_bool(saveData, "time_invasion_roll_done_today", false);
|
||||
invasion_scheduled_hour = int(get_number(saveData, "time_invasion_scheduled_hour", -1));
|
||||
string loaded_invasion_type;
|
||||
if (saveData.get("time_invasion_enemy_type", loaded_invasion_type)) {
|
||||
invasion_enemy_type = loaded_invasion_type;
|
||||
} else {
|
||||
invasion_enemy_type = "bandit";
|
||||
}
|
||||
if (invasion_enemy_type == "") {
|
||||
invasion_enemy_type = "bandit";
|
||||
}
|
||||
if (invasion_chance < 0) invasion_chance = 0;
|
||||
if (invasion_chance > 100) invasion_chance = 100;
|
||||
if (invasion_scheduled_hour < -1) invasion_scheduled_hour = -1;
|
||||
@@ -959,23 +987,28 @@ bool load_game_state() {
|
||||
string state = parts[3];
|
||||
int wander_dir = parse_int(parts[4]);
|
||||
int move_int = parse_int(parts[5]);
|
||||
string invader_type = "bandit";
|
||||
if (parts.length() >= 7) {
|
||||
invader_type = parts[6];
|
||||
if (invader_type == "") invader_type = "bandit";
|
||||
}
|
||||
|
||||
// Create bandit with dummy expansion area (position will be overridden)
|
||||
Bandit@ b = Bandit(pos, pos, pos);
|
||||
Bandit@ b = Bandit(pos, pos, pos, invader_type);
|
||||
b.position = pos;
|
||||
b.health = health;
|
||||
b.weapon_type = weapon;
|
||||
b.behavior_state = state;
|
||||
b.wander_direction = wander_dir;
|
||||
b.move_interval = move_int;
|
||||
b.invader_type = invader_type;
|
||||
b.wander_direction_change_interval = random(BANDIT_WANDER_DIRECTION_CHANGE_MIN, BANDIT_WANDER_DIRECTION_CHANGE_MAX);
|
||||
b.wander_direction_timer.restart();
|
||||
b.move_timer.restart();
|
||||
b.attack_timer.restart();
|
||||
|
||||
// Restore alert sound based on weapon type
|
||||
int sound_index = random(0, bandit_sounds.length() - 1);
|
||||
b.alert_sound = bandit_sounds[sound_index];
|
||||
// Restore alert sound based on invader type
|
||||
b.alert_sound = pick_invader_alert_sound(invader_type);
|
||||
|
||||
bandits.insert_last(b);
|
||||
// Start looping sound for loaded bandit
|
||||
|
||||
Reference in New Issue
Block a user