aboutsummaryrefslogtreecommitdiff
path: root/lua/pets/pet.lua
diff options
context:
space:
mode:
authorGiuseppe Gadola <giusgadola@gmail.com>2023-02-17 19:37:14 +0100
committerGiuseppe Gadola <giusgadola@gmail.com>2023-02-17 19:37:14 +0100
commitc26e5403159d6d15b1f62a662726634b4eea5861 (patch)
tree855a69cddf405b9fdec1713fbc836f27e997b036 /lua/pets/pet.lua
parentfix: merge pull request #10 from Kyle-Mendes/statefulness (diff)
fix: fixed pets not disappearing when killed while paused
Diffstat (limited to 'lua/pets/pet.lua')
-rw-r--r--lua/pets/pet.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua
index d165b98..f767ed0 100644
--- a/lua/pets/pet.lua
+++ b/lua/pets/pet.lua
@@ -43,6 +43,10 @@ end
-- delete the pet :(
function M.Pet:kill()
+ if self.animation.state.paused then
+ self.animation:stop()
+ self.popup:unmount()
+ end
if self.death_animation then
self.animation.dying = true
else
@@ -52,16 +56,12 @@ function M.Pet:kill()
end
function M.Pet:set_paused(paused)
- self.state.paused = paused
self.animation:set_state({
paused = paused,
})
end
function M.Pet:set_hidden(hidden)
- self.state.hidden = hidden
- self.state.paused = hidden
-
self.animation:set_state({
hidden = hidden,
paused = hidden,