Don't store content ids in table (should speed up generation a bit)

- Remove torches and cobble loot again
- Also push to Version 0.4 beta
master
BlockMen 2016-02-05 23:58:44 +01:00
parent 48d7d0d1c4
commit 62b6b56ac2
3 changed files with 28 additions and 33 deletions

View File

@ -1,15 +1,16 @@
Minetest mod "Mines" Minetest mod "Mines"
==================== ====================
version: 0.3 Beta version: 0.4 Beta
License of source code and textures: WTFPL License of source code and textures: WTFPL
----------------------------------------- -----------------------------------------
(c) Copyright BlockMen (2013) (c) Copyright 2013-2016 BlockMen <blockmen2015@gmail.com>
Contributors: Contributors:
------------- -------------
cHyper (mine deep can be set by .conf) - cHyper (mine deep can be set by .conf)
- red-001 (flooded Mines)
This program is free software. It comes without any warranty, to This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it the extent permitted by applicable law. You can redistribute it
@ -21,7 +22,7 @@ http://sam.zoy.org/wtfpl/COPYING for more details.
Using the mod: Using the mod:
-------------- --------------
This mod adds abandoned mines, similar to MC. This mod adds abandoned mines, similar to MC.
You can find chest with different stuff like food, resources, ingots or even tools. You can find chest with different stuff like food, resources, ingots or even tools.
@ -40,4 +41,4 @@ mines_deep_min = -64
mines_deep_max = -380 mines_deep_max = -380
^ up to this deep mines are created ^ up to this deep mines are created
mines_spawnfactor = 1.5 mines_spawnfactor = 1.5
^ increase this value to generate more mines ^ increase this value to generate more mines

View File

@ -1 +1 @@
default default

View File

@ -13,7 +13,7 @@ if not MINE_FACTOR then
end end
minetest.register_node("mines:dummy", { minetest.register_node("mines:dummy", {
description = "Air (you hacker you!)", description = "Mine Air (you hacker you!)",
inventory_image = "unknown_node.png", inventory_image = "unknown_node.png",
wield_image = "unknown_node.png", wield_image = "unknown_node.png",
drawtype = "airlike", drawtype = "airlike",
@ -28,15 +28,12 @@ minetest.register_node("mines:dummy", {
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
}) })
-- get node content ids
local ids = { local c_air = minetest.get_content_id("air")
c_air = minetest.get_content_id("air"), local c_fence = minetest.get_content_id("default:fence_wood")
c_fence = minetest.get_content_id("default:fence_wood"), local c_wood = minetest.get_content_id("default:wood")
c_wood = minetest.get_content_id("default:wood"), local c_water = minetest.get_content_id("default:water_source")
c_water = minetest.get_content_id("default:water_source"), local c_dummy = minetest.get_content_id("mines:dummy")
c_dummy = minetest.get_content_id("mines:dummy")
}
local chest_stuff = { local chest_stuff = {
{name="default:apple", max = 3}, {name="default:apple", max = 3},
@ -45,10 +42,7 @@ local chest_stuff = {
{name="default:gold_ingot", max = 2}, {name="default:gold_ingot", max = 2},
{name="default:diamond", max = 1}, {name="default:diamond", max = 1},
{name="default:pick_steel", max = 1}, {name="default:pick_steel", max = 1},
{name="default:pick_diamond", max = 1}, {name="default:pick_diamond", max = 1}
{name="default:torch", max = 99},
{name="default:cobble", max = 50},
{name="default:torch", max = 99}
} }
local function rotate_torch(pos) local function rotate_torch(pos)
@ -112,19 +106,19 @@ local function make_mine(mpos,p2,p3, vm_data, vx_area,cnt, flooded)
switch = n_switch switch = n_switch
for i=0,20,1 do for i=0,20,1 do
local pillar = ids.c_air local pillar = c_air
local pillar_top = ids.c_air local pillar_top = c_air
if flooded then if flooded then
pillar = ids.c_water pillar = c_water
pillar_top = ids.c_water pillar_top = c_water
end end
local fill_with = ids.c_air local fill_with = c_air
if flooded then if flooded then
fill_with = ids.c_water fill_with = c_water
end end
if i==0 or i == 5 or i == 10 or i == 15 or i == 20 then if i==0 or i == 5 or i == 10 or i == 15 or i == 20 then
pillar = ids.c_fence pillar = c_fence
pillar_top = ids.c_wood pillar_top = c_wood
end end
local x1 local x1
local x2 local x2
@ -196,13 +190,13 @@ local function make_mine(mpos,p2,p3, vm_data, vx_area,cnt, flooded)
vm_data[vx_area:indexp({x=x3, y=pos.y+1, z=z3})] = pillar_top vm_data[vx_area:indexp({x=x3, y=pos.y+1, z=z3})] = pillar_top
if not flooded and math.random(0,6) == 3 then if not flooded and math.random(0,6) == 3 then
vm_data[vx_area:indexp({x=x4, y=pos.y-1, z=z4})] = ids.c_dummy vm_data[vx_area:indexp({x=x4, y=pos.y-1, z=z4})] = c_dummy
rotate_torch({x=x4, y=pos.y-1, z=z4}) rotate_torch({x=x4, y=pos.y-1, z=z4})
end end
if math.random(0,60) == 13 then if math.random(0,60) == 13 then
local p = {x=x5, y=pos.y-1, z=z5} local p = {x=x5, y=pos.y-1, z=z5}
if vm_data[vx_area:indexp(p)] ~= ids.c_fence then if vm_data[vx_area:indexp(p)] ~= c_fence then
vm_data[vx_area:indexp(p)] = ids.c_dummy vm_data[vx_area:indexp(p)] = c_dummy
fill_chest(p) fill_chest(p)
end end
end end
@ -233,7 +227,7 @@ end
local function find_cave(min,max,vm_data, vx_area) local function find_cave(min,max,vm_data, vx_area)
for i in vx_area:iterp(min, max) do for i in vx_area:iterp(min, max) do
if vm_data[i] == ids.c_air then if vm_data[i] == c_air then
local p = vx_area:position(i) local p = vx_area:position(i)
if p.y <= MINE_DEEP_MIN then out = p end if p.y <= MINE_DEEP_MIN then out = p end
end end