Improve windballs

This commit is contained in:
IamPyu 2024-12-30 16:17:01 -06:00
parent b294ba6197
commit 19d492ba3c
3 changed files with 15 additions and 7 deletions

View File

@ -17,6 +17,7 @@ Game Changes:
- Added 3D model to players.
- Added guns
- Added Electrified Mithril
- Improved Windballs
Bugfixes:

View File

@ -1,4 +1,4 @@
PyuTest.make_gun = function(name, desc, texture, cooldown, damage)
PyuTest.make_gun = function(name, desc, texture, cooldown, damage, extra)
local bullet_id = name .. "_bullet"
local cd = cooldown or 1
@ -7,13 +7,17 @@ PyuTest.make_gun = function(name, desc, texture, cooldown, damage)
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()
})
if extra ~= nil then
extra(itemstack, user, pointed_thing)
end
return itemstack
end,
})

View File

@ -87,11 +87,14 @@ PyuTest.make_item("pyutest_magic:windball", "Windball", {}, "pyutest-windball.pn
local vel = user:get_velocity()
user:add_velocity({
x = vel.x * 2.5,
z = vel.z * 2.5,
y = math.random(11, 14)
})
-- user:add_velocity({
-- x = vel.x * 2.5,
-- z = vel.z * 2.5,
-- y = math.random(11, 14)
-- })
local dir = user:get_look_dir()
user:add_velocity(vector.multiply(-dir, 15))
local stack = user:get_wielded_item()
stack:set_count(stack:get_count() - 1)