make ghast fireballs deflectible

This commit is contained in:
epCode 2021-04-03 18:07:51 -07:00
parent 0b0a180343
commit 40b07e466b
2 changed files with 7 additions and 1 deletions

View file

@ -4223,6 +4223,11 @@ function mobs:register_arrow(name, def)
switch = 0,
owner_id = def.owner_id,
rotate = def.rotate,
on_punch = function(self)
local vel = self.object:get_velocity()
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
end,
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
automatic_face_movement_dir = def.rotate
and (def.rotate - (pi / 180)) or false,
@ -4285,7 +4290,7 @@ function mobs:register_arrow(name, def)
if self.hit_player or self.hit_mob or self.hit_object then
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
if self.hit_player
and player:is_player() then

View file

@ -74,6 +74,7 @@ mobs:register_arrow("mobs_mc:fireball", {
visual_size = {x = 1, y = 1},
textures = {"mcl_fire_fire_charge.png"},
velocity = 15,
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
hit_player = function(self, player)
if rawget(_G, "armor") and armor.last_damage_types then