Compare commits
3 Commits
6b53a21c96
...
4297ae029d
Author | SHA1 | Date | |
---|---|---|---|
4297ae029d | |||
2c9ea6faca | |||
762b2d7838 |
41
init.lua
41
init.lua
@ -34,11 +34,14 @@ local PYRA_MIN_Y = 1
|
|||||||
local PYRA_MAX_Y = 1000
|
local PYRA_MAX_Y = 1000
|
||||||
-- minetest 5.x check
|
-- minetest 5.x check
|
||||||
local is_50 = minetest.has_feature("object_use_texture_alpha")
|
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 = {}
|
||||||
tsm_pyramids.is_50 = is_50
|
tsm_pyramids.is_50 = is_50
|
||||||
|
tsm_pyramids.is_54 = is_54
|
||||||
tsm_pyramids.S = S
|
tsm_pyramids.S = S
|
||||||
tsm_pyramids.perlin1 -- perlin noise buffer, make it global cos we need to acess in 5.0 after load all the rest of mods
|
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
|
||||||
|
|
||||||
dofile(minetest.get_modpath(modpath).."/mummy.lua")
|
dofile(minetest.get_modpath(modpath).."/mummy.lua")
|
||||||
dofile(minetest.get_modpath(modpath).."/nodes.lua")
|
dofile(minetest.get_modpath(modpath).."/nodes.lua")
|
||||||
@ -220,6 +223,17 @@ local function make_entrance(pos, rot, brick, sand, flood_sand)
|
|||||||
end
|
end
|
||||||
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 function make_pyramid(pos, brick, sandstone, stone, sand)
|
||||||
local set_to_brick = {}
|
local set_to_brick = {}
|
||||||
local set_to_stone = {}
|
local set_to_stone = {}
|
||||||
@ -234,8 +248,8 @@ local function make_pyramid(pos, brick, sandstone, stone, sand)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.bulk_set_node(set_to_stone , {name=stone})
|
wa_bulk_set_node(set_to_stone, {name=stone})
|
||||||
minetest.bulk_set_node(set_to_brick, {name=brick})
|
wa_bulk_set_node(set_to_brick, {name=brick})
|
||||||
end
|
end
|
||||||
|
|
||||||
local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
|
local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
|
||||||
@ -273,6 +287,12 @@ 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.
|
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 function hlp_fnct(pos, name)
|
||||||
local n = minetest.get_node_or_nil(pos)
|
local n = minetest.get_node_or_nil(pos)
|
||||||
if n and n.name and n.name == name then
|
if n and n.name and n.name == name then
|
||||||
@ -281,6 +301,7 @@ local function hlp_fnct(pos, name)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ground(pos, old)
|
local function ground(pos, old)
|
||||||
local p2 = table.copy(pos)
|
local p2 = table.copy(pos)
|
||||||
while hlp_fnct(p2, "air") do
|
while hlp_fnct(p2, "air") do
|
||||||
@ -361,12 +382,18 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
return pos
|
return pos
|
||||||
end
|
end
|
||||||
|
|
||||||
if tsm_pyramids.perlin1 == nil then
|
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)
|
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
|
end
|
||||||
local noise1 = tsm_pyramids.perlin1:get_2d({x=minp.x,y=minp.y})
|
end
|
||||||
if noise1 == nil then
|
|
||||||
minetest.log("warning", "[tsm_pyramids] canot get 2d noise from perlin buffer---------------------------- ")
|
if not tsm_pyramids.perlin1 or tsm_pyramids.perlin1 == nil or not noise1 or noise1 == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
33
mummy.lua
33
mummy.lua
@ -101,17 +101,36 @@ local MUMMY_DEF = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Returns true if a mummy spawner entity was found at pos.
|
-- Returns true if a mummy spawner entity was found at pos.
|
||||||
-- If self is provided, this object does not count.
|
-- If self is provided, upstream pointed that is not count but must be checked if are the same
|
||||||
local function check_if_mummy_spawner_entity_exists(pos, self)
|
local function check_if_mummy_spawner_entity_exists(pos, self)
|
||||||
local ents = minetest.get_objects_inside_radius(pos, 0.5)
|
local ents = minetest.get_objects_inside_radius(pos, 0.5)
|
||||||
|
if not ents then return false end
|
||||||
for e=1, #ents do
|
for e=1, #ents do
|
||||||
if (not self) or (ents[e] ~= ents[e]) then
|
local objent = ents[e]
|
||||||
local lua = ents[e]:get_luaentity()
|
local lua = objent:get_luaentity()
|
||||||
if lua then
|
if self then
|
||||||
if lua.name == "tsm_pyramids:mummy_spawner" then
|
if objent ~= self.object then
|
||||||
-- entity found
|
local sobj = self.object:get_luaentity()
|
||||||
return true
|
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
|
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
|
||||||
|
-- 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
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
4
room.lua
4
room.lua
@ -1183,6 +1183,10 @@ function tsm_pyramids.flood_sand(pos, stype)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if tsm_pyramids.is_54 then
|
||||||
minetest.bulk_set_node(set_to_sand, {name=nn})
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user