mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-10 21:50:33 +00:00
add options to the generation files
This commit is contained in:
parent
caf0ece703
commit
e5a5973575
5 changed files with 45 additions and 33 deletions
|
|
@ -5,5 +5,10 @@
|
|||
"onlineMode": true,
|
||||
"logging": true,
|
||||
"gameMode": 1,
|
||||
"generation":"diamond_square"
|
||||
"generation": {
|
||||
"name":"diamond_square",
|
||||
"options":{
|
||||
"worldHeight":80
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports=inject;
|
|||
function inject(serv,settings)
|
||||
{
|
||||
serv.gameMode=settings.gameMode;
|
||||
serv.spawnPoints=[new vec3(6,138,6),new vec3(3,138,6),new vec3(8,138,6)];
|
||||
serv.spawnPoints=[new vec3(6,81,6),new vec3(3,81,6),new vec3(8,81,6)];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ var generations={
|
|||
module.exports = inject;
|
||||
|
||||
function inject(serv,options) {
|
||||
serv.world = new World(generations[options["generation"]]);
|
||||
serv.world = new World(generations[options["generation"].name](options["generation"].options));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ function DiamondSquare(size, roughness, seed) {
|
|||
}
|
||||
}
|
||||
|
||||
function generation(options) {
|
||||
var worldHeight=options.worldHeight || 80;
|
||||
// Selected empirically
|
||||
var size = 10000000;
|
||||
var space = new DiamondSquare(size, size / 1000, Math.random() * 10000);
|
||||
|
|
@ -105,7 +107,7 @@ function generateSimpleChunk(chunkX, chunkZ) {
|
|||
|
||||
for (var x = 0; x < 16; x++) {
|
||||
for (var z = 0; z < 16; z++) {
|
||||
var level = Math.floor(space.value(worldX + x, worldZ + z) * 138);
|
||||
var level = Math.floor(space.value(worldX + x, worldZ + z) * worldHeight);
|
||||
for (var y = 0; y < 256; y++) {
|
||||
let block;
|
||||
|
||||
|
|
@ -123,5 +125,7 @@ function generateSimpleChunk(chunkX, chunkZ) {
|
|||
|
||||
return chunk;
|
||||
}
|
||||
return generateSimpleChunk;
|
||||
}
|
||||
|
||||
module.exports=generateSimpleChunk;
|
||||
module.exports=generation;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var Chunk = require('prismarine-chunk')(require("../version"));
|
||||
var Vec3 = require('vec3');
|
||||
|
||||
function generation(options) {
|
||||
function generateSimpleChunk(chunkX, chunkZ) {
|
||||
var chunk = new Chunk();
|
||||
|
||||
|
|
@ -15,5 +16,7 @@ function generateSimpleChunk(chunkX, chunkZ) {
|
|||
|
||||
return chunk;
|
||||
}
|
||||
return generateSimpleChunk;
|
||||
}
|
||||
|
||||
module.exports=generateSimpleChunk;
|
||||
module.exports=generation;
|
||||
Loading…
Reference in a new issue