Compare commits

..

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

6 changed files with 13 additions and 51 deletions

View File

@ -1,7 +0,0 @@
default
tnt
farming
treasurer?
doc_items?
awards?
cmi?

View File

@ -1 +0,0 @@
Pyramids with treasures! You can find them in deserts and sandstone deserts.

View File

@ -1,26 +1,4 @@
local modpath = minetest.get_current_modname() or "tsm_pyramids" local S = minetest.get_translator("tsm_pyramids")
-- support for i18n
local S
-- Intllib or native translator
if minetest.get_translator ~= nil then
S = minetest.get_translator(modpath)
else
if minetest.get_modpath("intllib") then
dofile(minetest.get_modpath("intllib") .. "/init.lua")
if intllib.make_gettext_pair then
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
else
gettext = intllib.Getter() -- old text file method
end
S = gettext
else -- boilerplate function
S = function(str, ...)
local args = {...}
return str:gsub("@%d+", function(match) return args[tonumber(match:sub(2))] end)
end
end
end
-- Pyramid width (must be an odd number) -- Pyramid width (must be an odd number)
local PYRA_W = 23 local PYRA_W = 23
@ -32,17 +10,12 @@ local PYRA_Wh = PYRA_Wm / 2
local PYRA_MIN_Y = 1 local PYRA_MIN_Y = 1
-- Maximun spawn height -- Maximun spawn height
local PYRA_MAX_Y = 1000 local PYRA_MAX_Y = 1000
-- minetest 5.x check
local is_50 = minetest.has_feature("object_use_texture_alpha")
tsm_pyramids = {} tsm_pyramids = {}
tsm_pyramids.is_50 = is_50
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
dofile(minetest.get_modpath(modpath).."/mummy.lua") dofile(minetest.get_modpath("tsm_pyramids").."/mummy.lua")
dofile(minetest.get_modpath(modpath).."/nodes.lua") dofile(minetest.get_modpath("tsm_pyramids").."/nodes.lua")
dofile(minetest.get_modpath(modpath).."/room.lua") dofile(minetest.get_modpath("tsm_pyramids").."/room.lua")
local mg_name = minetest.get_mapgen_setting("mg_name") local mg_name = minetest.get_mapgen_setting("mg_name")
@ -270,6 +243,8 @@ local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
end end
local perl1 local perl1
local perlin1 -- perlin noise buffer
-- 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.
@ -349,6 +324,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- TODO: Use Minetests pseudo-random tools -- TODO: Use Minetests pseudo-random tools
math.randomseed(seed) math.randomseed(seed)
if not perlin1 then
perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
end
--[[ Make sure the pyramid doesn't bleed outside of maxp, --[[ Make sure the pyramid doesn't bleed outside of maxp,
so it doesn't get placed incompletely by the mapgen. so it doesn't get placed incompletely by the mapgen.
This creates a bias somewhat, as this means there are some coordinates in This creates a bias somewhat, as this means there are some coordinates in
@ -360,15 +338,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
pos.z = math.min(pos.z, maxp.z - PYRA_W+1) pos.z = math.min(pos.z, maxp.z - PYRA_W+1)
return pos return pos
end end
local noise1 = perlin1:get_2d({x=minp.x,y=minp.y})
if tsm_pyramids.perlin1 == nil then
tsm_pyramids.perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
end
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
if noise1 > 0.25 or noise1 < -0.26 then if noise1 > 0.25 or noise1 < -0.26 then
-- Need a bit of luck to place a pyramid -- Need a bit of luck to place a pyramid

View File

@ -1,4 +1,4 @@
local S = tsm_pyramids.S local S = minetest.get_translator("tsm_pyramids")
local mod_cmi = minetest.get_modpath("cmi") ~= nil local mod_cmi = minetest.get_modpath("cmi") ~= nil

View File

@ -1,4 +1,4 @@
local S = tsm_pyramids.S local S = minetest.get_translator("tsm_pyramids")
local img = { local img = {
"eye", "men", "sun", "eye", "men", "sun",

View File

@ -1,4 +1,4 @@
local S = tsm_pyramids.S local S = minetest.get_translator("tsm_pyramids")
-- ROOM LAYOUTS -- ROOM LAYOUTS