Compare commits

..

No commits in common. "4297ae029d00bff0b68ef8542592f0726f83fd89" and "6b53a21c96b265bb44d886b78c25209b893af3cd" have entirely different histories.

3 changed files with 16 additions and 66 deletions

View File

@ -34,14 +34,11 @@ local PYRA_MIN_Y = 1
local PYRA_MAX_Y = 1000
-- minetest 5.x check
local is_50 = minetest.has_feature("object_use_texture_alpha")
-- minetest 5.5 check
local is_54 = minetest.has_feature("use_texture_alpha_string_modes") or nil
tsm_pyramids = {}
tsm_pyramids.is_50 = is_50
tsm_pyramids.is_54 = is_54
tsm_pyramids.S = S
tsm_pyramids.perlin1 = nil -- perlin noise buffer, make it global cos we need to acess in 5.0 after load all the rest of mods
tsm_pyramids.perlin1 -- perlin noise buffer, make it global cos we need to acess in 5.0 after load all the rest of mods
dofile(minetest.get_modpath(modpath).."/mummy.lua")
dofile(minetest.get_modpath(modpath).."/nodes.lua")
@ -223,17 +220,6 @@ local function make_entrance(pos, rot, brick, sand, flood_sand)
end
end
local wa_bulk_set_node
if not minetest.bulk_set_node then
wa_bulk_set_node = function(poslist, nodename)
for _, pos in ipairs(poslist) do
minetest.set_node(pos, nodename)
end
end
else
wa_bulk_set_node = minetest.bulk_set_node
end
local function make_pyramid(pos, brick, sandstone, stone, sand)
local set_to_brick = {}
local set_to_stone = {}
@ -248,8 +234,8 @@ local function make_pyramid(pos, brick, sandstone, stone, sand)
end
end
end
wa_bulk_set_node(set_to_stone, {name=stone})
wa_bulk_set_node(set_to_brick, {name=brick})
minetest.bulk_set_node(set_to_stone , {name=stone})
minetest.bulk_set_node(set_to_brick, {name=brick})
end
local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
@ -284,15 +270,9 @@ local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
end
local perl1
-- if mg v6 set this {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise.
-- if mg v6 set this {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise.
perl1 = { SEED1 = 9130, OCTA1 = 1, PERS1 = 0.5, SCAL1 = 25 } -- Values should match minetest mapgen V7 desert noise.
if tsm_pyramids.is_50 then
tsm_pyramids.perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
else
tsm_pyramids.perlin1 = PerlinNoise(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
end
local function hlp_fnct(pos, name)
local n = minetest.get_node_or_nil(pos)
if n and n.name and n.name == name then
@ -301,7 +281,6 @@ local function hlp_fnct(pos, name)
return false
end
end
local function ground(pos, old)
local p2 = table.copy(pos)
while hlp_fnct(p2, "air") do
@ -382,18 +361,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
return pos
end
local noise1 = nil
if not tsm_pyramids.perlin1 or tsm_pyramids.perlin1 == nil then
if tsm_pyramids.is_50 then
tsm_pyramids.perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
noise1 = tsm_pyramids.perlin1:get_2d({x=minp.x,y=minp.y})
else
tsm_pyramids.perlin1 = PerlinNoise(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
noise1 = tsm_pyramids.perlin1:get2d({x=minp.x,y=minp.y})
end
if tsm_pyramids.perlin1 == nil then
tsm_pyramids.perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
end
if not tsm_pyramids.perlin1 or tsm_pyramids.perlin1 == nil or not noise1 or noise1 == nil then
local noise1 = tsm_pyramids.perlin1:get_2d({x=minp.x,y=minp.y})
if noise1 == nil then
minetest.log("warning", "[tsm_pyramids] canot get 2d noise from perlin buffer---------------------------- ")
return
end

View File

@ -101,36 +101,17 @@ local MUMMY_DEF = {
}
-- Returns true if a mummy spawner entity was found at pos.
-- If self is provided, upstream pointed that is not count but must be checked if are the same
-- If self is provided, this object does not count.
local function check_if_mummy_spawner_entity_exists(pos, self)
local ents = minetest.get_objects_inside_radius(pos, 0.5)
if not ents then return false end
for e=1, #ents do
local objent = ents[e]
local lua = objent:get_luaentity()
if self then
if objent ~= self.object then
local sobj = self.object:get_luaentity()
if sobj.name then
if sobj.name == "tsm_pyramids:mummy_spawner" then return true end
if sobj.name == "mummy_spawner" then return true end
else
return false -- BUG could be a mob spawner but cannot get the name?
end
else
return false -- same object, is duplicate cos "self" is provided!
end
else
if type(lua) ~= "userdata" then -- not a player could be a spawner or a node
if lua then
if (not self) or (ents[e] ~= ents[e]) then
local lua = ents[e]:get_luaentity()
if lua then
if lua.name == "tsm_pyramids:mummy_spawner" then
-- entity found
if lua.name then
if lua.name == "tsm_pyramids:mummy_spawner" then return true end
if lua.name == "mummy_spawner" then return true end
end
return true
end
else
return false
end
end
end

View File

@ -1183,10 +1183,6 @@ function tsm_pyramids.flood_sand(pos, stype)
end
end
end
if tsm_pyramids.is_54 then
minetest.bulk_set_node(set_to_sand, {name=nn})
else
for _, xpos in ipairs(set_to_sand) do minetest.set_node(xpos, {name=nn}) end
end
minetest.bulk_set_node(set_to_sand, {name=nn})
end