This commit is contained in:
33333-33333 2026-07-09 16:08:11 +09:00
commit f1c3af2b89
49 changed files with 989 additions and 310 deletions

View file

@ -361,23 +361,29 @@
if (valuesDiffer(w[6], 1)) mask |= 2;
if (valuesDiffer(w[7], 0)) mask |= 4;
if (valuesDiffer(w[9], 0)) mask |= 8;
writeBitFields(writer, [mask], [4]);
if (valuesDiffer(w[10], 0)) mask |= 16;
if (valuesDiffer(w[11], 0)) mask |= 32;
writeBitFields(writer, [mask], [6]);
if (mask & 1) writer.s(w[5] || 0); // lastBirthAt10 can be negative
if (mask & 2) writer.u(w[6] || 1); // generation
if (mask & 4) writer.u(w[7] || 0); // dead count
writeSaveString(writer, w[8] || ""); // worldSeed
if (mask & 8) writer.u(w[9] || 0); // birthSerial
if (mask & 16) writer.u(w[10] || 0); // tarinai population limit
if (mask & 32) writer.u(w[11] || 0); // object limit
}
function readWorld(reader) {
const [field, ground, mood, weather] = readBitFields(reader, [2, 3, 4, 3]);
const tick = reader.u();
const [mask] = readBitFields(reader, [4]);
const [mask] = readBitFields(reader, [6]);
const lastBirthAt = (mask & 1) ? reader.s() : -9990;
const generation = (mask & 2) ? reader.u() : 1;
const deadCount = (mask & 4) ? reader.u() : 0;
const seed = readSaveString(reader);
const birthSerial = (mask & 8) ? reader.u() : 0;
return [field, ground, mood, tick, weather, lastBirthAt, generation, deadCount, seed, birthSerial];
const tarinaiPopulationLimit = (mask & 16) ? reader.u() : 0;
const objectLimit = (mask & 32) ? reader.u() : 0;
return [field, ground, mood, tick, weather, lastBirthAt, generation, deadCount, seed, birthSerial, tarinaiPopulationLimit, objectLimit];
}
function seedPersonalityArray(seed = "", flags = 0) {