Browse Source

Remove vector_extras dependency

master
HybridDog 3 months ago
parent
commit
6257c39406
  1. 19
      functions.lua
  2. 10
      init.lua
  3. 18
      mapgen.lua
  4. 2
      mod.conf

19
functions.lua

@ -17,3 +17,22 @@ else
function riesenpilz.inform()
end
end
local circle_tables = {}
function riesenpilz.circle(r)
local circle = circle_tables[r]
if circle then
return circle
end
local circle, n = {}, 1
for i = -r, r do
for j = -r, r do
if math.floor(math.sqrt(i * i + j * j) + 0.5) == r then
circle[n] = {x=i, y=0, z=j}
n = n+1
end
end
end
circle_tables[r] = circle
return circle
end

10
init.lua

@ -67,7 +67,8 @@ local function set_vm_data(manip, pznodes, pos, t1, name)
return
end
manip:write_to_map()
riesenpilz.inform("a giant "..name.." mushroom grew at "..vector.pos_to_string(pos), 3, t1)
riesenpilz.inform("a giant " .. name .. " mushroom grew at " ..
minetest.pos_to_string(pos), 3, t1)
local t1 = os.clock()
manip:update_map()
riesenpilz.inform("map updated", 3, t1)
@ -191,7 +192,8 @@ local function riesenpilz_minecraft_fliegenpilz(pos)
manip:set_param2_data(param2s)
manip:write_to_map()
manip:update_map()
riesenpilz.inform("a fly agaric grew at "..vector.pos_to_string(pos), 3, t1)
riesenpilz.inform("a fly agaric grew at " .. minetest.pos_to_string(pos),
3, t1)
end
@ -501,7 +503,7 @@ local function riesenpilz_apple(pos)
return
end
manip:write_to_map()
riesenpilz.inform("an apple grew at "..vector.pos_to_string(pos), 3, t1)
riesenpilz.inform("an apple grew at " .. minetest.pos_to_string(pos), 3, t1)
manip:update_map()
end
@ -816,7 +818,7 @@ for name,i in pairs({
-- witch circles
local ps = {}
for _,p in pairs(vector.circle(math.random(rmin, rmax))) do
for _,p in pairs(riesenpilz.circle(math.random(rmin, rmax))) do
local p = vector.add(pos, p)
-- currently 3 is used here, approved by its use in the mapgen

18
mapgen.lua

@ -79,9 +79,9 @@ end
local data = {}
local area, pr
function riesenpilz_circle(nam, pos, radius, chance)
local circle = vector.circle(radius)
for i = 1,#circle do
local function make_circle(nam, pos, radius, chance)
local circle = riesenpilz.circle(radius)
for i = 1, #circle do
if pr:next(1, chance) == 1 then
local vi = area:indexp(vector.add(pos, circle[i]))
if data[vi] == c.air
@ -231,13 +231,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
if pr:next(1,15) == 1 then
data[vi + area.ystride] = c.dry_shrub
elseif pr:next(1,80) == 1 then
riesenpilz_circle(c.riesenpilz_brown, boden, pr:next(3,4), 3)
make_circle(c.riesenpilz_brown, boden, pr:next(3,4), 3)
elseif pr:next(1,85) == 1 then
riesenpilz_circle(c.riesenpilz_parasol, boden, pr:next(3,5), 3)
make_circle(c.riesenpilz_parasol, boden, pr:next(3,5), 3)
elseif pr:next(1,90) == 1 then
riesenpilz_circle(c.riesenpilz_red, boden, pr:next(4,5), 3)
make_circle(c.riesenpilz_red, boden, pr:next(4,5), 3)
elseif pr:next(1,100) == 1 then
riesenpilz_circle(c.riesenpilz_fly_agaric, boden, 4, 3)
make_circle(c.riesenpilz_fly_agaric, boden, 4, 3)
elseif pr:next(1,340) == 10 then
bigtype = 2
elseif pr:next(1,380) == 1 then
@ -247,9 +247,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif pr:next(1,800) == 7 then
bigtype = 5
elseif pr:next(1,4000) == 1 then
riesenpilz_circle(c.riesenpilz_lavashroom, boden, pr:next(5,6), 3)
make_circle(c.riesenpilz_lavashroom, boden, pr:next(5,6), 3)
elseif pr:next(1,5000) == 1 then
riesenpilz_circle(c.riesenpilz_glowshroom, boden, 3, 3)
make_circle(c.riesenpilz_glowshroom, boden, 3, 3)
elseif pr:next(1,6000) == 2 then
if pr:next(1,200) == 15 then
bigtype = 4

2
mod.conf

@ -1,3 +1,3 @@
name = riesenpilz
depends = default,vector_extras
depends = default
optional_depends = digilines,fence_registration,technic

Loading…
Cancel
Save