forked from VoxeLibre/VoxeLibre
Merge pull request 'Add in criticals, and fix/overhaul ghasts, add in epCode's fixed ghast model' (#1605) from jordan4ibanez/MineClone2:mineclone5 into mineclone5
Reviewed-on: MineClone2/MineClone2#1605
This commit is contained in:
commit
704e313d5d
|
@ -160,6 +160,7 @@ dofile(api_path .. "set_up.lua")
|
||||||
dofile(api_path .. "attack_type_instructions.lua")
|
dofile(api_path .. "attack_type_instructions.lua")
|
||||||
dofile(api_path .. "sound_handling.lua")
|
dofile(api_path .. "sound_handling.lua")
|
||||||
dofile(api_path .. "death_logic.lua")
|
dofile(api_path .. "death_logic.lua")
|
||||||
|
dofile(api_path .. "mob_effects.lua")
|
||||||
|
|
||||||
|
|
||||||
mobs.spawning_mobs = {}
|
mobs.spawning_mobs = {}
|
||||||
|
@ -528,9 +529,12 @@ function mobs:register_arrow(name, def)
|
||||||
if self.hit_player
|
if self.hit_player
|
||||||
and player:is_player() then
|
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();
|
self.object:remove();
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
local minetest_add_item = minetest.add_item
|
local minetest_add_item = minetest.add_item
|
||||||
local minetest_add_particlespawner = minetest.add_particlespawner
|
|
||||||
local minetest_sound_play = minetest.sound_play
|
local minetest_sound_play = minetest.sound_play
|
||||||
|
|
||||||
local math_pi = math.pi
|
local math_pi = math.pi
|
||||||
|
@ -10,37 +9,6 @@ local HALF_PI = math_pi / 2
|
||||||
local vector_new = vector.new
|
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
|
-- drop items
|
||||||
local item_drop = function(self, cooked, looting_level)
|
local item_drop = function(self, cooked, looting_level)
|
||||||
|
|
||||||
|
@ -127,7 +95,7 @@ mobs.death_logic = function(self, dtime)
|
||||||
|
|
||||||
item_drop(self,false,1)
|
item_drop(self,false,1)
|
||||||
|
|
||||||
death_effect(self)
|
mobs.death_effect(self)
|
||||||
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
|
|
|
@ -170,6 +170,14 @@ mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
end
|
end
|
||||||
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
|
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.
|
-- only play hit sound and show blood effects if damage is 1 or over; lower to 0.1 to ensure armor works appropriately.
|
||||||
|
|
|
@ -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
|
|
@ -13,13 +13,15 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
mobs:register_mob("mobs_mc:ghast", {
|
mobs:register_mob("mobs_mc:ghast", {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
pathfinding = 1,
|
|
||||||
group_attack = true,
|
group_attack = true,
|
||||||
|
hostile = true,
|
||||||
hp_min = 10,
|
hp_min = 10,
|
||||||
hp_max = 10,
|
hp_max = 10,
|
||||||
xp_min = 5,
|
xp_min = 5,
|
||||||
xp_max = 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",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_ghast.b3d",
|
mesh = "mobs_mc_ghast.b3d",
|
||||||
textures = {
|
textures = {
|
||||||
|
@ -35,8 +37,10 @@ mobs:register_mob("mobs_mc:ghast", {
|
||||||
-- TODO: damage
|
-- TODO: damage
|
||||||
-- TODO: better death
|
-- TODO: better death
|
||||||
},
|
},
|
||||||
|
|
||||||
walk_velocity = 1.6,
|
walk_velocity = 1.6,
|
||||||
run_velocity = 3.2,
|
run_velocity = 3.2,
|
||||||
|
|
||||||
drops = {
|
drops = {
|
||||||
{name = mobs_mc.items.gunpowder, chance = 1, min = 0, max = 2, looting = "common"},
|
{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},
|
{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,
|
walk_start = 0, walk_end = 40,
|
||||||
run_start = 0, run_end = 40,
|
run_start = 0, run_end = 40,
|
||||||
},
|
},
|
||||||
|
|
||||||
fall_damage = 0,
|
fall_damage = 0,
|
||||||
view_range = 100,
|
view_range = 100,
|
||||||
attack_type = "projectile",
|
attack_type = "projectile",
|
||||||
arrow = "mobs_mc:fireball",
|
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,
|
floats=1,
|
||||||
fly = true,
|
fly = true,
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
instant_death = true,
|
|
||||||
fire_resistant = 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)
|
do_custom = function(self)
|
||||||
if self.firing == true then
|
if self.firing == true then
|
||||||
self.base_texture = {"mobs_mc_ghast_firing.png"}
|
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})
|
self.object:set_properties({textures=self.base_texture})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
]]--
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,11 +106,14 @@ mobs:register_arrow("mobs_mc:fireball", {
|
||||||
if rawget(_G, "armor") and armor.last_damage_types then
|
if rawget(_G, "armor") and armor.last_damage_types then
|
||||||
armor.last_damage_types[player:get_player_name()] = "fireball"
|
armor.last_damage_types[player:get_player_name()] = "fireball"
|
||||||
end
|
end
|
||||||
|
--[[
|
||||||
player:punch(self.object, 1.0, {
|
player:punch(self.object, 1.0, {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = 6},
|
damage_groups = {fleshy = 6},
|
||||||
}, nil)
|
}, 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,
|
end,
|
||||||
|
|
||||||
hit_mob = function(self, mob)
|
hit_mob = function(self, mob)
|
||||||
|
@ -114,11 +121,13 @@ mobs:register_arrow("mobs_mc:fireball", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = 6},
|
damage_groups = {fleshy = 6},
|
||||||
}, nil)
|
}, 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,
|
end,
|
||||||
|
|
||||||
hit_node = function(self, pos, node)
|
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
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Ghast fixed by epCode - Thanks!
|
Binary file not shown.
Loading…
Reference in New Issue