2022-09-13 18:11:22 -04:00
|
|
|
runAfterLoad(function(){
|
|
|
|
|
|
|
|
|
|
doVelocity = function(pixel) {
|
|
|
|
|
if ((pixel.vx||pixel.vy) && elements[pixel.element].movable) {
|
|
|
|
|
if (pixel.vx) {
|
|
|
|
|
// move the pixel vx times
|
|
|
|
|
for (var i = 0; i < Math.abs(pixel.vx); i++) {
|
|
|
|
|
var x = pixel.x+Math.sign(pixel.vx);
|
|
|
|
|
var y = pixel.y;
|
|
|
|
|
if (!tryMove(pixel,x,y)) {
|
|
|
|
|
if (!isEmpty(x,y,true)) {
|
|
|
|
|
var newPixel = pixelMap[x][y];
|
|
|
|
|
if (elements[newPixel.element].movable) {
|
|
|
|
|
newPixel.vx = (newPixel.vx||0) + pixel.vx - Math.sign(pixel.vx);
|
2022-09-13 18:35:34 -04:00
|
|
|
if (elements[pixel.element].breakInto && Math.random()<elements[pixel.element].breakIntoChance) {
|
|
|
|
|
changePixel(pixel,elements[pixel.element].breakInto);
|
|
|
|
|
}
|
2022-09-13 18:11:22 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pixel.vx = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
Sandboxels v1.9
[Version 1.9 - October 13, 2023 - Local Saves]
+ Local Saves
+ SAVES button
+ Save the scene to 1 of 12 slots
+ Save the scene to a file
+ Load a scene from a file
+ Saves include a ton of information, even your selected element!
+ Choose to include your settings or mods
+ Drag & Drop or Paste a save file
+ Pumpkin
+ Fireproof solid for carving activities
+ Pumpkin Seed
+ Will grow when planted on soil!
~ Thermal View now uses a more useful logarithmic scale
[Changes]
+ Resetting now adjusts canvas size if needed
+ Dot appears in center of cursor
+ E-cloner can select an element while unpowered
+ E-cloner ignores Wires and E-walls
+ Grass can spread on Sand, Clay, and Mycelium
+ Tree roots can grow through Clay
~ Sap no longer mixes with Sawdust
+ Plant and Sauce remove Stench
+ Humans break Eggs, Grapes, and bugs when on top of them
+ Humans can trample Grass
+ Termites can eat Confetti, Straw, and Wheat
+ Fleas can eat Hair
+ Ants can eat Honey
+ Snails can eat Calcium, Limestone, and Paper
+ Worms can infect and swim in Blood
+ Worms are killed by Antibodies
+ Eggs die at high temperatures
+ Bugs will form Amber when touching Sap
~ Frogs and Fish burn slower
+ Uranium dirties Salt Water
+ Radiation can dirty Ice
+ Blood is infected by Rotten Meat and Rotten Cheese
+ Vinegar and Limestone reaction
+ Ketchup slowly deoxidizes Rust
~ Charcoal leaves behind Ash and less CO₂
~ C4 no longer explodes when burnt
+ C4 releases poisonous fumes when burnt
+ C4 burns longer, can be used as fuel
+ C4 explodes when broken
+ Fireworks ignite at high temperatures
+ Dye dissolves in Pool Water
+ Ink slowly dissolves in Water
+ Honey dissolves in Tea
+ Molten Salt conducts electricity
+ Hair can be made by radiating Skin
+ Skin can absorb Soap
+ Proton and Electric reaction generates heat
+ Positron and Electric reaction generates Light
+ Escape key resets to Normal View
~ Recolored Tuff
~ Recolored Blood
~ Selected element outline is more clear
~ Improved button readability
~ Improved canvas pixel sharpness
+ Pressing - or + button centers the cursor
~ Step button is now an arrow
+ Clear Saves setting
[Bug Fixes]
~ Fixed: Fireworks and Flash don't transfer heat
~ Fixed: Flash from Heat Ray is not hot
~ Fixed: Alcohol Gas density too high
~ Fixed: Pistil and Mushroom Gill can be dragged
~ Fixed: Herb can't be mixed in Batter or Dough
~ Fixed: Amber spawns at high temperature
~ Fixed: Heads can detach if Body moves during reaction
~ Fixed: Many Flour reactions make Gingerbread instead of Dough
~ Fixed: Ghost pixels when burning Plague, other deleting gases
~ Fixed: Color picker always appears when toggling GUI on (F1)
~ Fixed: Cooldowned elements can't be placed before 8th tick
~ Fixed: Frozen Fish break into Slime
[Technical]
+ logMessage() function
+ SOIL eList
+ generateSave() and loadSave() functions
+ resizeCanvas() and autoResizeCanvas() functions
+ sb1 save format
~ Browser dark color scheme for UI elements
~ Light, Laser, etc. use bx/by instead of vx/vy (velocity.js fix)
2023-10-13 18:45:49 -04:00
|
|
|
if (pixel.vx) { pixel.vx = Math.floor(Math.abs(pixel.vx)/1.25)*Math.sign(pixel.vx) }
|
2022-09-13 18:11:22 -04:00
|
|
|
}
|
|
|
|
|
if (pixel.vy) {
|
|
|
|
|
// move the pixel vy times
|
|
|
|
|
for (var i = 0; i < Math.abs(pixel.vy); i++) {
|
|
|
|
|
var x = pixel.x;
|
|
|
|
|
var y = pixel.y+Math.sign(pixel.vy);
|
|
|
|
|
if (!tryMove(pixel,x,y)) {
|
|
|
|
|
if (!isEmpty(x,y,true)) {
|
|
|
|
|
var newPixel = pixelMap[x][y];
|
|
|
|
|
if (elements[newPixel.element].movable) {
|
|
|
|
|
newPixel.vy = (newPixel.vy||0) + pixel.vy - Math.sign(pixel.vy);
|
2022-09-13 18:35:34 -04:00
|
|
|
if (elements[pixel.element].breakInto && Math.random()<elements[pixel.element].breakIntoChance) {
|
|
|
|
|
changePixel(pixel,elements[pixel.element].breakInto);
|
|
|
|
|
}
|
2022-09-13 18:11:22 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pixel.vy = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
Sandboxels v1.9
[Version 1.9 - October 13, 2023 - Local Saves]
+ Local Saves
+ SAVES button
+ Save the scene to 1 of 12 slots
+ Save the scene to a file
+ Load a scene from a file
+ Saves include a ton of information, even your selected element!
+ Choose to include your settings or mods
+ Drag & Drop or Paste a save file
+ Pumpkin
+ Fireproof solid for carving activities
+ Pumpkin Seed
+ Will grow when planted on soil!
~ Thermal View now uses a more useful logarithmic scale
[Changes]
+ Resetting now adjusts canvas size if needed
+ Dot appears in center of cursor
+ E-cloner can select an element while unpowered
+ E-cloner ignores Wires and E-walls
+ Grass can spread on Sand, Clay, and Mycelium
+ Tree roots can grow through Clay
~ Sap no longer mixes with Sawdust
+ Plant and Sauce remove Stench
+ Humans break Eggs, Grapes, and bugs when on top of them
+ Humans can trample Grass
+ Termites can eat Confetti, Straw, and Wheat
+ Fleas can eat Hair
+ Ants can eat Honey
+ Snails can eat Calcium, Limestone, and Paper
+ Worms can infect and swim in Blood
+ Worms are killed by Antibodies
+ Eggs die at high temperatures
+ Bugs will form Amber when touching Sap
~ Frogs and Fish burn slower
+ Uranium dirties Salt Water
+ Radiation can dirty Ice
+ Blood is infected by Rotten Meat and Rotten Cheese
+ Vinegar and Limestone reaction
+ Ketchup slowly deoxidizes Rust
~ Charcoal leaves behind Ash and less CO₂
~ C4 no longer explodes when burnt
+ C4 releases poisonous fumes when burnt
+ C4 burns longer, can be used as fuel
+ C4 explodes when broken
+ Fireworks ignite at high temperatures
+ Dye dissolves in Pool Water
+ Ink slowly dissolves in Water
+ Honey dissolves in Tea
+ Molten Salt conducts electricity
+ Hair can be made by radiating Skin
+ Skin can absorb Soap
+ Proton and Electric reaction generates heat
+ Positron and Electric reaction generates Light
+ Escape key resets to Normal View
~ Recolored Tuff
~ Recolored Blood
~ Selected element outline is more clear
~ Improved button readability
~ Improved canvas pixel sharpness
+ Pressing - or + button centers the cursor
~ Step button is now an arrow
+ Clear Saves setting
[Bug Fixes]
~ Fixed: Fireworks and Flash don't transfer heat
~ Fixed: Flash from Heat Ray is not hot
~ Fixed: Alcohol Gas density too high
~ Fixed: Pistil and Mushroom Gill can be dragged
~ Fixed: Herb can't be mixed in Batter or Dough
~ Fixed: Amber spawns at high temperature
~ Fixed: Heads can detach if Body moves during reaction
~ Fixed: Many Flour reactions make Gingerbread instead of Dough
~ Fixed: Ghost pixels when burning Plague, other deleting gases
~ Fixed: Color picker always appears when toggling GUI on (F1)
~ Fixed: Cooldowned elements can't be placed before 8th tick
~ Fixed: Frozen Fish break into Slime
[Technical]
+ logMessage() function
+ SOIL eList
+ generateSave() and loadSave() functions
+ resizeCanvas() and autoResizeCanvas() functions
+ sb1 save format
~ Browser dark color scheme for UI elements
~ Light, Laser, etc. use bx/by instead of vx/vy (velocity.js fix)
2023-10-13 18:45:49 -04:00
|
|
|
if (pixel.vy) { pixel.vy = Math.floor(Math.abs(pixel.vy)/1.25)*Math.sign(pixel.vy) }
|
2022-09-13 18:11:22 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
drawPixels = function(forceTick=false) {
|
|
|
|
|
// newCurrentPixels = shuffled currentPixels
|
|
|
|
|
var newCurrentPixels = currentPixels.slice();
|
|
|
|
|
var pixelsFirst = [];
|
|
|
|
|
var pixelsLast = [];
|
|
|
|
|
if (!paused || forceTick) {
|
|
|
|
|
shuffleArray(newCurrentPixels);
|
|
|
|
|
}
|
|
|
|
|
/*{newCurrentPixels.sort(function(p) { // shuffle the pixels but keep elements[p.element].isGas last
|
|
|
|
|
return 0.5 - Math.random();
|
|
|
|
|
})} // shuffle the pixels if not paused*/
|
|
|
|
|
for (var i = 0; i < newCurrentPixels.length; i++) {
|
|
|
|
|
pixel = newCurrentPixels[i];
|
|
|
|
|
//if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue}
|
|
|
|
|
if (pixel.del) {continue}
|
|
|
|
|
if (!paused || forceTick) {
|
|
|
|
|
// VELOCITY
|
|
|
|
|
doVelocity(pixel);
|
|
|
|
|
if (elements[pixel.element].tick) { // Run tick function if it exists
|
|
|
|
|
elements[pixel.element].tick(pixel);
|
|
|
|
|
}
|
|
|
|
|
if (pixel.del) {continue}
|
|
|
|
|
if (elements[pixel.element].behavior) { // Parse behavior if it exists
|
|
|
|
|
pixelTick(pixel);
|
|
|
|
|
}
|
|
|
|
|
};
|
Sandboxels v1.9
[Version 1.9 - October 13, 2023 - Local Saves]
+ Local Saves
+ SAVES button
+ Save the scene to 1 of 12 slots
+ Save the scene to a file
+ Load a scene from a file
+ Saves include a ton of information, even your selected element!
+ Choose to include your settings or mods
+ Drag & Drop or Paste a save file
+ Pumpkin
+ Fireproof solid for carving activities
+ Pumpkin Seed
+ Will grow when planted on soil!
~ Thermal View now uses a more useful logarithmic scale
[Changes]
+ Resetting now adjusts canvas size if needed
+ Dot appears in center of cursor
+ E-cloner can select an element while unpowered
+ E-cloner ignores Wires and E-walls
+ Grass can spread on Sand, Clay, and Mycelium
+ Tree roots can grow through Clay
~ Sap no longer mixes with Sawdust
+ Plant and Sauce remove Stench
+ Humans break Eggs, Grapes, and bugs when on top of them
+ Humans can trample Grass
+ Termites can eat Confetti, Straw, and Wheat
+ Fleas can eat Hair
+ Ants can eat Honey
+ Snails can eat Calcium, Limestone, and Paper
+ Worms can infect and swim in Blood
+ Worms are killed by Antibodies
+ Eggs die at high temperatures
+ Bugs will form Amber when touching Sap
~ Frogs and Fish burn slower
+ Uranium dirties Salt Water
+ Radiation can dirty Ice
+ Blood is infected by Rotten Meat and Rotten Cheese
+ Vinegar and Limestone reaction
+ Ketchup slowly deoxidizes Rust
~ Charcoal leaves behind Ash and less CO₂
~ C4 no longer explodes when burnt
+ C4 releases poisonous fumes when burnt
+ C4 burns longer, can be used as fuel
+ C4 explodes when broken
+ Fireworks ignite at high temperatures
+ Dye dissolves in Pool Water
+ Ink slowly dissolves in Water
+ Honey dissolves in Tea
+ Molten Salt conducts electricity
+ Hair can be made by radiating Skin
+ Skin can absorb Soap
+ Proton and Electric reaction generates heat
+ Positron and Electric reaction generates Light
+ Escape key resets to Normal View
~ Recolored Tuff
~ Recolored Blood
~ Selected element outline is more clear
~ Improved button readability
~ Improved canvas pixel sharpness
+ Pressing - or + button centers the cursor
~ Step button is now an arrow
+ Clear Saves setting
[Bug Fixes]
~ Fixed: Fireworks and Flash don't transfer heat
~ Fixed: Flash from Heat Ray is not hot
~ Fixed: Alcohol Gas density too high
~ Fixed: Pistil and Mushroom Gill can be dragged
~ Fixed: Herb can't be mixed in Batter or Dough
~ Fixed: Amber spawns at high temperature
~ Fixed: Heads can detach if Body moves during reaction
~ Fixed: Many Flour reactions make Gingerbread instead of Dough
~ Fixed: Ghost pixels when burning Plague, other deleting gases
~ Fixed: Color picker always appears when toggling GUI on (F1)
~ Fixed: Cooldowned elements can't be placed before 8th tick
~ Fixed: Frozen Fish break into Slime
[Technical]
+ logMessage() function
+ SOIL eList
+ generateSave() and loadSave() functions
+ resizeCanvas() and autoResizeCanvas() functions
+ sb1 save format
~ Browser dark color scheme for UI elements
~ Light, Laser, etc. use bx/by instead of vx/vy (velocity.js fix)
2023-10-13 18:45:49 -04:00
|
|
|
if (elements[pixel.element].isGas || elements[pixel.element].glow) {
|
2022-09-13 18:11:22 -04:00
|
|
|
pixelsLast.push(pixel);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pixelsFirst.push(pixel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Draw the current pixels
|
|
|
|
|
var canvas = document.getElementById("game");
|
Sandboxels v1.9
[Version 1.9 - October 13, 2023 - Local Saves]
+ Local Saves
+ SAVES button
+ Save the scene to 1 of 12 slots
+ Save the scene to a file
+ Load a scene from a file
+ Saves include a ton of information, even your selected element!
+ Choose to include your settings or mods
+ Drag & Drop or Paste a save file
+ Pumpkin
+ Fireproof solid for carving activities
+ Pumpkin Seed
+ Will grow when planted on soil!
~ Thermal View now uses a more useful logarithmic scale
[Changes]
+ Resetting now adjusts canvas size if needed
+ Dot appears in center of cursor
+ E-cloner can select an element while unpowered
+ E-cloner ignores Wires and E-walls
+ Grass can spread on Sand, Clay, and Mycelium
+ Tree roots can grow through Clay
~ Sap no longer mixes with Sawdust
+ Plant and Sauce remove Stench
+ Humans break Eggs, Grapes, and bugs when on top of them
+ Humans can trample Grass
+ Termites can eat Confetti, Straw, and Wheat
+ Fleas can eat Hair
+ Ants can eat Honey
+ Snails can eat Calcium, Limestone, and Paper
+ Worms can infect and swim in Blood
+ Worms are killed by Antibodies
+ Eggs die at high temperatures
+ Bugs will form Amber when touching Sap
~ Frogs and Fish burn slower
+ Uranium dirties Salt Water
+ Radiation can dirty Ice
+ Blood is infected by Rotten Meat and Rotten Cheese
+ Vinegar and Limestone reaction
+ Ketchup slowly deoxidizes Rust
~ Charcoal leaves behind Ash and less CO₂
~ C4 no longer explodes when burnt
+ C4 releases poisonous fumes when burnt
+ C4 burns longer, can be used as fuel
+ C4 explodes when broken
+ Fireworks ignite at high temperatures
+ Dye dissolves in Pool Water
+ Ink slowly dissolves in Water
+ Honey dissolves in Tea
+ Molten Salt conducts electricity
+ Hair can be made by radiating Skin
+ Skin can absorb Soap
+ Proton and Electric reaction generates heat
+ Positron and Electric reaction generates Light
+ Escape key resets to Normal View
~ Recolored Tuff
~ Recolored Blood
~ Selected element outline is more clear
~ Improved button readability
~ Improved canvas pixel sharpness
+ Pressing - or + button centers the cursor
~ Step button is now an arrow
+ Clear Saves setting
[Bug Fixes]
~ Fixed: Fireworks and Flash don't transfer heat
~ Fixed: Flash from Heat Ray is not hot
~ Fixed: Alcohol Gas density too high
~ Fixed: Pistil and Mushroom Gill can be dragged
~ Fixed: Herb can't be mixed in Batter or Dough
~ Fixed: Amber spawns at high temperature
~ Fixed: Heads can detach if Body moves during reaction
~ Fixed: Many Flour reactions make Gingerbread instead of Dough
~ Fixed: Ghost pixels when burning Plague, other deleting gases
~ Fixed: Color picker always appears when toggling GUI on (F1)
~ Fixed: Cooldowned elements can't be placed before 8th tick
~ Fixed: Frozen Fish break into Slime
[Technical]
+ logMessage() function
+ SOIL eList
+ generateSave() and loadSave() functions
+ resizeCanvas() and autoResizeCanvas() functions
+ sb1 save format
~ Browser dark color scheme for UI elements
~ Light, Laser, etc. use bx/by instead of vx/vy (velocity.js fix)
2023-10-13 18:45:49 -04:00
|
|
|
if (canvas === null) {return}
|
2022-09-13 18:11:22 -04:00
|
|
|
var ctx = canvas.getContext("2d");
|
|
|
|
|
var pixelDrawList = pixelsFirst.concat(pixelsLast);
|
|
|
|
|
for (var i = 0; i < pixelDrawList.length; i++) {
|
|
|
|
|
pixel = pixelDrawList[i];
|
|
|
|
|
if (pixelMap[pixel.x][pixel.y] == undefined) {continue}
|
|
|
|
|
if (view===null || view===3) {
|
|
|
|
|
ctx.fillStyle = pixel.color;
|
|
|
|
|
}
|
|
|
|
|
else if (view === 2) { // thermal view
|
|
|
|
|
var temp = pixel.temp;
|
Sandboxels v1.9
[Version 1.9 - October 13, 2023 - Local Saves]
+ Local Saves
+ SAVES button
+ Save the scene to 1 of 12 slots
+ Save the scene to a file
+ Load a scene from a file
+ Saves include a ton of information, even your selected element!
+ Choose to include your settings or mods
+ Drag & Drop or Paste a save file
+ Pumpkin
+ Fireproof solid for carving activities
+ Pumpkin Seed
+ Will grow when planted on soil!
~ Thermal View now uses a more useful logarithmic scale
[Changes]
+ Resetting now adjusts canvas size if needed
+ Dot appears in center of cursor
+ E-cloner can select an element while unpowered
+ E-cloner ignores Wires and E-walls
+ Grass can spread on Sand, Clay, and Mycelium
+ Tree roots can grow through Clay
~ Sap no longer mixes with Sawdust
+ Plant and Sauce remove Stench
+ Humans break Eggs, Grapes, and bugs when on top of them
+ Humans can trample Grass
+ Termites can eat Confetti, Straw, and Wheat
+ Fleas can eat Hair
+ Ants can eat Honey
+ Snails can eat Calcium, Limestone, and Paper
+ Worms can infect and swim in Blood
+ Worms are killed by Antibodies
+ Eggs die at high temperatures
+ Bugs will form Amber when touching Sap
~ Frogs and Fish burn slower
+ Uranium dirties Salt Water
+ Radiation can dirty Ice
+ Blood is infected by Rotten Meat and Rotten Cheese
+ Vinegar and Limestone reaction
+ Ketchup slowly deoxidizes Rust
~ Charcoal leaves behind Ash and less CO₂
~ C4 no longer explodes when burnt
+ C4 releases poisonous fumes when burnt
+ C4 burns longer, can be used as fuel
+ C4 explodes when broken
+ Fireworks ignite at high temperatures
+ Dye dissolves in Pool Water
+ Ink slowly dissolves in Water
+ Honey dissolves in Tea
+ Molten Salt conducts electricity
+ Hair can be made by radiating Skin
+ Skin can absorb Soap
+ Proton and Electric reaction generates heat
+ Positron and Electric reaction generates Light
+ Escape key resets to Normal View
~ Recolored Tuff
~ Recolored Blood
~ Selected element outline is more clear
~ Improved button readability
~ Improved canvas pixel sharpness
+ Pressing - or + button centers the cursor
~ Step button is now an arrow
+ Clear Saves setting
[Bug Fixes]
~ Fixed: Fireworks and Flash don't transfer heat
~ Fixed: Flash from Heat Ray is not hot
~ Fixed: Alcohol Gas density too high
~ Fixed: Pistil and Mushroom Gill can be dragged
~ Fixed: Herb can't be mixed in Batter or Dough
~ Fixed: Amber spawns at high temperature
~ Fixed: Heads can detach if Body moves during reaction
~ Fixed: Many Flour reactions make Gingerbread instead of Dough
~ Fixed: Ghost pixels when burning Plague, other deleting gases
~ Fixed: Color picker always appears when toggling GUI on (F1)
~ Fixed: Cooldowned elements can't be placed before 8th tick
~ Fixed: Frozen Fish break into Slime
[Technical]
+ logMessage() function
+ SOIL eList
+ generateSave() and loadSave() functions
+ resizeCanvas() and autoResizeCanvas() functions
+ sb1 save format
~ Browser dark color scheme for UI elements
~ Light, Laser, etc. use bx/by instead of vx/vy (velocity.js fix)
2023-10-13 18:45:49 -04:00
|
|
|
if (temp < -50) {temp = -50}
|
2022-09-13 18:11:22 -04:00
|
|
|
if (temp > 6000) {temp = 6000}
|
Sandboxels v1.9
[Version 1.9 - October 13, 2023 - Local Saves]
+ Local Saves
+ SAVES button
+ Save the scene to 1 of 12 slots
+ Save the scene to a file
+ Load a scene from a file
+ Saves include a ton of information, even your selected element!
+ Choose to include your settings or mods
+ Drag & Drop or Paste a save file
+ Pumpkin
+ Fireproof solid for carving activities
+ Pumpkin Seed
+ Will grow when planted on soil!
~ Thermal View now uses a more useful logarithmic scale
[Changes]
+ Resetting now adjusts canvas size if needed
+ Dot appears in center of cursor
+ E-cloner can select an element while unpowered
+ E-cloner ignores Wires and E-walls
+ Grass can spread on Sand, Clay, and Mycelium
+ Tree roots can grow through Clay
~ Sap no longer mixes with Sawdust
+ Plant and Sauce remove Stench
+ Humans break Eggs, Grapes, and bugs when on top of them
+ Humans can trample Grass
+ Termites can eat Confetti, Straw, and Wheat
+ Fleas can eat Hair
+ Ants can eat Honey
+ Snails can eat Calcium, Limestone, and Paper
+ Worms can infect and swim in Blood
+ Worms are killed by Antibodies
+ Eggs die at high temperatures
+ Bugs will form Amber when touching Sap
~ Frogs and Fish burn slower
+ Uranium dirties Salt Water
+ Radiation can dirty Ice
+ Blood is infected by Rotten Meat and Rotten Cheese
+ Vinegar and Limestone reaction
+ Ketchup slowly deoxidizes Rust
~ Charcoal leaves behind Ash and less CO₂
~ C4 no longer explodes when burnt
+ C4 releases poisonous fumes when burnt
+ C4 burns longer, can be used as fuel
+ C4 explodes when broken
+ Fireworks ignite at high temperatures
+ Dye dissolves in Pool Water
+ Ink slowly dissolves in Water
+ Honey dissolves in Tea
+ Molten Salt conducts electricity
+ Hair can be made by radiating Skin
+ Skin can absorb Soap
+ Proton and Electric reaction generates heat
+ Positron and Electric reaction generates Light
+ Escape key resets to Normal View
~ Recolored Tuff
~ Recolored Blood
~ Selected element outline is more clear
~ Improved button readability
~ Improved canvas pixel sharpness
+ Pressing - or + button centers the cursor
~ Step button is now an arrow
+ Clear Saves setting
[Bug Fixes]
~ Fixed: Fireworks and Flash don't transfer heat
~ Fixed: Flash from Heat Ray is not hot
~ Fixed: Alcohol Gas density too high
~ Fixed: Pistil and Mushroom Gill can be dragged
~ Fixed: Herb can't be mixed in Batter or Dough
~ Fixed: Amber spawns at high temperature
~ Fixed: Heads can detach if Body moves during reaction
~ Fixed: Many Flour reactions make Gingerbread instead of Dough
~ Fixed: Ghost pixels when burning Plague, other deleting gases
~ Fixed: Color picker always appears when toggling GUI on (F1)
~ Fixed: Cooldowned elements can't be placed before 8th tick
~ Fixed: Frozen Fish break into Slime
[Technical]
+ logMessage() function
+ SOIL eList
+ generateSave() and loadSave() functions
+ resizeCanvas() and autoResizeCanvas() functions
+ sb1 save format
~ Browser dark color scheme for UI elements
~ Light, Laser, etc. use bx/by instead of vx/vy (velocity.js fix)
2023-10-13 18:45:49 -04:00
|
|
|
// logarithmic scale, with coldest being 225 (-50 degrees) and hottest being 0 (6000 degrees)
|
|
|
|
|
var hue = Math.round(225 - (Math.log(temp+50)/Math.log(6000+50))*225);
|
2022-09-13 18:11:22 -04:00
|
|
|
if (hue < 0) {hue = 0}
|
|
|
|
|
if (hue > 225) {hue = 225}
|
|
|
|
|
ctx.fillStyle = "hsl("+hue+",100%,50%)";
|
|
|
|
|
}
|
|
|
|
|
else if (view === 4) { // smooth view, average of surrounding pixels
|
|
|
|
|
var colorlist = [];
|
|
|
|
|
// check adjacent coords on the pixelMap, add the color to the list if the pixel is not empty and the color indexOf "rgb" is not -1
|
|
|
|
|
for (var j = 0; j < biCoords.length; j++) {
|
|
|
|
|
var x = pixel.x + biCoords[j][0];
|
|
|
|
|
var y = pixel.y + biCoords[j][1];
|
|
|
|
|
if (isEmpty(x,y,true) || elements[pixelMap[x][y].element].state !== elements[pixel.element].state) {continue}
|
|
|
|
|
var color = pixelMap[x][y].color;
|
|
|
|
|
if (color.indexOf("rgb") !== -1) {
|
|
|
|
|
colorlist.push(color.match(/\d+/g));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (colorlist.length === 0) {
|
|
|
|
|
ctx.fillStyle = pixel.color;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ctx.fillStyle = averageRGB(colorlist);
|
|
|
|
|
}
|
|
|
|
|
}
|
Sandboxels v1.9
[Version 1.9 - October 13, 2023 - Local Saves]
+ Local Saves
+ SAVES button
+ Save the scene to 1 of 12 slots
+ Save the scene to a file
+ Load a scene from a file
+ Saves include a ton of information, even your selected element!
+ Choose to include your settings or mods
+ Drag & Drop or Paste a save file
+ Pumpkin
+ Fireproof solid for carving activities
+ Pumpkin Seed
+ Will grow when planted on soil!
~ Thermal View now uses a more useful logarithmic scale
[Changes]
+ Resetting now adjusts canvas size if needed
+ Dot appears in center of cursor
+ E-cloner can select an element while unpowered
+ E-cloner ignores Wires and E-walls
+ Grass can spread on Sand, Clay, and Mycelium
+ Tree roots can grow through Clay
~ Sap no longer mixes with Sawdust
+ Plant and Sauce remove Stench
+ Humans break Eggs, Grapes, and bugs when on top of them
+ Humans can trample Grass
+ Termites can eat Confetti, Straw, and Wheat
+ Fleas can eat Hair
+ Ants can eat Honey
+ Snails can eat Calcium, Limestone, and Paper
+ Worms can infect and swim in Blood
+ Worms are killed by Antibodies
+ Eggs die at high temperatures
+ Bugs will form Amber when touching Sap
~ Frogs and Fish burn slower
+ Uranium dirties Salt Water
+ Radiation can dirty Ice
+ Blood is infected by Rotten Meat and Rotten Cheese
+ Vinegar and Limestone reaction
+ Ketchup slowly deoxidizes Rust
~ Charcoal leaves behind Ash and less CO₂
~ C4 no longer explodes when burnt
+ C4 releases poisonous fumes when burnt
+ C4 burns longer, can be used as fuel
+ C4 explodes when broken
+ Fireworks ignite at high temperatures
+ Dye dissolves in Pool Water
+ Ink slowly dissolves in Water
+ Honey dissolves in Tea
+ Molten Salt conducts electricity
+ Hair can be made by radiating Skin
+ Skin can absorb Soap
+ Proton and Electric reaction generates heat
+ Positron and Electric reaction generates Light
+ Escape key resets to Normal View
~ Recolored Tuff
~ Recolored Blood
~ Selected element outline is more clear
~ Improved button readability
~ Improved canvas pixel sharpness
+ Pressing - or + button centers the cursor
~ Step button is now an arrow
+ Clear Saves setting
[Bug Fixes]
~ Fixed: Fireworks and Flash don't transfer heat
~ Fixed: Flash from Heat Ray is not hot
~ Fixed: Alcohol Gas density too high
~ Fixed: Pistil and Mushroom Gill can be dragged
~ Fixed: Herb can't be mixed in Batter or Dough
~ Fixed: Amber spawns at high temperature
~ Fixed: Heads can detach if Body moves during reaction
~ Fixed: Many Flour reactions make Gingerbread instead of Dough
~ Fixed: Ghost pixels when burning Plague, other deleting gases
~ Fixed: Color picker always appears when toggling GUI on (F1)
~ Fixed: Cooldowned elements can't be placed before 8th tick
~ Fixed: Frozen Fish break into Slime
[Technical]
+ logMessage() function
+ SOIL eList
+ generateSave() and loadSave() functions
+ resizeCanvas() and autoResizeCanvas() functions
+ sb1 save format
~ Browser dark color scheme for UI elements
~ Light, Laser, etc. use bx/by instead of vx/vy (velocity.js fix)
2023-10-13 18:45:49 -04:00
|
|
|
if (ctx.globalAlpha < 1 && !(elements[pixel.element].isGas || elements[pixel.element].glow)) {
|
|
|
|
|
ctx.globalAlpha = 1;
|
|
|
|
|
}
|
|
|
|
|
if ((view === null || view === 4) && (elements[pixel.element].isGas || elements[pixel.element].glow)) {
|
|
|
|
|
if (ctx.globalAlpha!==0.5) { ctx.globalAlpha = 0.5; }
|
2022-09-13 18:11:22 -04:00
|
|
|
ctx.fillRect((pixel.x-1)*pixelSize, (pixel.y)*pixelSize, pixelSize*3, pixelSize);
|
|
|
|
|
ctx.fillRect((pixel.x)*pixelSize, (pixel.y-1)*pixelSize, pixelSize, pixelSize*3);
|
|
|
|
|
}
|
|
|
|
|
else { // draw the pixel (default)
|
|
|
|
|
ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize);
|
|
|
|
|
}
|
|
|
|
|
if (pixel.charge && view !== 2) { // Yellow glow on charge
|
|
|
|
|
if (!elements[pixel.element].colorOn) {
|
|
|
|
|
ctx.fillStyle = "rgba(255,255,0,0.5)";
|
|
|
|
|
ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
Sandboxels v1.9
[Version 1.9 - October 13, 2023 - Local Saves]
+ Local Saves
+ SAVES button
+ Save the scene to 1 of 12 slots
+ Save the scene to a file
+ Load a scene from a file
+ Saves include a ton of information, even your selected element!
+ Choose to include your settings or mods
+ Drag & Drop or Paste a save file
+ Pumpkin
+ Fireproof solid for carving activities
+ Pumpkin Seed
+ Will grow when planted on soil!
~ Thermal View now uses a more useful logarithmic scale
[Changes]
+ Resetting now adjusts canvas size if needed
+ Dot appears in center of cursor
+ E-cloner can select an element while unpowered
+ E-cloner ignores Wires and E-walls
+ Grass can spread on Sand, Clay, and Mycelium
+ Tree roots can grow through Clay
~ Sap no longer mixes with Sawdust
+ Plant and Sauce remove Stench
+ Humans break Eggs, Grapes, and bugs when on top of them
+ Humans can trample Grass
+ Termites can eat Confetti, Straw, and Wheat
+ Fleas can eat Hair
+ Ants can eat Honey
+ Snails can eat Calcium, Limestone, and Paper
+ Worms can infect and swim in Blood
+ Worms are killed by Antibodies
+ Eggs die at high temperatures
+ Bugs will form Amber when touching Sap
~ Frogs and Fish burn slower
+ Uranium dirties Salt Water
+ Radiation can dirty Ice
+ Blood is infected by Rotten Meat and Rotten Cheese
+ Vinegar and Limestone reaction
+ Ketchup slowly deoxidizes Rust
~ Charcoal leaves behind Ash and less CO₂
~ C4 no longer explodes when burnt
+ C4 releases poisonous fumes when burnt
+ C4 burns longer, can be used as fuel
+ C4 explodes when broken
+ Fireworks ignite at high temperatures
+ Dye dissolves in Pool Water
+ Ink slowly dissolves in Water
+ Honey dissolves in Tea
+ Molten Salt conducts electricity
+ Hair can be made by radiating Skin
+ Skin can absorb Soap
+ Proton and Electric reaction generates heat
+ Positron and Electric reaction generates Light
+ Escape key resets to Normal View
~ Recolored Tuff
~ Recolored Blood
~ Selected element outline is more clear
~ Improved button readability
~ Improved canvas pixel sharpness
+ Pressing - or + button centers the cursor
~ Step button is now an arrow
+ Clear Saves setting
[Bug Fixes]
~ Fixed: Fireworks and Flash don't transfer heat
~ Fixed: Flash from Heat Ray is not hot
~ Fixed: Alcohol Gas density too high
~ Fixed: Pistil and Mushroom Gill can be dragged
~ Fixed: Herb can't be mixed in Batter or Dough
~ Fixed: Amber spawns at high temperature
~ Fixed: Heads can detach if Body moves during reaction
~ Fixed: Many Flour reactions make Gingerbread instead of Dough
~ Fixed: Ghost pixels when burning Plague, other deleting gases
~ Fixed: Color picker always appears when toggling GUI on (F1)
~ Fixed: Cooldowned elements can't be placed before 8th tick
~ Fixed: Frozen Fish break into Slime
[Technical]
+ logMessage() function
+ SOIL eList
+ generateSave() and loadSave() functions
+ resizeCanvas() and autoResizeCanvas() functions
+ sb1 save format
~ Browser dark color scheme for UI elements
~ Light, Laser, etc. use bx/by instead of vx/vy (velocity.js fix)
2023-10-13 18:45:49 -04:00
|
|
|
if (ctx.globalAlpha < 1) {
|
|
|
|
|
ctx.globalAlpha = 1;
|
|
|
|
|
}
|
2022-09-13 18:11:22 -04:00
|
|
|
if ((!paused) || forceTick) {pixelTicks++};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-09-13 18:13:00 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
explodeAt = function(x,y,radius,fire="fire") {
|
|
|
|
|
// if fire contains , split it into an array
|
|
|
|
|
if (fire.indexOf(",") !== -1) {
|
|
|
|
|
fire = fire.split(",");
|
|
|
|
|
}
|
|
|
|
|
var coords = circleCoords(x,y,radius);
|
|
|
|
|
var power = radius/10;
|
|
|
|
|
//for (var p = 0; p < Math.round(radius/10+1); p++) {
|
|
|
|
|
for (var i = 0; i < coords.length; i++) {
|
|
|
|
|
// damage value is based on distance from x and y
|
|
|
|
|
var damage = Math.random() + (Math.floor(Math.sqrt(Math.pow(coords[i].x-x,2) + Math.pow(coords[i].y-y,2)))) / radius;
|
|
|
|
|
// invert
|
|
|
|
|
damage = 1 - damage;
|
|
|
|
|
if (damage < 0) { damage = 0; }
|
|
|
|
|
damage *= power;
|
|
|
|
|
if (isEmpty(coords[i].x,coords[i].y)) {
|
|
|
|
|
// create smoke or fire depending on the damage if empty
|
|
|
|
|
if (damage < 0.02) { } // do nothing
|
|
|
|
|
else if (damage < 0.2) {
|
|
|
|
|
createPixel("smoke",coords[i].x,coords[i].y);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// if fire is an array, choose a random item
|
|
|
|
|
if (Array.isArray(fire)) {
|
|
|
|
|
createPixel(fire[Math.floor(Math.random() * fire.length)],coords[i].x,coords[i].y);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
createPixel(fire,coords[i].x,coords[i].y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!outOfBounds(coords[i].x,coords[i].y)) {
|
|
|
|
|
// damage the pixel
|
|
|
|
|
var pixel = pixelMap[coords[i].x][coords[i].y];
|
|
|
|
|
var info = elements[pixel.element];
|
|
|
|
|
if (info.hardness) { // lower damage depending on hardness(0-1)
|
|
|
|
|
if (info.hardness < 1) {
|
|
|
|
|
damage = damage * ((1 - info.hardness)*10);
|
|
|
|
|
}
|
|
|
|
|
else { damage = 0; }
|
|
|
|
|
}
|
|
|
|
|
if (damage > 0.9) {
|
|
|
|
|
if (Array.isArray(fire)) {
|
|
|
|
|
var newfire = fire[Math.floor(Math.random() * fire.length)];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var newfire = fire;
|
|
|
|
|
}
|
|
|
|
|
changePixel(pixel,newfire);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if (damage > 0.25) {
|
|
|
|
|
if (info.breakInto) {
|
|
|
|
|
// if it is an array, choose a random item, else just use the value
|
|
|
|
|
if (Array.isArray(info.breakInto)) {
|
|
|
|
|
var result = info.breakInto[Math.floor(Math.random() * info.breakInto.length)];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var result = info.breakInto;
|
|
|
|
|
}
|
|
|
|
|
// change the pixel to the result
|
|
|
|
|
changePixel(pixel,result);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (Array.isArray(fire)) {
|
|
|
|
|
var newfire = fire[Math.floor(Math.random() * fire.length)];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var newfire = fire;
|
|
|
|
|
}
|
|
|
|
|
changePixel(pixel,newfire);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (damage > 0.75 && info.burn) {
|
|
|
|
|
pixel.burning = true;
|
|
|
|
|
pixel.burnStart = pixelTicks;
|
|
|
|
|
}
|
|
|
|
|
pixel.temp += damage*radius*power;
|
|
|
|
|
pixelTempCheck(pixel);
|
|
|
|
|
// set the pixel.vx and pixel.vy depending on the angle and power
|
2022-09-13 18:18:37 -04:00
|
|
|
if (!elements[pixel.element].excludeRandom) {
|
|
|
|
|
var angle = Math.atan2(pixel.y-y,pixel.x-x);
|
2022-09-13 18:35:34 -04:00
|
|
|
pixel.vx = Math.round((pixel.vx|0) + Math.cos(angle) * (radius * power/10));
|
|
|
|
|
pixel.vy = Math.round((pixel.vy|0) + Math.sin(angle) * (radius * power/10));
|
2022-09-13 18:18:37 -04:00
|
|
|
}
|
2022-09-13 18:13:00 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|