diff --git a/mods/ENTITIES/mcl_mobs/api/api.lua b/mods/ENTITIES/mcl_mobs/api/api.lua index df267b0526..373ac18b76 100644 --- a/mods/ENTITIES/mcl_mobs/api/api.lua +++ b/mods/ENTITIES/mcl_mobs/api/api.lua @@ -50,6 +50,7 @@ local vector_length = vector.length local vector_direction = vector.direction local vector_normalize = vector.normalize local vector_multiply = vector.multiply +local vector_divide = vector.divide -- mob constants local MAX_MOB_NAME_LENGTH = 30 @@ -490,7 +491,10 @@ function mobs:register_arrow(name, def) and def.tail_texture then --do this to prevent clipping through main entity sprite - local new_pos = vector_add(pos, vector_multiply(vector_normalize(vel), -1)) + local pos_adjustment = vector_multiply(vector_normalize(vel), -1) + local divider = def.tail_distance_divider or 1 + pos_adjustment = vector_divide(pos_adjustment, divider) + local new_pos = vector_add(pos, pos_adjustment) minetest.add_particle({ pos = new_pos, velocity = {x = 0, y = 0, z = 0}, diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/projectile_handling.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/projectile_handling.lua index 63668c8212..e7ae6ffbe4 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/projectile_handling.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/projectile_handling.lua @@ -1,6 +1,6 @@ local GRAVITY = minetest.settings:get("movement_gravity")-- + 9.81 -mobs.shoot_projectile_handling = function(arrow_item, pos, dir, yaw, shooter, power, damage, is_critical, bow_stack, collectable) +mobs.shoot_projectile_handling = function(arrow_item, pos, dir, yaw, shooter, power, damage, is_critical, bow_stack, collectable, gravity) local obj = minetest.add_entity({x=pos.x,y=pos.y,z=pos.z}, arrow_item.."_entity") if power == nil then power = 19 @@ -8,6 +8,9 @@ mobs.shoot_projectile_handling = function(arrow_item, pos, dir, yaw, shooter, po if damage == nil then damage = 3 end + + gravity = gravity or -GRAVITY + local knockback if bow_stack then local enchantments = mcl_enchanting.get_enchantments(bow_stack) @@ -22,7 +25,7 @@ mobs.shoot_projectile_handling = function(arrow_item, pos, dir, yaw, shooter, po end end obj:set_velocity({x=dir.x*power, y=dir.y*power, z=dir.z*power}) - obj:set_acceleration({x=0, y=-GRAVITY, z=0}) + obj:set_acceleration({x=0, y=gravity, z=0}) obj:set_yaw(yaw-math.pi/2) local le = obj:get_luaentity() le._shooter = shooter diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index 0293152b1a..451cb59d04 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -79,15 +79,17 @@ mobs:register_mob("mobs_mc:blaze", { glow = 14, fire_resistant = true, eye_height = 0.75, + projectile_cooldown_min = 2, + projectile_cooldown_max = 3, shoot_arrow = function(self, pos, dir) -- 2-4 damage per arrow local dmg = math.random(2,4) - mobs.shoot_projectile_handling("mobs_mc:blaze_fireball", pos, dir, self.object:get_yaw(), self.object, nil, dmg) + mobs.shoot_projectile_handling("mobs_mc:blaze_fireball", pos, dir, self.object:get_yaw(), self.object, 7, dmg,nil,nil,nil,-0.4) end, do_custom = function(self) - if self.state == "attack" and vector.distance(self.object:get_pos(), self.attack:get_pos()) < 1.2 then - mcl_burning.set_on_fire(self.attack, 5) + if self.attacking and self.state == "attack" and vector.distance(self.object:get_pos(), self.attacking:get_pos()) < 1.2 then + mcl_burning.set_on_fire(self.attacking, 5) end local pos = self.object:get_pos() minetest.add_particle({ @@ -158,6 +160,10 @@ mobs:register_arrow("mobs_mc:blaze_fireball", { textures = {"mcl_fire_fire_charge.png"}, velocity = 15, speed = 5, + tail = 1, + tail_texture = "mobs_mc_spit.png^[colorize:black:255", --repurpose spit texture + tail_size = 2, + tail_distance_divider = 3, -- Direct hit, no fire... just plenty of pain hit_player = function(self, player) @@ -167,7 +173,7 @@ mobs:register_arrow("mobs_mc:blaze_fireball", { mcl_burning.set_on_fire(player, 5, "blaze") player:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 5}, + damage_groups = {fleshy = self._damage}, }, nil) end, @@ -175,7 +181,7 @@ mobs:register_arrow("mobs_mc:blaze_fireball", { mcl_burning.set_on_fire(mob, 5) mob:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 5}, + damage_groups = {fleshy = self._damage}, }, nil) end, diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index c95d0282fc..c1434f2010 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -56,15 +56,17 @@ mobs:register_mob("mobs_mc:ghast", { fall_damage = 0, view_range = 28, attack_type = "projectile", - arrow = "mobs_mc:fireball", + arrow = "mobs_mc:ghast_fireball", floats=1, fly = true, makes_footstep_sound = false, fire_resistant = true, + projectile_cooldown_min = 5, + projectile_cooldown_max = 7, shoot_arrow = function(self, pos, dir) -- 2-4 damage per arrow local dmg = math.random(2,4) - mobs.shoot_projectile_handling("mobs_mc:fireball", pos, dir, self.object:get_yaw(), self.object, nil, dmg) + mobs.shoot_projectile_handling("mobs_mc:ghast_fireball", pos, dir, self.object:get_yaw(), self.object, 11, dmg,nil,nil,nil,-0.6) end, --[[ do_custom = function(self) @@ -96,12 +98,15 @@ mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) -- fireball (projectile) -mobs:register_arrow("mobs_mc:fireball", { +mobs:register_arrow("mobs_mc:ghast_fireball", { visual = "sprite", visual_size = {x = 1, y = 1}, textures = {"mcl_fire_fire_charge.png"}, velocity = 15, collisionbox = {-.5, -.5, -.5, .5, .5, .5}, + tail = 1, + tail_texture = "mobs_mc_spit.png^[colorize:black:255", --repurpose spit texture + tail_size = 5, hit_player = function(self, player) if rawget(_G, "armor") and armor.last_damage_types then @@ -114,21 +119,21 @@ mobs:register_arrow("mobs_mc:fireball", { }, nil) ]]-- --mobs:boom(self, self.object:get_pos(), 1, true) - mcl_explosions.explode(self.object:get_pos(), 1,{ drop_chance = 1.0 }) + mcl_explosions.explode(self.object:get_pos(), 3,{ drop_chance = 1.0 }) end, hit_mob = function(self, mob) mob:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 6}, + damage_groups = {fleshy = self._damage}, }, nil) --mobs:boom(self, self.object:get_pos(), 1, true) - mcl_explosions.explode(self.object:get_pos(), 1,{ drop_chance = 1.0 }) + mcl_explosions.explode(self.object:get_pos(), 3,{ drop_chance = 1.0 }) end, hit_node = function(self, pos, node) --mobs:boom(self, pos, 1, true) - mcl_explosions.explode(self.object:get_pos(), 1,{ drop_chance = 1.0 }) + mcl_explosions.explode(self.object:get_pos(), 3,{ drop_chance = 1.0 }) end }) diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index 75a08f0528..81120dfdd8 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -257,6 +257,7 @@ mobs:register_arrow("mobs_mc:spit", { tail = 1, tail_texture = "mobs_mc_spit.png", tail_size = 2, + tail_distance_divider = 4, hit_player = function(self, player) if rawget(_G, "armor") and armor.last_damage_types then