New properties: fireSpawnTemp, fireSpawnChance
temp is obvious chance is int 0-100 (default 10)
This commit is contained in:
parent
005389b9bc
commit
0d9e39384b
|
|
@ -20,7 +20,20 @@ function doBurning(pixel) {
|
||||||
fire = fire[Math.floor(Math.random()*fire.length)];
|
fire = fire[Math.floor(Math.random()*fire.length)];
|
||||||
}
|
}
|
||||||
//End fire getter block
|
//End fire getter block
|
||||||
fireIsCold = (fire === "cold_fire");
|
//Fire temp getter block
|
||||||
|
var fireTemp = info.fireSpawnTemp;
|
||||||
|
if (fireTemp == undefined) {
|
||||||
|
fireTemp = pixel.temp;
|
||||||
|
};
|
||||||
|
//End fire temp getter block
|
||||||
|
//Fire chance getter block
|
||||||
|
var fireChance = info.fireSpawnChance;
|
||||||
|
if (fireChance == undefined) {
|
||||||
|
fireChance = 10;
|
||||||
|
};
|
||||||
|
//End fire chance getter block
|
||||||
|
var fireIsCold = (fire === "cold_fire");
|
||||||
|
var fireInfo = elements[fire];
|
||||||
|
|
||||||
pixel.temp += burnTempChange;
|
pixel.temp += burnTempChange;
|
||||||
pixelTempCheck(pixel);
|
pixelTempCheck(pixel);
|
||||||
|
|
@ -42,7 +55,6 @@ function doBurning(pixel) {
|
||||||
//End fire getter block
|
//End fire getter block
|
||||||
newFireIsCold = (newFire === "cold_fire");
|
newFireIsCold = (newFire === "cold_fire");
|
||||||
|
|
||||||
|
|
||||||
//console.log(`burning pixel ${pixel.element}: ${fire} (${fireIsCold}) / burned element ${newPixel.element}: ${newFire} (${newFireIsCold})`);
|
//console.log(`burning pixel ${pixel.element}: ${fire} (${fireIsCold}) / burned element ${newPixel.element}: ${newFire} (${newFireIsCold})`);
|
||||||
if((!fireIsCold && !newFireIsCold) || (fireIsCold && newFireIsCold)) {
|
if((!fireIsCold && !newFireIsCold) || (fireIsCold && newFireIsCold)) {
|
||||||
if (elements[newPixel.element].burn && !newPixel.burning) {
|
if (elements[newPixel.element].burn && !newPixel.burning) {
|
||||||
|
|
@ -71,21 +83,23 @@ function doBurning(pixel) {
|
||||||
pixel.color = pixelColorPick(pixel)
|
pixel.color = pixelColorPick(pixel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Math.floor(Math.random()*100)<10 && !fireSpawnBlacklist.includes(pixel.element)) { // Spawn fire
|
else if (Math.floor(Math.random()*100)<fireChance && !fireSpawnBlacklist.includes(pixel.element)) { // Spawn fire
|
||||||
if (isEmpty(pixel.x,pixel.y-1)) {
|
if (isEmpty(pixel.x,pixel.y-1)) {
|
||||||
createPixel(fire,pixel.x,pixel.y-1);
|
createPixel(fire,pixel.x,pixel.y-1);
|
||||||
|
pixelMap[pixel.x][pixel.y-1].temp = fireTemp;
|
||||||
pixelMap[pixel.x][pixel.y-1].temp = pixel.temp//+(pixelTicks - (pixel.burnStart || 0));
|
pixelMap[pixel.x][pixel.y-1].temp = pixel.temp//+(pixelTicks - (pixel.burnStart || 0));
|
||||||
if (info.fireColor != undefined) {
|
if (info.fireColor != undefined) {
|
||||||
pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1],info.fireColor);
|
pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1],info.fireColor);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
// same for below if top is blocked
|
// same for below if top is blocked
|
||||||
else if (isEmpty(pixel.x,pixel.y+1)) {
|
else if (isEmpty(pixel.x,pixel.y+1)) {
|
||||||
createPixel(fire,pixel.x,pixel.y+1);
|
createPixel(fire,pixel.x,pixel.y+1);
|
||||||
|
pixelMap[pixel.x][pixel.y+1].temp = fireTemp;
|
||||||
pixelMap[pixel.x][pixel.y+1].temp = pixel.temp//+(pixelTicks - (pixel.burnStart || 0));
|
pixelMap[pixel.x][pixel.y+1].temp = pixel.temp//+(pixelTicks - (pixel.burnStart || 0));
|
||||||
if (info.fireColor != undefined) {
|
if (info.fireColor != undefined) {
|
||||||
pixelMap[pixel.x][pixel.y+1].color = pixelColorPick(pixelMap[pixel.x][pixel.y+1],info.fireColor);
|
pixelMap[pixel.x][pixel.y+1].color = pixelColorPick(pixelMap[pixel.x][pixel.y+1],info.fireColor);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue