2024-12-29 17:01:33 -06:00

48 lines
1005 B
Lua

PyuTest.make_gun = function(name, desc, texture, cooldown, damage)
local bullet_id = name .. "_bullet"
local cd = cooldown or 1
PyuTest.make_tool(name, desc, {
tool = 1,
gun = 1,
}, texture, {
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
PyuTest.shoot_projectile_from_object(bullet_id, user, 35)
core.sound_play("pyutest_shoot", {
pos = user:get_pos()
})
return itemstack
end,
})
PyuTest.make_projectile(bullet_id, {
visual_size = {x = 0.2, y = 0.2},
textures = {
"pyutest-bullet.png",
"pyutest-bullet.png",
"pyutest-bullet.png",
"pyutest-bullet.png",
"pyutest-bullet.png",
"pyutest-bullet.png",
}
}, {
_slowdown = false,
_godown = true,
}, {
on_hit_node = function(self, pos, node) end,
on_hit_object = function(self, object)
if self._owner == nil or not self._owner:is_valid() then
return
end
PyuTest.deal_damage(object, damage, {
type = "punch",
object = self._owner
})
end
})
end