Compare commits

..

4 Commits

Author SHA1 Message Date
Bram van den Heuvel 69acc5074b Fix dungeon margin bug (#4276)
Some mapgen settings used to crash the game.

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4276
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-authored-by: Bram van den Heuvel <bram.vdh1999@gmail.com>
Co-committed-by: Bram van den Heuvel <bram.vdh1999@gmail.com>
2024-05-03 14:05:51 +00:00
the-real-herowl 7d999535e7 Merge pull request 'Ghast fixes' (#4277) from ghast_fixes into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4277
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
2024-05-03 12:57:32 +00:00
the-real-herowl 4dde321a04 Ghast fireball fixes 2024-05-02 00:18:43 +02:00
Araca cd0509c2e6 Fix crash with ghast achievement fireball_redir_serv (#4179)
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4179
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-authored-by: Araca <araca.prod@gmail.com>
Co-committed-by: Araca <araca.prod@gmail.com>
2024-05-01 22:15:56 +00:00
3 changed files with 13 additions and 9 deletions

View File

@ -374,7 +374,7 @@ function mcl_mobs.register_arrow(name, def)
rotate = def.rotate, rotate = def.rotate,
on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
local vel = self.object:get_velocity():length() local vel = self.object:get_velocity():length()
self.object:set_velocity({x=dir.x * vel, y=dir.y * vel, z=dir.z * vel}) self.object:set_velocity(dir * vel)
self._puncher = puncher self._puncher = puncher
end, end,
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0}, collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},

View File

@ -126,13 +126,14 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
end, end,
hit_mob = function(self, mob) hit_mob = function(self, mob)
local name = mob:get_luaentity().name
mob:punch(self.object, 1.0, { mob: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)
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true) mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
local ent = mob:get_luaentity() local ent = mob:get_luaentity()
if not ent or ent.health <= 0 then if (not ent or ent.health <= 0) and self._puncher and name == "mobs_mc:ghast" then
awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv") awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv")
end end
end, end,

View File

@ -406,6 +406,8 @@ local function dungeons_nodes(minp, maxp, blockseed)
local pr = PseudoRandom(blockseed) local pr = PseudoRandom(blockseed)
for a=1, attempts do for a=1, attempts do
local dim = dungeonsizes[pr:next(1, #dungeonsizes)] local dim = dungeonsizes[pr:next(1, #dungeonsizes)]
if ymin <= ymax - dim.y - 1 then
local x = pr:next(minp.x, maxp.x-dim.x-1) local x = pr:next(minp.x, maxp.x-dim.x-1)
local y = pr:next(ymin , ymax -dim.y-1) local y = pr:next(ymin , ymax -dim.y-1)
local z = pr:next(minp.z, maxp.z-dim.z-1) local z = pr:next(minp.z, maxp.z-dim.z-1)
@ -415,6 +417,7 @@ local function dungeons_nodes(minp, maxp, blockseed)
emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr}) emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr})
end end
end end
end
function mcl_dungeons.spawn_dungeon(p1, _, pr) function mcl_dungeons.spawn_dungeon(p1, _, pr)
if not p1 or not pr or not p1.x or not p1.y or not p1.z then return end if not p1 or not pr or not p1.x or not p1.y or not p1.z then return end