forked from VoxeLibre/VoxeLibre
Merge pull request 'MAPGEN/tsm_railcorridors: Generate pig spawners in mineshafts' (#127) from mineshaft-pig-spawners into master
Reviewed-on: Mineclonia/Mineclonia#127 Reviewed-by: E <e@noreply.git.minetest.land>
This commit is contained in:
commit
45cdad7283
|
@ -51,9 +51,22 @@ function tsm_railcorridors.get_default_treasure(pr)
|
||||||
-- UNUSED IN MINECLONE 2!
|
-- UNUSED IN MINECLONE 2!
|
||||||
end
|
end
|
||||||
|
|
||||||
-- All spawners spawn cave spiders
|
-- Almost all spawners spawn cave spiders, but there is a 1 in 1000
|
||||||
function tsm_railcorridors.on_construct_spawner(pos)
|
-- chance to spawn a pig spawner instead, inspired by multiple bugs
|
||||||
|
-- in Minecraft that turn spawners in Mineshafts into pig spawners.
|
||||||
|
-- (Basically any spawner bug in Minecraft generates pig spawners.)
|
||||||
|
--
|
||||||
|
-- The Minecraft chance to get a pig spawner here is way lower than
|
||||||
|
-- 1 in 1000, but because of the small size of Minetest worlds, the
|
||||||
|
-- Minecraft chance would risk not having a pig spawner in a world.
|
||||||
|
--
|
||||||
|
-- The world with the seed “pigs” generates a pig spawner at 3,-8,7
|
||||||
|
function tsm_railcorridors.on_construct_spawner(pos, pr)
|
||||||
|
if pr:next(1,1000) == 900 then
|
||||||
|
mcl_mobspawners.setup_spawner(pos, "mobs_mc:pig", 0, 7)
|
||||||
|
else
|
||||||
mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider", 0, 7)
|
mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider", 0, 7)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- MineClone 2's treasure function. Gets all treasures for a single chest.
|
-- MineClone 2's treasure function. Gets all treasures for a single chest.
|
||||||
|
|
|
@ -114,7 +114,7 @@ if not tsm_railcorridors.nodes.corridor_woods_function then
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Random Perlin noise generators
|
-- Random Perlin noise generators
|
||||||
local pr, pr_carts, pr_treasures, pr_deco, webperlin_major, webperlin_minor
|
local pr, pr_carts, pr_spawner, pr_treasures, pr_deco, webperlin_major, webperlin_minor
|
||||||
|
|
||||||
local function InitRandomizer(seed)
|
local function InitRandomizer(seed)
|
||||||
-- Mostly used for corridor gen.
|
-- Mostly used for corridor gen.
|
||||||
|
@ -123,6 +123,8 @@ local function InitRandomizer(seed)
|
||||||
pr_deco = PseudoRandom(seed+25)
|
pr_deco = PseudoRandom(seed+25)
|
||||||
-- Separate randomizer for carts because spawning carts is very timing-dependent
|
-- Separate randomizer for carts because spawning carts is very timing-dependent
|
||||||
pr_carts = PseudoRandom(seed-654)
|
pr_carts = PseudoRandom(seed-654)
|
||||||
|
-- Spawner type randomiser
|
||||||
|
pr_spawner = PseudoRandom(seed+345)
|
||||||
-- Chest contents randomizer
|
-- Chest contents randomizer
|
||||||
pr_treasures = PseudoRandom(seed+777)
|
pr_treasures = PseudoRandom(seed+777)
|
||||||
-- Used for cobweb generation, both noises have to reach a high value for cobwebs to appear
|
-- Used for cobweb generation, both noises have to reach a high value for cobwebs to appear
|
||||||
|
@ -751,7 +753,7 @@ local function create_corridor_section(waypoint, axis, sign, up_or_down, up_or_d
|
||||||
if place_cobwebs then
|
if place_cobwebs then
|
||||||
Cube(p, size, {name=tsm_railcorridors.nodes.cobweb}, true)
|
Cube(p, size, {name=tsm_railcorridors.nodes.cobweb}, true)
|
||||||
end
|
end
|
||||||
tsm_railcorridors.on_construct_spawner(p)
|
tsm_railcorridors.on_construct_spawner(p, pr_spawner)
|
||||||
no_spawner = true
|
no_spawner = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue