[solved]on_secondary_use not working

Post Reply
lea_argon
New member
Posts: 1
Joined: Fri Sep 18, 2020 18:22
In-game: lea_argon
Location: Lost in thought

[solved]on_secondary_use not working

by lea_argon » Post

Hi! So I'm working on a piece of code to apply/remove an overlaid texture to a player. I can apply the texture but removing it isn't doing anything. What am I doing wrong?

Code: Select all

minetest.register_craftitem("coats:brown", {
  description = "Brown Fur Coat",
  inventory_image = "fur_coat1_inv.png",
  on_use = function(itemstack, user)
    user:get_wielded_item():get_name()
    default.player_set_textures(user, {
      "character.png".."^fur_coat1.png",
    })
  end,
  on_secondary_use = function(itemstack, user)
    user:get_wielded_item():get_name()
    default.player_set_textures(user, {
      "character.png",
    })
  end,
})
Edit: I figured out that on_secondary_use is called when I right-click while holding the item. Noob error :)

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests