From 316cb14e3b6e609c8451702d2995f2a5503be072 Mon Sep 17 00:00:00 2001 From: a327ex Date: Tue, 18 May 2021 00:38:51 -0300 Subject: [PATCH] Achievement fix --- arena.lua | 30 ++++++++++++++++++++++++++++++ main.lua | 12 ++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/arena.lua b/arena.lua index aa3cca8..54b0501 100644 --- a/arena.lua +++ b/arena.lua @@ -611,6 +611,36 @@ function Arena:quit() steam.userStats.setAchievement('VOIDERS_WIN') steam.userStats.storeStats() end + + local units = self.player:get_all_units() + local all_units_level_2 = true + for _, unit in ipairs(units) do + if unit.level ~= 2 then + all_units_level_2 = false + break + end + end + if all_units_level_2 then + state.achievement_level_2_win = true + system.save_state() + steam.userStats.setAchievement('LEVEL_2_WIN') + steam.userStats.storeStats() + end + + local units = self.player:get_all_units() + local all_units_level_3 = true + for _, unit in ipairs(units) do + if unit.level ~= 3 then + all_units_level_3 = false + break + end + end + if all_units_level_3 then + state.achievement_level_3_win = true + system.save_state() + steam.userStats.setAchievement('LEVEL_3_WIN') + steam.userStats.storeStats() + end end else diff --git a/main.lua b/main.lua index 215cb05..8602651 100644 --- a/main.lua +++ b/main.lua @@ -1241,10 +1241,12 @@ function update(dt) end if input.k.pressed then - sx, sy = sx - 1, sy - 1 - love.window.setMode(480*sx, 270*sy) - state.sx, state.sy = sx, sy - state.fullscreen = false + if sx > 1 and sy > 1 then + sx, sy = sx - 1, sy - 1 + love.window.setMode(480*sx, 270*sy) + state.sx, state.sy = sx, sy + state.fullscreen = false + end end if input.l.pressed then @@ -1254,10 +1256,12 @@ function update(dt) state.fullscreen = false end + --[[ if input.f12.pressed then steam.userStats.resetAllStats(true) steam.userStats.storeStats() end + ]]-- end