Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bjazdzyk committed Feb 26, 2022
1 parent 1d7d759 commit 38d7ee5
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ if(storage.B){
}


if(storage.O){
O = JSON.parse(storage.getItem('O'))
}else{
O = {}// objects 1-forest 3-goblin
storage.setItem('O', JSON.stringify(O))
}


let time
let lastTime
if(storage.time){
Expand Down Expand Up @@ -202,8 +210,6 @@ if(!storage.stoneLimit){

// biomes 0-water 1-plains 2-mountains 4-beach
T = {}
// objects 1-forest 3-goblin
O = {}
// goblin caves
G = {}
const simplex = new SimplexNoise(seed)
Expand Down Expand Up @@ -255,10 +261,13 @@ const generationLogics = (x, X, Y) => {
if (x >= 0 && x < 0.125) {
R.T = 4 // beach
}

if (x >= 0.125 && x < 0.5 && Math.floor(x * 10000) % 3 === 0) {
R.O = 1 // forest
} else {
if(B[strcoords(X, Y)] === undefined){
if (x >= 0.125 && x < 0.5 && Math.floor(x * 10000) % 3 === 0) {
R.O = 1 // forest
} else {
R.O = 0
}
}else{
R.O = 0
}
} else {
Expand Down Expand Up @@ -686,13 +695,16 @@ c.addEventListener('mousedown', e => {
B[strcoords(cursor.x, cursor.y)] = placing
store('B', strcoords(cursor.x, cursor.y), placing)
O[strcoords(cursor.x, cursor.y)] = 0
store('O', strcoords(cursor.x, cursor.y), '0')
}
}
} else if (placing === 4) {
if (E[strcoords(cursor.x, cursor.y)] && nearBiomes(cursor.x, cursor.y, 0, 1) > 0 && T[strcoords(cursor.x, cursor.y)] && !O[strcoords(cursor.x, cursor.y)] && !B[strcoords(cursor.x, cursor.y)]) {
if (stone >= seaportPrice.stone && wood >= seaportPrice.wood) {
stone -= seaportPrice.stone
wood -= seaportPrice.wood
storage.setItem('stone', JSON.stringify(stone))
storage.setItem('wood', JSON.stringify(wood))
explore(cursor.x, cursor.y, 5, 'seaport')
explore(cursor.x, cursor.y, 1)
B[strcoords(cursor.x, cursor.y)] = placing
Expand Down

0 comments on commit 38d7ee5

Please sign in to comment.