diff options
| author | Giuseppe Gadola <giusgadola@gmail.com> | 2023-03-05 17:14:15 +0100 |
|---|---|---|
| committer | Giuseppe Gadola <giusgadola@gmail.com> | 2023-03-06 20:47:10 +0100 |
| commit | de78f45c6e21393564a80d6190a9ce661926ca56 (patch) | |
| tree | 2f9661b84ef71d1246c8343772e86343da7614b4 /lua | |
| parent | feat(pets): spawn pets at random columns instead of left (diff) | |
feat(pets): new pet: slime
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/pets/commands.lua | 9 | ||||
| -rw-r--r-- | lua/pets/pets/slime.lua | 21 |
2 files changed, 28 insertions, 2 deletions
diff --git a/lua/pets/commands.lua b/lua/pets/commands.lua index da4490d..a240fc0 100644 --- a/lua/pets/commands.lua +++ b/lua/pets/commands.lua @@ -10,8 +10,13 @@ vim.api.nvim_create_user_command("PetsNew", function(input) end if pets.options.random then - local styles = utils.available_pets["dog"] - pet, style = "dog", styles[math.random(#styles)] + local pet_types = {} + for k in pairs(utils.available_pets) do + table.insert(pet_types, k) + end + pet = pet_types[math.random(#pet_types)] + local styles = utils.available_pets[pet] + style = styles[math.random(#styles)] end pets.create_pet(input.args, pet, style) diff --git a/lua/pets/pets/slime.lua b/lua/pets/pets/slime.lua new file mode 100644 index 0000000..d972035 --- /dev/null +++ b/lua/pets/pets/slime.lua @@ -0,0 +1,21 @@ +return { + next_actions = { + idle_blink = { "idle_wobble", "walk", "walk_left", "run", "run_left" }, + idle_wobble = { "idle_blink", "walk", "walk_left", "run", "run_left" }, + walk = { "idle_blink", "run" }, + run = { "walk", "run_left", "idle_wobble" }, + walk_left = { "run_left", "idle_blink", "idle_wobble" }, + run_left = { "walk_left", "run", "idle_wobble" }, + }, + idle_actions = { "idle_wobble", "idle_blink" }, + movements = { + right = { + normal = { "walk" }, + fast = { "run" }, + }, + left = { + fast = { "run_left" }, + normal = { "walk_left" }, + }, + }, +} |