New paste Repaste Download
core.register_craftitem("mods_glue:nt", {
  description      = "nt",
  inventory_image  = "ntntntntnt.png",
  on_use = function(_, user, pointed_thing)
    if pointed_thing.type ~= "object"
      or pointed_thing.ref:is_player()
      or not user:is_player() then
      return
    end
    local luaentity = pointed_thing.ref:get_luaentity()
    if luaentity then
      luaentity.object:on_punch(user)   -- Works
      --(pointed_thing.ref):punch(user) -- Fails
    end
  end,
})
Filename: test. Size: 482b. View raw, , hex, or download this file.

This paste expires on 2025-12-11 14:06:15.609509+00:00. Pasted through v1-api.