diff options
| author | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-15 00:33:36 +0100 |
|---|---|---|
| committer | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-15 00:37:50 +0100 |
| commit | 03830ab867f76fd6d4601daefeaa3a109816cae7 (patch) | |
| tree | 73872c43cb1b5aae74a3a873c1596229610d1e81 /lua | |
| parent | docs(help): auto generate docs (diff) | |
feat(options): option to not show death animation
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/pets.lua | 1 | ||||
| -rw-r--r-- | lua/pets/pet.lua | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lua/pets.lua b/lua/pets.lua index 2626f22..ce9c61c 100644 --- a/lua/pets.lua +++ b/lua/pets.lua @@ -8,6 +8,7 @@ M.options = { default_pet = "cat", default_style = "brown", random = true, + death_animation = true, } M.pets = {} diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua index a132a1e..e13d9e0 100644 --- a/lua/pets/pet.lua +++ b/lua/pets/pet.lua @@ -22,13 +22,14 @@ local popup_opts = { -- @param name the actual name for the pet -- @param type the species of the pet e.g. cat -- @param style the color/style of the pet e.g. brown --- @param user_opts the table with user options (to be passed to Animation) +-- @param user_opts the table with user options -- @return a new Pet instance function M.Pet.new(name, type, style, user_opts) local instance = setmetatable({}, M.Pet) instance.name = name instance.type = type instance.style = style + instance.death_animation = user_opts.death_animation local wd = debug.getinfo(1).source:sub(2):match("(.*nvim/)") .. "media/" instance.sourcedir = wd .. type .. "/" .. style .. "/" @@ -47,7 +48,12 @@ end -- delete the pet :( function M.Pet:kill() - self.animation.dying = true + if self.death_animation then + self.animation.dying = true + else + self.animation:stop() + self.popup:unmount() + end end return M |