feat(falukant): enhance marriage actions with production delay handling and UI updates
All checks were successful
Deploy to production / deploy (push) Successful in 2m58s

- Implemented logic in FalukantService to delay running productions when spending time with a spouse, updating the start timestamp accordingly.
- Enhanced the response from the spend time API to include details about delayed productions and household order changes.
- Updated FamilyView component to display the cost of marriage actions and added a help section detailing the effects of actions, including production delays.
- Added new translations for action effects in multiple languages to improve user understanding of the marriage actions.
This commit is contained in:
Torsten Schulz (local)
2026-04-13 12:09:17 +02:00
parent ba72d4fb74
commit 1bce855b3a
7 changed files with 136 additions and 10 deletions

View File

@@ -3886,17 +3886,64 @@ class FalukantService extends BaseService {
});
}
const userHouse = await UserHouse.findOne({
where: { userId: user.id },
attributes: ['householdOrder']
});
const productionDelayMinutes = 15;
const runningProductions = await Production.findAll({
where: { sleep: false },
include: [{
model: Branch,
as: 'branch',
required: true,
where: { falukantUserId: user.id },
attributes: ['id']
}],
attributes: ['id', 'startTimestamp']
});
const nextSatisfaction = this.clampScore((state.marriageSatisfaction ?? 55) + 2);
const nextPublicStability = this.clampScore((state.marriagePublicStability ?? 55) + 1);
await state.update({
marriageSatisfaction: nextSatisfaction,
marriagePublicStability: nextPublicStability
const nextHouseholdOrder = userHouse
? this.clampScore(Number(userHouse.householdOrder ?? 55) - 2)
: null;
const delayMs = productionDelayMinutes * 60 * 1000;
let delayedProductions = 0;
await sequelize.transaction(async (t) => {
await state.update({
marriageSatisfaction: nextSatisfaction,
marriagePublicStability: nextPublicStability
});
if (userHouse && nextHouseholdOrder != null) {
await userHouse.update({
householdOrder: nextHouseholdOrder
});
}
for (const production of runningProductions) {
const startAt = new Date(production.startTimestamp);
if (Number.isNaN(startAt.getTime())) {
continue;
}
await production.update(
{ startTimestamp: new Date(startAt.getTime() + delayMs) },
{ transaction: t }
);
delayedProductions += 1;
}
});
await this.refreshHouseholdTensionState(user, user.character);
await notifyUser(hashedUserId, 'falukantUpdateFamily', { reason: 'daily' });
await notifyUser(hashedUserId, 'falukantUpdateStatus', {});
return { success: true, marriageSatisfaction: nextSatisfaction };
return {
success: true,
marriageSatisfaction: nextSatisfaction,
marriagePublicStability: nextPublicStability,
householdOrder: nextHouseholdOrder,
delayedProductions,
productionDelayMinutes
};
}
async giftToSpouse(hashedUserId, giftLevel) {