desert rocks test

other random changes
master
Izzy 2019-06-23 00:10:22 -06:00
parent 7ad3f0f8c4
commit e098c521a6
5 changed files with 338 additions and 35 deletions

View File

@ -1,3 +1,8 @@
Some Images have other copyrights and licenses. See image metadata for more information.
Otherwise:
-----------------------------------------------------------------------
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
@ -10,4 +15,4 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -244,8 +244,8 @@ end
minetest.register_abm({
nodenames = "potions:hotspring_water_source",
chance = 1,
interval = 50,
chance = 60,
interval = 5,
action = function(pos, node)
minetest.add_particlespawner({
amount = 1,

View File

@ -12,6 +12,8 @@ local modpath = minetest.get_modpath("potions")
local modname = "potions"
dofile(modpath.."/metals.lua")
dofile(modpath.."/rocks.lua")
dofile(modpath.."/minetunnels.lua")
dofile(modpath.."/hotsprings.lua")
dofile(modpath.."/beanstalk.lua")
@ -21,6 +23,56 @@ dofile(modpath.."/alchemy.lua")
--[[
fermentation, distillation, soaking/boiling pot
glass crafting furnace
ink, black/gold/silver/red
ethanol, methanol
ammonia
saltpeter, halite, iron(II) sulfate aka green vitriol (melanterite), soda nitre, pot ash
pyrite
iodine (from seaweed)
green alchemist's fire that ignites on and burns water
extra metals:
silver, lead, platinum, rhodium, arsenic, bismuth, mercury, iridium, osmium, zinc
gems:
lapis lazuli, opal, citrine, aquamarine
fumaroles
rock outcroppings in the desert similar to joshua tree
joshua trees (connected node)
magic beanstalk
arching bridge
fancy tower
summon a ziggurat (player is flung into the air while it spawns underneath)
chemistry glassware getting used or consumed
brown version of glassware
fancier glassware needed for fancier chemicals
some chemicals are light-sensitive and are ruined or explode if in bright light
some chemicals explode if heated
ancient artifacts
volcanic hotsprings
minetunnels a la mobehavior with geodes
pentagram on enchanting table top
higher level enchanting tables
]]
minetest.register_on_joinplayer(function(player)
@ -143,38 +195,6 @@ potions.set_max_manna = function(player, amt)
end
--[[
fermentation, distillation, soaking/boiling pot
ink, black/gold/silver/red
ethanol, methanol
ammonia
saltpeter, halite, iron(II) sulfate aka green vitriol (melanterite), soda nitre, pot ash
pyrite
sulfur, iodine
extra metals:
silver, lead, platinum, rhodium, arsenic, bismuth, mercury, iridium, osmium
gems:
emerald, ruby, lapis lazuli, opal, sapphire, citrine, aquamarine, amethyst
fumaroles
magic beanstalk
arching bridge
volcanic hotsprings
minetunnels a la mobehavior with geodes
pentagram on enchanting table top
higher level enchanting tables
]]
minetest.register_craftitem("potions:holy_water", {
description = "Holy Water",

View File

@ -9,7 +9,14 @@ mining side-tunnels
minerals embedded in walls
cave-ins
signs
poisonous or explosive mine gasses
room types:
barracks, with beds
dining hall, kitchen
ore storage room
chemistry lab
fancy exterior entrance
]]
@ -67,6 +74,21 @@ minetest.register_abm({
})
minetest.register_node("potions:trap_seed", {
description = "Trap seed",
drawtype = "node",
tiles = {"default_mese.png"},
groups = {cracky=3,},
on_construct = function(pos)
potions.build_trap_below(
{x=pos.x-4, y=pos.y-5, z=pos.z-6},
{x=pos.x+4, y=pos.y-1, z=pos.z+6},
1, 1, "default:river_water_source"
)
end,
})
minetest.register_node("potions:minetunnel_seed", {
description = "Minetunnel seed",
drawtype = "node",
@ -111,6 +133,47 @@ end
function potions.build_trap_below(minp, maxp, fall_depth, lava_depth, lava_node)
-- set the floor
for x = minp.x,maxp.x do
for z = minp.z,maxp.z do
minetest.set_node({x=x, y=maxp.y, z=z}, {name="potions:trap_floor"})
end
end
-- empty space underneath
local y = maxp.y-1
while y > maxp.y-fall_depth-1 do
for x = minp.x,maxp.x do
for z = minp.z,maxp.z do
minetest.set_node({x=x, y=y, z=z}, {name="air"})
end
end
y=y-1
end
-- lava pool
while y > maxp.y-fall_depth-1-lava_depth do
for x = minp.x,maxp.x do
for z = minp.z,maxp.z do
minetest.set_node({x=x, y=y, z=z}, {name=lava_node})
end
end
y=y-1
end
-- TODO: container for lava
end
local function build_tunnel(pos, dir, length, props)
print('buildign tunnel at '..dump(pos))
local floor_rot
@ -258,6 +321,23 @@ local function random_dir()
return d[math.random(4)]
end
local function random_new_dir(olddir)
local d = {
{x=1, z=0},
{x=-1, z=0},
{x=0, z=1},
{x=0, z=-1},
}
local i = math.random(4)
local a = d[i]
if a.x == olddir.x and a.z == olddir.z then
a = d[((i + 1) % 4) + 1]
end
return a
end
local function random_perpendicular(dir)
local d
@ -323,6 +403,113 @@ local function build_mine(pos, props)
end
local function mf(x, n)
return math.floor(x / n)
end
local function vdadd(pos, dir, length)
return {
x = pos.x + (dir.x * length),
y = pos.y,
z = pos.z + (dir.z * length),
}
end
local function build_mine_maze(pos, o)
local q = 0
local data = {
stack = {},
log = {},
}
local function encode(pos)
return "x"..mf(pos.x,2).."y"..mf(pos.y,2).."z"..mf(pos.z,2)
end
local function do_run(pos, dir, length)
local n = vector.add(pos, 0)
for i = 1,length do
minetest.set_node(n, {name="default:cobble"})
n.x = n.x + dir.x
n.z = n.z + dir.z
n.y = n.y + (dir.y or 0)
end
return n
end
local function direction_ok(pos, dir, length)
local e = encode(vdadd(pos, dir, length))
local g = data.log[e]
return g == nil
end
table.insert(data.stack, {
n = {x=pos.x, y=pos.y-1, z=pos.z},
dir = {x=1, z=0},
})
while q < 10 do
local n = table.remove(data.stack, 1)
if n == nil then
break
end
local e = encode(n.n)
local g = data.log[e]
data.log[e] = 1
if g == nil then
local n2 = do_run(n.n, n.dir, 10)
local newdir = n.dir
for i = 1,3 do
newdir = random_new_dir(newdir)
if direction_ok(n2, newdir, 10) then
table.insert(data.stack, {
n = n2,
dir = newdir
})
break
elseif math.random(2) == 2 then
table.insert(data.stack, {
n = {x=n2.x, y=n2.y+1, z=n2.z},
dir = newdir
})
break
end
end
-- minetest.set_node(n.n, {name="default:cobble"})
-- if math.random(20) < 19 then table.insert(data.stack, {x=n.x+2, y=n.y, z=n.z}) end
-- if math.random(20) < 19 then table.insert(data.stack, {x=n.x-2, y=n.y, z=n.z}) end
-- if math.random(20) < 3 then table.insert(data.stack, {x=n.x, y=n.y, z=n.z+2}) end
-- if math.random(20) < 3 then table.insert(data.stack, {x=n.x, y=n.y, z=n.z-2}) end
end
q = q + 1
end
end
local function build_minetunnel(pos)
@ -368,6 +555,15 @@ end
minetest.register_node("potions:maze_seed", {
description = "Maze seed",
drawtype = "node",
tiles = {"default_mese.png"},
groups = {cracky=3,},
on_construct = function(pos)
build_mine_maze({x=pos.x, y=pos.y-1, z=pos.z})
end,
})
minetest.register_abm({

82
rocks.lua Normal file
View File

@ -0,0 +1,82 @@
local function dist3(a, b)
local x = a.x - b.x
local y = a.y - b.y
local z = a.z - b.z
return math.sqrt(x*x + y*y + z*z)
end
local function random_pos(pos, dist)
local p = {
x=pos.x + math.random(-dist, dist),
y=pos.y + dist,
z=pos.z + math.random(-dist, dist),
}
while p.y > pos.y - dist do
local n = minetest.get_node(p)
if n.name ~= "air" then
return p
end
p.y = p.y - 1
end
return p
end
local function spawn_rock(pos, node)
pos.y = pos.y + 2
local r = math.random() * 1.1 + .3
local stry = math.random(6) + 1
local strx = math.random() * .5 + .5
local strz = math.random() * .5 + .5
local lx = math.random() * 1.6 - .8
local lz = math.random() * 1.6 - .8
local r2 = math.ceil(r+1)
for x = -r2,r2,1 do
for y = -r2*stry,r2*stry,1 do
for z = -r2,r2,1 do
local p = {x=pos.x+x, y=pos.y+y, z=pos.z+z}
local p_squash = {
x = pos.x + (x/strx) + lx*y,
y = pos.y + (y/stry),
z = pos.z + (z/strz) + lz*y
}
local d = dist3(p_squash, pos)
d = d + math.random() * .5
local dd = d - r
if dd <= 1 then
minetest.set_node(p, {name=node})
else
-- minetest.set_node(p, {name = "default:stone"})
end
end
end
end
end
minetest.register_node("potions:rock_seed", {
description = "Rock Seed",
tiles = {"default_sandstone.png^default_tool_bronzepick.png"},
groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
minetest.set_node(pos, {name="air"})
for i = 1,(math.random(12) + 4) do
spawn_rock(random_pos(pos, 30), "default:sandstone")
end
end,
})