Changing on_use for a tool
I came across this old laser sword mod: viewtopic.php?id=2632
... and wanted to add a laser sound when the weapon is used. That is now working with the following code:
However, the the sword no longer hits anything else. So, I'm assuming that by changing the on_use function I have replaced the default behaviour. How do I retain the default behaviour and use the sound in addition?
... and wanted to add a laser sound when the weapon is used. That is now working with the following code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_tool("laser_mod:red_sword", {
...
on_use = function()
minetest.sound_play("laser_mod")
end,
...
})
However, the the sword no longer hits anything else. So, I'm assuming that by changing the on_use function I have replaced the default behaviour. How do I retain the default behaviour and use the sound in addition?