diff --git a/mods/ENTITIES/mcl_mobs/api/api.lua b/mods/ENTITIES/mcl_mobs/api/api.lua index e5e9d32f48..307a180903 100644 --- a/mods/ENTITIES/mcl_mobs/api/api.lua +++ b/mods/ENTITIES/mcl_mobs/api/api.lua @@ -160,6 +160,7 @@ dofile(api_path .. "set_up.lua") dofile(api_path .. "attack_type_instructions.lua") dofile(api_path .. "sound_handling.lua") dofile(api_path .. "death_logic.lua") +dofile(api_path .. "mob_effects.lua") mobs.spawning_mobs = {} @@ -528,9 +529,12 @@ function mobs:register_arrow(name, def) if self.hit_player and player:is_player() then - mobs.arrow_hit(self, player) + if self.hit_player then + self.hit_player(self, player) + else + mobs.arrow_hit(self, player) + end - print("wow everything is fucked") self.object:remove(); return end diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua index 53d517a584..1666993585 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua @@ -1,5 +1,4 @@ local minetest_add_item = minetest.add_item -local minetest_add_particlespawner = minetest.add_particlespawner local minetest_sound_play = minetest.sound_play local math_pi = math.pi @@ -10,37 +9,6 @@ local HALF_PI = math_pi / 2 local vector_new = vector.new -local death_effect = function(self) - - local pos = self.object:get_pos() - local yaw = self.object:get_yaw() - local collisionbox = self.object:get_properties().collisionbox - - local min, max - - if collisionbox then - min = {x=collisionbox[1], y=collisionbox[2], z=collisionbox[3]} - max = {x=collisionbox[4], y=collisionbox[5], z=collisionbox[6]} - end - - minetest_add_particlespawner({ - amount = 50, - time = 0.001, - minpos = vector.add(pos, min), - maxpos = vector.add(pos, max), - minvel = vector.new(-0.5,0.5,-0.5), - maxvel = vector.new(0.5,1,0.5), - minexptime = 1.1, - maxexptime = 1.5, - minsize = 1, - maxsize = 2, - collisiondetection = false, - vertical = false, - texture = "mcl_particles_mob_death.png", -- this particle looks strange - }) -end - - -- drop items local item_drop = function(self, cooked, looting_level) @@ -127,7 +95,7 @@ mobs.death_logic = function(self, dtime) item_drop(self,false,1) - death_effect(self) + mobs.death_effect(self) self.object:remove() diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua index 32011aafe8..f43075b4e0 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua @@ -170,6 +170,14 @@ mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir) end end + + --if player is falling multiply damage by 1.5 + --critical hit + if hitter:get_velocity().y < 0 then + damage = damage * 1.5 + mobs.critical_effect(self) + end + local die = false -- only play hit sound and show blood effects if damage is 1 or over; lower to 0.1 to ensure armor works appropriately. diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/mob_effects.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/mob_effects.lua new file mode 100644 index 0000000000..1bf79f8aab --- /dev/null +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/mob_effects.lua @@ -0,0 +1,61 @@ +local minetest_add_particlespawner = minetest.add_particlespawner + +mobs.death_effect = function(self) + + local pos = self.object:get_pos() + local yaw = self.object:get_yaw() + local collisionbox = self.object:get_properties().collisionbox + + local min, max + + if collisionbox then + min = {x=collisionbox[1], y=collisionbox[2], z=collisionbox[3]} + max = {x=collisionbox[4], y=collisionbox[5], z=collisionbox[6]} + end + + minetest_add_particlespawner({ + amount = 50, + time = 0.0001, + minpos = vector.add(pos, min), + maxpos = vector.add(pos, max), + minvel = vector.new(-0.5,0.5,-0.5), + maxvel = vector.new(0.5,1,0.5), + minexptime = 1.1, + maxexptime = 1.5, + minsize = 1, + maxsize = 2, + collisiondetection = false, + vertical = false, + texture = "mcl_particles_mob_death.png", -- this particle looks strange + }) +end + +mobs.critical_effect = function(self) + + local pos = self.object:get_pos() + local yaw = self.object:get_yaw() + local collisionbox = self.object:get_properties().collisionbox + + local min, max + + if collisionbox then + min = {x=collisionbox[1], y=collisionbox[2], z=collisionbox[3]} + max = {x=collisionbox[4], y=collisionbox[5], z=collisionbox[6]} + end + + minetest_add_particlespawner({ + amount = 10, + time = 0.0001, + minpos = vector.add(pos, min), + maxpos = vector.add(pos, max), + minvel = vector.new(-1,1,-1), + maxvel = vector.new(1,3,1), + minexptime = 0.7, + maxexptime = 1, + minsize = 1, + maxsize = 2, + collisiondetection = false, + vertical = false, + texture = "heart.png^[colorize:black:255", + }) +end \ No newline at end of file diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 8a800b7882..5bcab05222 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -13,13 +13,15 @@ local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:ghast", { type = "monster", spawn_class = "hostile", - pathfinding = 1, group_attack = true, + hostile = true, hp_min = 10, hp_max = 10, xp_min = 5, xp_max = 5, - collisionbox = {-2, 5, -2, 2, 9, 2}, + reach = 60, + eye_height = 3, + collisionbox = {-2, 0, -2, 2, 4, 2}, visual = "mesh", mesh = "mobs_mc_ghast.b3d", textures = { @@ -35,8 +37,10 @@ mobs:register_mob("mobs_mc:ghast", { -- TODO: damage -- TODO: better death }, + walk_velocity = 1.6, run_velocity = 3.2, + drops = { {name = mobs_mc.items.gunpowder, chance = 1, min = 0, max = 2, looting = "common"}, {name = mobs_mc.items.ghast_tear, chance = 10/6, min = 0, max = 1, looting = "common", looting_ignore_chance = true}, @@ -47,22 +51,21 @@ mobs:register_mob("mobs_mc:ghast", { walk_start = 0, walk_end = 40, run_start = 0, run_end = 40, }, + fall_damage = 0, view_range = 100, attack_type = "projectile", arrow = "mobs_mc:fireball", - shoot_interval = 3.5, - shoot_offset = -5, - dogshoot_switch = 1, - dogshoot_count_max =1, - passive = false, - jump = true, - jump_height = 4, floats=1, fly = true, makes_footstep_sound = false, - instant_death = true, fire_resistant = true, + shoot_arrow = function(self, pos, dir) + -- 2-4 damage per arrow + local dmg = math.random(2,4) + mcl_bows.shoot_arrow("mobs_mc:fireball", pos, dir, self.object:get_yaw(), self.object, nil, dmg) + end, + --[[ do_custom = function(self) if self.firing == true then self.base_texture = {"mobs_mc_ghast_firing.png"} @@ -72,6 +75,7 @@ mobs:register_mob("mobs_mc:ghast", { self.object:set_properties({textures=self.base_texture}) end end, + ]]-- }) @@ -102,11 +106,14 @@ mobs:register_arrow("mobs_mc:fireball", { if rawget(_G, "armor") and armor.last_damage_types then armor.last_damage_types[player:get_player_name()] = "fireball" end + --[[ player:punch(self.object, 1.0, { full_punch_interval = 1.0, damage_groups = {fleshy = 6}, }, nil) - mobs:boom(self, self.object:get_pos(), 1, true) + ]]-- + --mobs:boom(self, self.object:get_pos(), 1, true) + mcl_explosions.explode(self.object:get_pos(), 3,{ drop_chance = 1.0 }) end, hit_mob = function(self, mob) @@ -114,11 +121,13 @@ mobs:register_arrow("mobs_mc:fireball", { full_punch_interval = 1.0, damage_groups = {fleshy = 6}, }, nil) - mobs:boom(self, self.object:get_pos(), 1, true) + --mobs:boom(self, self.object:get_pos(), 1, true) + 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) + --mobs:boom(self, pos, 1, true) + mcl_explosions.explode(self.object:get_pos(), 3,{ drop_chance = 1.0 }) end }) diff --git a/mods/ENTITIES/mobs_mc/models/attributes.txt b/mods/ENTITIES/mobs_mc/models/attributes.txt new file mode 100644 index 0000000000..ec59e0f702 --- /dev/null +++ b/mods/ENTITIES/mobs_mc/models/attributes.txt @@ -0,0 +1 @@ +Ghast fixed by epCode - Thanks! \ No newline at end of file diff --git a/mods/ENTITIES/mobs_mc/models/mobs_mc_ghast.b3d b/mods/ENTITIES/mobs_mc/models/mobs_mc_ghast.b3d index cebc037c05..ab34f334f8 100644 Binary files a/mods/ENTITIES/mobs_mc/models/mobs_mc_ghast.b3d and b/mods/ENTITIES/mobs_mc/models/mobs_mc_ghast.b3d differ