removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -16,18 +16,17 @@ function tarinaiRoundRectPath(ctx, x, y, w, h, r) {
|
|||
}
|
||||
|
||||
class Tarinai { constructor(world, opts = {}) {
|
||||
if (world && !opts.birthSeed && !opts.familyKey && !opts.id && globalThis.TarinaiSeedFactory?.prepareAddOptions) {
|
||||
if (world && !opts.birthSeed && !opts.familyKey && !opts.id && globalThis.TarinaiSeedFactory.prepareAddOptions) {
|
||||
opts = globalThis.TarinaiSeedFactory.prepareAddOptions(world, opts) || opts;
|
||||
}
|
||||
this.world = world;
|
||||
this.birthSeed = opts.birthSeed || opts.familyKey || opts.id || (globalThis.TarinaiSeedFactory?.childSeed?.(world?.worldSeed || "", Number(world?.birthSerial || 0) + 1, []) || (crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`));
|
||||
this.birthSerial = Number.isFinite(opts.birthSerial) ? Number(opts.birthSerial) : (globalThis.TarinaiSeedFactory?.serialFromBirthSeed?.(this.birthSeed) || 0);
|
||||
const birthProfile = globalThis.TarinaiSeedFactory?.birthProfile?.(this.birthSeed, opts) || {};
|
||||
this.birthSeed = opts.birthSeed || opts.familyKey || opts.id || (globalThis.TarinaiSeedFactory.childSeed(world?.worldSeed || "", Number(world?.birthSerial || 0) + 1, []) || (crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`));
|
||||
this.birthSerial = Number.isFinite(opts.birthSerial) ? Number(opts.birthSerial) : (globalThis.TarinaiSeedFactory.serialFromBirthSeed(this.birthSeed) || 0);
|
||||
const birthProfile = globalThis.TarinaiSeedFactory.birthProfile(this.birthSeed, opts) || {};
|
||||
this.familyKey = opts.familyKey || this.birthSeed;
|
||||
this.id = opts.id || "";
|
||||
this.liveToken = opts.liveToken || 0;
|
||||
this.name = opts.name || birthProfile.name || makeName(world);
|
||||
this.personality = "";
|
||||
this.type = opts.type || birthProfile.type || baseSpriteId();
|
||||
const typeMeta = SPRITES.find(s => s.id === this.type);
|
||||
if (typeMeta?.actionOnly || typeMeta?.displayOnly) this.type = birthProfile.type || baseSpriteId();
|
||||
|
|
@ -73,8 +72,6 @@ class Tarinai { constructor(world, opts = {}) {
|
|||
this.needRaw = opts.needRaw && typeof opts.needRaw === "object" ? { ...defaultNeeds, ...opts.needRaw } : { ...this.needs };
|
||||
this.needRawBase = opts.needRawBase && typeof opts.needRawBase === "object" ? { ...defaultNeeds, ...opts.needRawBase } : { ...this.needRaw };
|
||||
this.needSatisfaction = opts.needSatisfaction && typeof opts.needSatisfaction === "object" ? { ...defaultNeeds, ...opts.needSatisfaction } : { ...defaultNeeds };
|
||||
this.lastSatisfiedAt = opts.lastSatisfiedAt && typeof opts.lastSatisfiedAt === "object" ? { ...opts.lastSatisfiedAt } : {};
|
||||
this.lastSatisfactionSource = opts.lastSatisfactionSource || "";
|
||||
this.stress = typeof calculateStressFromNeeds === "function" ? calculateStressFromNeeds(this.needRaw || this.needs) : 0;
|
||||
this.previousNeeds = opts.previousNeeds && typeof opts.previousNeeds === "object" ? { ...defaultNeeds, ...opts.previousNeeds } : { ...this.needs };
|
||||
this.need = "";
|
||||
|
|
@ -92,13 +89,11 @@ class Tarinai { constructor(world, opts = {}) {
|
|||
this.stressBarTimer = opts.stressBarTimer ?? 0;
|
||||
this.affection = opts.affection ?? rand(0, 30);
|
||||
this.dead = !!opts.dead;
|
||||
this.lifeStatus = opts.lifeStatus || (this.dead ? "dead" : "alive");
|
||||
this.deathReason = opts.deathReason || "";
|
||||
this.lastDamageCause = opts.lastDamageCause || "";
|
||||
this.lastDamageAmount = opts.lastDamageAmount ?? 0;
|
||||
this.lastDamageAt = opts.lastDamageAt ?? -999;
|
||||
this.lastMajorDamageCause = opts.lastMajorDamageCause || "";
|
||||
this.lastMajorDamageAmount = opts.lastMajorDamageAmount ?? 0;
|
||||
this.lastMajorDamageAt = opts.lastMajorDamageAt ?? -999;
|
||||
this.thought = "";
|
||||
this.target = null;
|
||||
|
|
@ -116,16 +111,12 @@ class Tarinai { constructor(world, opts = {}) {
|
|||
this.lastLog = 0;
|
||||
this.sleeping = false;
|
||||
this.awakeLockTimer = opts.awakeLockTimer ?? 0;
|
||||
this.wasSleepingLastTick = false;
|
||||
this.blink = rand(0, 10);
|
||||
this.lastSocial = 0;
|
||||
this.goodMode = opts.goodMode ?? birthProfile.goodMode ?? stableChoice(this.birthSeed || this.familyKey, "good-mode", displayNormalSprites()) ?? "smile";
|
||||
this.facing = opts.facing ?? (stableUnit(this.familyKey, "facing") < 0.5 ? -1 : 1);
|
||||
this.visualFacing = opts.visualFacing ?? this.facing;
|
||||
this.facingLockUntil = opts.facingLockUntil ?? 0;
|
||||
this.eatTimer = opts.eatTimer ?? 0;
|
||||
this.eatCooldown = opts.eatCooldown ?? 0;
|
||||
this.lastAteAt = Number.isFinite(opts.lastAteAt) ? opts.lastAteAt : (this.world?.time || 0);
|
||||
this.mealCooldownUntil = Number.isFinite(opts.mealCooldownUntil) ? opts.mealCooldownUntil : 0;
|
||||
this.foodReactTimer = opts.foodReactTimer ?? 0;
|
||||
this.surpriseTimer = opts.surpriseTimer ?? 0;
|
||||
|
|
@ -169,7 +160,6 @@ class Tarinai { constructor(world, opts = {}) {
|
|||
this.favorite = Boolean(opts.favorite);
|
||||
this.insideNestBoxId = opts.insideNestBoxId || null;
|
||||
this.nestFade = opts.nestFade ?? (this.insideNestBoxId ? 1 : 0);
|
||||
this.nestBoxEnteredAt = opts.nestBoxEnteredAt ?? (this.insideNestBoxId ? (world?.time || 0) : -Infinity);
|
||||
this.nestBoxStayUntil = opts.nestBoxStayUntil ?? (this.insideNestBoxId ? ((world?.time || 0) + 10) : -Infinity);
|
||||
this.focusPulseTimer = opts.focusPulseTimer ?? 0;
|
||||
if (this.isZunchiSlave) {
|
||||
|
|
@ -195,7 +185,6 @@ class Tarinai { constructor(world, opts = {}) {
|
|||
: 0;
|
||||
this.poopCount = opts.poopCount ?? 0;
|
||||
this.oshiriByoZunchiStock = opts.oshiriByoZunchiStock ?? 0;
|
||||
this.stretchTimer = opts.stretchTimer ?? 0;
|
||||
this.lastMealColor = opts.lastMealColor || "#f7cf67";
|
||||
this.grassEatTimer = opts.grassEatTimer ?? 0;
|
||||
this.hurtTimer = opts.hurtTimer ?? 0;
|
||||
|
|
@ -210,12 +199,9 @@ class Tarinai { constructor(world, opts = {}) {
|
|||
this.blastSpinTimer = opts.blastSpinTimer ?? 0;
|
||||
this.blastSpinMax = opts.blastSpinMax ?? 0;
|
||||
this.postBirthPeaceTimer = opts.postBirthPeaceTimer ?? 0;
|
||||
this.sleepStart = 0.60 + stableUnit(this.familyKey, "sleep-start") * 0.22;
|
||||
this.sleepEnd = 0.15 + stableUnit(this.familyKey, "sleep-end") * 0.14;
|
||||
this.sleepFacing = stableUnit(this.familyKey, "sleep-facing") < 0.5 ? -1 : 1;
|
||||
this.nextBubbleAt = 0;
|
||||
this.nextSleepBubbleAt = 0;
|
||||
this.nextFearBubbleAt = 0;
|
||||
this.nextCursorHeartAt = opts.nextCursorHeartAt ?? 0;
|
||||
this.cursorPetting = opts.cursorPetting ?? 0;
|
||||
this.aiTimer = opts.aiTimer ?? stableUnit(this.familyKey, "ai-start") * 0.22;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue