2026-10-22 14:05:51 +00:00
|
|
|
export const defaultConfig = {
|
|
|
|
|
global: { gravity: 0.5, drag: 0.9 },
|
|
|
|
|
time: { paused: false, speed: 1 },
|
2026-10-22 14:45:19 +00:00
|
|
|
brush: { size: 4 },
|
2026-10-22 14:05:51 +00:00
|
|
|
explosive: {
|
|
|
|
|
radius: 15,
|
|
|
|
|
force: 2.0,
|
2026-10-22 14:45:19 +00:00
|
|
|
destroy: {
|
|
|
|
|
rock: true,
|
|
|
|
|
wood: true,
|
|
|
|
|
dirt: true,
|
|
|
|
|
sand: true,
|
|
|
|
|
plant: true,
|
|
|
|
|
grass: true,
|
|
|
|
|
water: false,
|
|
|
|
|
acid: true,
|
|
|
|
|
ice: true,
|
|
|
|
|
lava: false,
|
|
|
|
|
oil: true
|
|
|
|
|
}
|
2026-10-22 14:05:51 +00:00
|
|
|
},
|
|
|
|
|
acid: {
|
|
|
|
|
dissolveChance: 0.05,
|
|
|
|
|
sinkChance: 0.2,
|
2026-10-22 14:45:19 +00:00
|
|
|
dispersion: 4,
|
2026-10-22 14:05:51 +00:00
|
|
|
explodeTNT: false,
|
2026-10-22 14:45:19 +00:00
|
|
|
dissolve: {
|
|
|
|
|
rock: false,
|
|
|
|
|
wood: true,
|
|
|
|
|
dirt: true,
|
|
|
|
|
sand: false,
|
|
|
|
|
plant: true,
|
|
|
|
|
grass: true,
|
|
|
|
|
water: false,
|
|
|
|
|
ice: true,
|
|
|
|
|
oil: true
|
|
|
|
|
}
|
2026-10-22 14:05:51 +00:00
|
|
|
},
|
2026-10-22 14:45:19 +00:00
|
|
|
fire: { burnChance: 0.015 },
|
|
|
|
|
water: { flowChance: 1.0, dispersion: 5 },
|
|
|
|
|
lava: { flowChance: 0.4, dispersion: 2, coolingChance: 0.04, sinkChance: 0.7 },
|
|
|
|
|
oil: { flowChance: 0.85, dispersion: 4, burnChance: 0.04, sinkChance: 0.25, floatChance: 0.25 },
|
|
|
|
|
ice: { meltChance: 0.02, freezeChance: 0.01 },
|
2026-10-22 14:05:51 +00:00
|
|
|
steam: { condenseChance: 0.01 },
|
2026-10-22 14:45:19 +00:00
|
|
|
smoke: { dissipateChance: 0.02 },
|
2026-10-22 14:05:51 +00:00
|
|
|
plant: { growChance: 0.02, woodificationChance: 0.01, burnChance: 0.4 },
|
2026-10-22 14:45:19 +00:00
|
|
|
grass: { growChance: 0.03, burnChance: 0.5 },
|
2026-10-22 14:05:51 +00:00
|
|
|
wood: { burnChance: 0.05 },
|
2026-10-22 14:45:19 +00:00
|
|
|
visual: { style: 'blocky', colorNoise: true }
|
2026-10-22 14:05:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export let config = JSON.parse(JSON.stringify(defaultConfig));
|
|
|
|
|
|
|
|
|
|
export function setConfig(newConfig) {
|
|
|
|
|
config = newConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function saveSettings() {
|
|
|
|
|
localStorage.setItem('sandGameSettings', JSON.stringify(config));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function loadSettings() {
|
|
|
|
|
if (localStorage.getItem('sandGameSettings')) {
|
|
|
|
|
try {
|
|
|
|
|
const saved = JSON.parse(localStorage.getItem('sandGameSettings'));
|
|
|
|
|
for (const key in saved) {
|
|
|
|
|
if (config[key]) {
|
2026-10-22 14:45:19 +00:00
|
|
|
if (typeof config[key] === 'object' && !Array.isArray(config[key])) {
|
|
|
|
|
Object.assign(config[key], saved[key]);
|
|
|
|
|
} else {
|
|
|
|
|
config[key] = saved[key];
|
|
|
|
|
}
|
2026-10-22 14:05:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Error loading settings:', e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|