Enderdragon: Proper Egg and XP spawning

This commit is contained in:
Lizzy Fleckenstein 2021-04-06 12:50:36 +02:00
parent 91da727184
commit a348909ba3
3 changed files with 8 additions and 13 deletions

View File

@ -50,8 +50,8 @@ mobs:register_mob("mobs_mc:enderdragon", {
arrow = "mobs_mc:dragon_fireball", arrow = "mobs_mc:dragon_fireball",
shoot_interval = 0.5, shoot_interval = 0.5,
shoot_offset = -1.0, shoot_offset = -1.0,
xp_min = 12000, xp_min = 500,
xp_max = 12000, xp_max = 500,
animation = { animation = {
fly_speed = 8, stand_speed = 8, fly_speed = 8, stand_speed = 8,
stand_start = 0, stand_end = 20, stand_start = 0, stand_end = 20,
@ -59,15 +59,11 @@ mobs:register_mob("mobs_mc:enderdragon", {
run_start = 0, run_end = 20, run_start = 0, run_end = 20,
}, },
ignores_nametag = true, ignores_nametag = true,
on_die = function(self, own_pos) on_die = function(self, pos)
if self._egg_spawn_pos then if not self._respawned then
local pos = minetest.string_to_pos(self._egg_spawn_pos) mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000
--if minetest.get_node(pos).buildable_to then minetest.set_node(self._portal_pos and minetest.string_to_pos(self._portal_pos) or vector.add(mcl_vars.mg_end_platform_pos, vector.new(-27, 2, 0)), {name = mobs_mc.items.dragon_egg})
minetest.set_node(pos, {name = mobs_mc.items.dragon_egg})
return
--end
end end
minetest.add_item(own_pos, mobs_mc.items.dragon_egg)
end, end,
fire_resistant = true, fire_resistant = true,
}) })

View File

@ -58,8 +58,7 @@ local function spawn_crystal(pos)
for _, crystal in pairs(crystals) do for _, crystal in pairs(crystals) do
crystal_explode(crystal) crystal_explode(crystal)
end end
local dragon = minetest.add_entity(vector.add(portal_center, {x = 0, y = 10, z = 0}), "mobs_mc:enderdragon") minetest.add_entity(vector.add(portal_center, {x = 0, y = 10, z = 0}), "mobs_mc:enderdragon"):get_luaentity()._respawned = true
dragon:get_luaentity()._egg_spawn_pos = minetest.pos_to_string(vector.add(portal_center, {x = 0, y = 4, z = 0}))
end end
minetest.register_entity("mcl_end:crystal", { minetest.register_entity("mcl_end:crystal", {

View File

@ -313,7 +313,7 @@ mcl_structures.generate_fossil = function(pos, rotation, pr)
end end
mcl_structures.generate_end_exit_portal = function(pos, rot) mcl_structures.generate_end_exit_portal = function(pos, rot)
minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon") minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity()._portal_pos = minetest.pos_to_string(vector.add(pos, vector.new(3, 5, 3)))
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts" local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true) return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
end end