2017-07-05 03:15:46 +02:00
|
|
|
-- daufinsyd
|
|
|
|
-- My work is under the LGPL terms
|
2021-04-07 18:47:40 +02:00
|
|
|
-- Model and mobs_blaze.png see https://github.com/22i/minecraft-voxel-blender-models -hi 22i ~jordan4ibanez
|
2017-07-05 03:15:46 +02:00
|
|
|
-- blaze.lua partial copy of mobs_mc/ghast.lua
|
|
|
|
|
2022-02-13 21:40:12 +01:00
|
|
|
local S = minetest.get_translator("mobs_mc")
|
2017-07-05 03:15:46 +02:00
|
|
|
|
2022-02-26 22:38:34 +01:00
|
|
|
local mod_target = minetest.get_modpath("mcl_target")
|
|
|
|
|
2017-07-05 03:15:46 +02:00
|
|
|
--###################
|
|
|
|
--################### BLAZE
|
|
|
|
--###################
|
|
|
|
|
2023-09-22 01:09:35 +02:00
|
|
|
local function spawn_check(pos, environmental_light, artificial_light, sky_light)
|
|
|
|
return artificial_light <= 11
|
|
|
|
end
|
2017-07-05 03:15:46 +02:00
|
|
|
|
2022-11-09 04:09:58 +01:00
|
|
|
mcl_mobs.register_mob("mobs_mc:blaze", {
|
2021-04-25 17:30:15 +02:00
|
|
|
description = S("Blaze"),
|
2017-07-05 03:15:46 +02:00
|
|
|
type = "monster",
|
2020-04-11 02:46:03 +02:00
|
|
|
spawn_class = "hostile",
|
2022-07-17 02:20:51 +02:00
|
|
|
spawn_in_group_min = 2,
|
|
|
|
spawn_in_group = 3,
|
2017-07-05 03:15:46 +02:00
|
|
|
hp_min = 20,
|
|
|
|
hp_max = 20,
|
2020-12-06 15:46:42 +01:00
|
|
|
xp_min = 10,
|
|
|
|
xp_max = 10,
|
2017-07-05 03:15:46 +02:00
|
|
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.79, 0.3},
|
2024-11-11 17:29:07 +01:00
|
|
|
rotate = 180,
|
|
|
|
head_yaw_offset = 180,
|
2017-07-05 03:15:46 +02:00
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_mc_blaze.b3d",
|
2022-10-07 03:10:20 +02:00
|
|
|
head_swivel = "head.control",
|
2024-11-11 17:29:07 +01:00
|
|
|
head_eye_height = 1.4,
|
|
|
|
head_bone_position = vector.new( 0, 4, 0 ), -- for minetest <= 5.8
|
2022-10-07 03:10:20 +02:00
|
|
|
curiosity = 10,
|
|
|
|
head_pitch_multiplier=-1,
|
2017-07-05 03:15:46 +02:00
|
|
|
textures = {
|
|
|
|
{"mobs_mc_blaze.png"},
|
|
|
|
},
|
2020-08-05 18:33:53 +02:00
|
|
|
armor = { fleshy = 100, snowball_vulnerable = 100, water_vulnerable = 100 },
|
2017-07-05 03:15:46 +02:00
|
|
|
visual_size = {x=3, y=3},
|
|
|
|
sounds = {
|
|
|
|
random = "mobs_mc_blaze_breath",
|
|
|
|
death = "mobs_mc_blaze_died",
|
|
|
|
damage = "mobs_mc_blaze_hurt",
|
|
|
|
distance = 16,
|
|
|
|
},
|
|
|
|
walk_velocity = .8,
|
|
|
|
run_velocity = 1.6,
|
|
|
|
damage = 6,
|
2022-02-13 21:40:12 +01:00
|
|
|
reach = 2,
|
2017-07-05 03:15:46 +02:00
|
|
|
pathfinding = 1,
|
|
|
|
drops = {
|
2022-05-25 23:25:15 +02:00
|
|
|
{name = "mcl_mobitems:blaze_rod",
|
2017-07-05 03:15:46 +02:00
|
|
|
chance = 1,
|
|
|
|
min = 0,
|
2020-12-23 17:41:42 +01:00
|
|
|
max = 1,
|
|
|
|
looting = "common",},
|
2017-07-05 03:15:46 +02:00
|
|
|
},
|
|
|
|
animation = {
|
2018-05-31 03:17:41 +02:00
|
|
|
stand_speed = 25,
|
|
|
|
stand_start = 0,
|
|
|
|
stand_end = 100,
|
|
|
|
walk_speed = 25,
|
|
|
|
walk_start = 0,
|
|
|
|
walk_end = 100,
|
|
|
|
run_speed = 50,
|
|
|
|
run_start = 0,
|
|
|
|
run_end = 100,
|
2017-07-05 03:15:46 +02:00
|
|
|
},
|
|
|
|
-- MC Wiki: takes 1 damage every half second while in water
|
|
|
|
water_damage = 2,
|
|
|
|
lava_damage = 0,
|
2019-10-02 18:43:48 +02:00
|
|
|
fire_damage = 0,
|
2017-07-05 03:15:46 +02:00
|
|
|
fall_damage = 0,
|
|
|
|
fall_speed = -2.25,
|
|
|
|
light_damage = 0,
|
|
|
|
view_range = 16,
|
2022-02-13 21:40:12 +01:00
|
|
|
attack_type = "dogshoot",
|
2017-07-05 03:15:46 +02:00
|
|
|
arrow = "mobs_mc:blaze_fireball",
|
|
|
|
shoot_interval = 3.5,
|
2019-12-10 00:16:09 +01:00
|
|
|
shoot_offset = 1.0,
|
2017-07-05 03:15:46 +02:00
|
|
|
passive = false,
|
|
|
|
jump = true,
|
|
|
|
jump_height = 4,
|
|
|
|
fly = true,
|
2020-12-05 14:48:58 +01:00
|
|
|
makes_footstep_sound = false,
|
2019-03-09 00:54:49 +01:00
|
|
|
fear_height = 0,
|
2019-03-08 03:40:46 +01:00
|
|
|
glow = 14,
|
2020-12-24 17:48:40 +01:00
|
|
|
fire_resistant = true,
|
2021-04-05 01:32:58 +02:00
|
|
|
do_custom = function(self)
|
2022-02-14 13:42:25 +01:00
|
|
|
if self.state == "attack" and self.attack:get_pos() and vector.distance(self.object:get_pos(), self.attack:get_pos()) < 1.2 then
|
2022-02-13 21:40:12 +01:00
|
|
|
mcl_burning.set_on_fire(self.attack, 5)
|
2021-04-05 01:32:58 +02:00
|
|
|
end
|
|
|
|
local pos = self.object:get_pos()
|
|
|
|
minetest.add_particle({
|
2024-09-07 14:58:12 +02:00
|
|
|
pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()},
|
|
|
|
velocity = {x=0, y=1, z=0},
|
2021-04-05 01:32:58 +02:00
|
|
|
expirationtime = math.random(),
|
|
|
|
size = math.random(1, 4),
|
|
|
|
collisiondetection = true,
|
|
|
|
vertical = false,
|
|
|
|
texture = "mcl_particles_smoke_anim.png^[colorize:#2c2c2c:255",
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 8,
|
|
|
|
aspect_h = 8,
|
|
|
|
length = 2.05,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
minetest.add_particle({
|
2024-09-07 14:58:12 +02:00
|
|
|
pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()},
|
|
|
|
velocity = {x=0, y=1, z=0},
|
2021-04-05 01:32:58 +02:00
|
|
|
expirationtime = math.random(),
|
|
|
|
size = math.random(1, 4),
|
|
|
|
collisiondetection = true,
|
|
|
|
vertical = false,
|
|
|
|
texture = "mcl_particles_smoke_anim.png^[colorize:#424242:255",
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 8,
|
|
|
|
aspect_h = 8,
|
|
|
|
length = 2.05,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
minetest.add_particle({
|
2024-09-07 14:58:12 +02:00
|
|
|
pos = {x=pos.x+(math.random()*0.7-0.35)*math.random(),y=pos.y+0.7+math.random()*0.5,z=pos.z+(math.random()*0.7-0.35)*math.random()},
|
|
|
|
velocity = {x=0, y=1, z=0},
|
2021-04-05 01:32:58 +02:00
|
|
|
expirationtime = math.random(),
|
|
|
|
size = math.random(1, 4),
|
|
|
|
collisiondetection = true,
|
|
|
|
vertical = false,
|
|
|
|
texture = "mcl_particles_smoke_anim.png^[colorize:#0f0f0f:255",
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 8,
|
|
|
|
aspect_h = 8,
|
|
|
|
length = 2.05,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
2023-09-22 01:09:35 +02:00
|
|
|
spawn_check = spawn_check,
|
2017-07-05 03:15:46 +02:00
|
|
|
})
|
|
|
|
|
2022-05-25 14:44:49 +02:00
|
|
|
mcl_mobs:spawn_specific(
|
2021-04-08 12:57:24 +02:00
|
|
|
"mobs_mc:blaze",
|
|
|
|
"nether",
|
|
|
|
"ground",
|
|
|
|
{"Nether"},
|
|
|
|
0,
|
|
|
|
minetest.LIGHT_MAX+1,
|
|
|
|
30,
|
2023-11-27 10:47:55 +01:00
|
|
|
1000,
|
2021-04-08 12:57:24 +02:00
|
|
|
3,
|
2022-05-25 23:25:15 +02:00
|
|
|
mcl_vars.mg_nether_min,
|
|
|
|
mcl_vars.mg_nether_max)
|
2017-08-16 22:08:17 +02:00
|
|
|
|
2017-07-05 03:15:46 +02:00
|
|
|
-- Blaze fireball
|
2022-11-09 04:09:58 +01:00
|
|
|
mcl_mobs.register_arrow("mobs_mc:blaze_fireball", {
|
2017-07-05 03:15:46 +02:00
|
|
|
visual = "sprite",
|
|
|
|
visual_size = {x = 0.3, y = 0.3},
|
|
|
|
textures = {"mcl_fire_fire_charge.png"},
|
2019-12-10 00:16:09 +01:00
|
|
|
velocity = 15,
|
2021-04-14 15:46:52 +02:00
|
|
|
_is_fireball = true,
|
2017-07-05 03:15:46 +02:00
|
|
|
|
|
|
|
-- Direct hit, no fire... just plenty of pain
|
|
|
|
hit_player = function(self, player)
|
2021-04-25 16:42:38 +02:00
|
|
|
mcl_burning.set_on_fire(player, 5)
|
2017-07-05 03:15:46 +02:00
|
|
|
player:punch(self.object, 1.0, {
|
|
|
|
full_punch_interval = 1.0,
|
2022-02-13 21:40:12 +01:00
|
|
|
damage_groups = {fleshy = 5},
|
2017-07-05 03:15:46 +02:00
|
|
|
}, nil)
|
|
|
|
end,
|
|
|
|
|
2019-03-11 13:25:06 +01:00
|
|
|
hit_mob = function(self, mob)
|
2021-02-22 10:55:14 +01:00
|
|
|
mcl_burning.set_on_fire(mob, 5)
|
2019-03-11 13:25:06 +01:00
|
|
|
mob:punch(self.object, 1.0, {
|
2017-07-05 03:15:46 +02:00
|
|
|
full_punch_interval = 1.0,
|
2022-02-13 21:40:12 +01:00
|
|
|
damage_groups = {fleshy = 5},
|
2017-07-05 03:15:46 +02:00
|
|
|
}, nil)
|
|
|
|
end,
|
|
|
|
|
2020-01-30 23:11:16 +01:00
|
|
|
hit_object = function(self, object)
|
|
|
|
local lua = object:get_luaentity()
|
|
|
|
if lua then
|
|
|
|
if lua.name == "mcl_minecarts:tnt_minecart" then
|
|
|
|
lua:on_activate_by_rail(2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2017-07-05 03:15:46 +02:00
|
|
|
-- Node hit, make fire
|
|
|
|
hit_node = function(self, pos, node)
|
2022-02-26 22:38:34 +01:00
|
|
|
if node == "air" then
|
2022-05-25 23:25:15 +02:00
|
|
|
minetest.set_node(pos, {name = "mcl_fire:fire"})
|
2017-09-19 17:16:04 +02:00
|
|
|
else
|
2022-02-26 22:38:34 +01:00
|
|
|
if self._shot_from_dispenser and mod_target and node == "mcl_target:target_off" then
|
|
|
|
mcl_target.hit(vector.round(pos), 0.4) --4 redstone ticks
|
|
|
|
end
|
|
|
|
local v = vector.normalize(self.object:get_velocity())
|
2017-09-19 17:16:04 +02:00
|
|
|
local crashpos = vector.subtract(pos, v)
|
|
|
|
local crashnode = minetest.get_node(crashpos)
|
2022-03-09 02:15:33 +01:00
|
|
|
local cndef = minetest.registered_nodes[crashnode.name]
|
2017-09-19 17:16:04 +02:00
|
|
|
-- Set fire if node is air, or a replacable flammable node (e.g. a plant)
|
|
|
|
if crashnode.name == "air" or
|
2022-03-09 02:15:33 +01:00
|
|
|
(cndef and cndef.buildable_to and minetest.get_item_group(crashnode.name, "flammable") >= 1) then
|
2022-05-25 23:25:15 +02:00
|
|
|
minetest.set_node(crashpos, {name = "mcl_fire:fire"})
|
2017-09-19 17:16:04 +02:00
|
|
|
end
|
2017-07-05 03:15:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2023-02-10 03:46:23 +01:00
|
|
|
mcl_mobs:non_spawn_specific("mobs_mc:blaze", "overworld", 0, 11)
|
|
|
|
-- spawn eggs.
|
2022-11-09 04:09:58 +01:00
|
|
|
mcl_mobs.register_egg("mobs_mc:blaze", S("Blaze"), "#f6b201", "#fff87e", 0)
|