summaryrefslogtreecommitdiff
path: root/peaceful_npc/spawning.lua
blob: 8ce8f6f06b3364a178df01d3c045a50217136b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--Spawn function
function def_spawn(pos)
	minetest.add_entity(pos, "peaceful_npc:npc_def")
	print("want to spawn npc_def at "..dump(pos))
	if mode_debug == true then
		minetest.chat_send_all("want to spawn npc_def at "..dump(pos))
	end
end

function fast_spawn(pos)
	minetest.add_entity(pos, "peaceful_npc:npc_fast")
	print("want to spawn npc_fast at "..dump(pos))
	if mode_debug == true then
		minetest.chat_send_all("want to spawn npc_fast at "..dump(pos))
	end
end

function dwarf_spawn(pos)
	minetest.add_entity(pos, "peaceful_npc:npc_dwarf")
	print("want to spawn npc_dwarf at "..dump(pos))
	if mode_debug == true then
		minetest.chat_send_all("want to spawn npc_dwarf at "..dump(pos))
	end
end

--Mapgen biomes
plaingen_biome = {
	surface = "default:dirt_with_grass",
	avoid_nodes = {"group:liquid", "group:tree"},
	avoid_radius = 20,
	rarity = 93,
	max_count = 1,
	min_elevation = -10,
	max_elevation = 30,
}

forestgen_biome = {
	surface = {"group:tree", "default:leaves"},
	avoid_nodes = {"group:liquid"},
	avoid_radius = 10,
	rarity = 96,
	max_count = 1,
	min_elevation = 20,
	max_elevation = 50,
}

beachgen_biome = {
	surface = "default:sand",
	avoid_nodes = {"group:liquid"},
	avoid_radius = 1,
	rarity = 90,
	max_count = 1,
	min_elevation = 0,
	max_elevation = 10,
}

desertgen_biome = {
	surface = { "default:desert_sand", "default:desert_stone"},
	avoid_nodes = {"group:liquid"},
	avoid_radius = 100,
	rarity = 95,
	max_count = 1,
	min_elevation = 0,
	max_elevation = 150,
}

cavegen_biome = {
	surface = { "default:stone_with_iron", "default:stone_with_coal", "default:stone_with_mese"},
	avoid_nodes = {"group:liquid"},
	avoid_radius = 5,
	rarity = 98,
	max_count = 1,
	min_elevation = -500,
	max_elevation = -50,
	check_air = true,
	spawn_replace_node = true,
}
	
--spawn definers
biome_lib:register_generate_plant(plaingen_biome, "def_spawn")
biome_lib:register_generate_plant(forestgen_biome, "def_spawn")
biome_lib:register_generate_plant(beachgen_biome, "fast_spawn")
biome_lib:register_generate_plant(desertgen_biome, "fast_spawn")
biome_lib:register_generate_plant(cavegen_biome, "dwarf_spawn")

print("Peaceful NPC spawning.lua loaded! By jojoa1997!")