From f81c08437c22e926f2135018066b15e5ac91a8ba Mon Sep 17 00:00:00 2001 From: Hendrik Lind Date: Thu, 11 Jun 2026 17:59:44 +0200 Subject: [PATCH] feat: scale housing complaint intensity by colony age Colonists complained about housing with the same intensity regardless of colony age. A colonist in a freshly-built level 1 hut on day 3 used the same desperate language as one homeless on day 100. Changes: - McTalkingConfig: add scaleHousingComplaintsByAge toggle (default true) - DefaultCitizenPromptProvider: age-aware housing complaint texts with 3 tiers (<7 days patient, 7-30 days moderate, >=30 days full concern) - CitizenNeedAssessor: reduce homeless urgency weight from 0.7 to 0.3 for colonies younger than 7 days - en_us.json: translation for the new config option Closes #117 --- .../mc_talking/config/McTalkingConfig.java | 5 ++ .../manager/DefaultCitizenPromptProvider.java | 56 +++++++++++++++---- .../mc_talking/util/CitizenNeedAssessor.java | 9 ++- .../assets/mc_talking/lang/en_us.json | 3 + 4 files changed, 61 insertions(+), 12 deletions(-) diff --git a/src/main/java/me/sshcrack/mc_talking/config/McTalkingConfig.java b/src/main/java/me/sshcrack/mc_talking/config/McTalkingConfig.java index 4fdd1976..e5ee9bcb 100644 --- a/src/main/java/me/sshcrack/mc_talking/config/McTalkingConfig.java +++ b/src/main/java/me/sshcrack/mc_talking/config/McTalkingConfig.java @@ -225,6 +225,11 @@ public class McTalkingConfig { @SerialEntry(comment = "Minimum cooldown in seconds between urgent citizen contacts for the same player. Set to 0 to disable.") public int playerUrgentContactCooldownSeconds = 60; + @AutoGen(category = "citizens") + @TickBox + @SerialEntry(comment = "If true, housing complaint severity is scaled by colony age. Young colonies get patient/mild texts; older colonies get the full range of concern.") + public boolean scaleHousingComplaintsByAge = true; + @AutoGen(category = "citizens", group = "citizen_contact") @DoubleSlider(min = 0.0, max = 1.0, step = 0.01) @SerialEntry(comment = "Base weight for casual greetings (0.0-1.0). Even content citizens get this small chance to wave/say hello per check interval. Multiplied by citizenContactBaseChance.") diff --git a/src/main/java/me/sshcrack/mc_talking/manager/DefaultCitizenPromptProvider.java b/src/main/java/me/sshcrack/mc_talking/manager/DefaultCitizenPromptProvider.java index 8bcd52ee..a5899fee 100644 --- a/src/main/java/me/sshcrack/mc_talking/manager/DefaultCitizenPromptProvider.java +++ b/src/main/java/me/sshcrack/mc_talking/manager/DefaultCitizenPromptProvider.java @@ -241,7 +241,13 @@ private void addCurrentState(@NotNull CitizenPromptView view, StringBuilder prom } if (view.homeless()) { - prompt.append("- Very concerned about not having a home\n"); + if (McTalkingConfig.INSTANCE.instance().scaleHousingComplaintsByAge && view.colonyAgeDays() < 7) { + prompt.append("- Not having a proper home yet is tough, but the colony is still getting set up\n"); + } else if (McTalkingConfig.INSTANCE.instance().scaleHousingComplaintsByAge && view.colonyAgeDays() < 30) { + prompt.append("- Getting worried about not having a proper home — the colony should be more established by now\n"); + } else { + prompt.append("- Very concerned about not having a home\n"); + } } if (!view.child() && view.jobName() == null) { @@ -470,17 +476,45 @@ private static void appendDetailedHappinessState(CitizenPromptView view, StringB case HOMELESSNESS: if (factor < 0.8 && !view.guard()) { if (factor < 0.3) { - prompt.append("- ").append(MiscUtil.pick( - "Sleeping without a proper roof over your head is wearing on you", - "You desperately need a home — living like this is getting unbearable", - "Not having a decent place to live is one of your biggest worries" - )).append("\n"); + if (McTalkingConfig.INSTANCE.instance().scaleHousingComplaintsByAge && view.colonyAgeDays() < 7) { + prompt.append("- ").append(MiscUtil.pick( + "Not having a proper home yet is tough, but the colony is still getting set up", + "You know the colony just started — you're willing to be patient about housing for now", + "Living without a proper roof is hard, but these things take time in a new colony" + )).append("\n"); + } else if (McTalkingConfig.INSTANCE.instance().scaleHousingComplaintsByAge && view.colonyAgeDays() < 30) { + prompt.append("- ").append(MiscUtil.pick( + "The lack of proper housing is starting to wear on you — the colony should be building homes by now", + "You've been without a real home for a while now and it's getting concerning", + "Not having proper shelter is becoming a real problem as the colony grows" + )).append("\n"); + } else { + prompt.append("- ").append(MiscUtil.pick( + "Sleeping without a proper roof over your head is wearing on you", + "You desperately need a home — living like this is getting unbearable", + "Not having a decent place to live is one of your biggest worries" + )).append("\n"); + } } else { - prompt.append("- ").append(MiscUtil.pick( - "Your current housing is cramped and basic — you wish for something better", - "The shack you're living in barely counts as a proper home", - "Your housing situation could be a lot better than this" - )).append("\n"); + if (McTalkingConfig.INSTANCE.instance().scaleHousingComplaintsByAge && view.colonyAgeDays() < 7) { + prompt.append("- ").append(MiscUtil.pick( + "Your housing is basic, but that's expected for a young colony", + "The cramped shelter is fine for now — the colony has only just started", + "Living in tight quarters is part of colony life in the early days" + )).append("\n"); + } else if (McTalkingConfig.INSTANCE.instance().scaleHousingComplaintsByAge && view.colonyAgeDays() < 30) { + prompt.append("- ").append(MiscUtil.pick( + "Your housing situation could use improvement as the colony matures", + "The basic shelter is getting old — you hope the colony expands housing soon", + "You're ready for better housing as the colony continues to develop" + )).append("\n"); + } else { + prompt.append("- ").append(MiscUtil.pick( + "Your current housing is cramped and basic — you wish for something better", + "The shack you're living in barely counts as a proper home", + "Your housing situation could be a lot better than this" + )).append("\n"); + } } } else if (factor > 1.2) { prompt.append("- ").append(MiscUtil.pick( diff --git a/src/main/java/me/sshcrack/mc_talking/util/CitizenNeedAssessor.java b/src/main/java/me/sshcrack/mc_talking/util/CitizenNeedAssessor.java index 98319cc3..b5a7e9d2 100644 --- a/src/main/java/me/sshcrack/mc_talking/util/CitizenNeedAssessor.java +++ b/src/main/java/me/sshcrack/mc_talking/util/CitizenNeedAssessor.java @@ -45,7 +45,14 @@ public static double calculateUrgencyWeight(AbstractEntityCitizen citizen) { } if (data.getHomeBuilding() == null && !CitizenHelper.isCitizenGuard(citizen)) { - weight += 0.7; + double homelessWeight = 0.7; + if (McTalkingConfig.INSTANCE.instance().scaleHousingComplaintsByAge) { + int colonyDay = data.getColony().getDay(); + if (colonyDay < 7) { + homelessWeight = 0.3; + } + } + weight += homelessWeight; } double saturation = data.getSaturation(); diff --git a/src/main/resources/assets/mc_talking/lang/en_us.json b/src/main/resources/assets/mc_talking/lang/en_us.json index 772ea550..d3109f14 100644 --- a/src/main/resources/assets/mc_talking/lang/en_us.json +++ b/src/main/resources/assets/mc_talking/lang/en_us.json @@ -184,6 +184,9 @@ "yacl3.config.mc_talking:config.blockingTaskUrgencyMultiplier": "Blocking Task Urgency Multiplier", "yacl3.config.mc_talking:config.blockingTaskUrgencyMultiplier.desc": "Extra urgency weight for citizens stuck on a task (missing tools/items). Higher values make them much more likely to call for help.", + "yacl3.config.mc_talking:config.scaleHousingComplaintsByAge": "Scale Housing Complaints by Colony Age", + "yacl3.config.mc_talking:config.scaleHousingComplaintsByAge.desc": "If enabled, housing complaint severity and contact urgency are scaled by colony age. Early colonies get patient/mild text; mature colonies express full concern.", + "yacl3.config.mc_talking:config.playerUrgentContactCooldownSeconds": "Player Urgent Contact Cooldown (seconds)", "yacl3.config.mc_talking:config.playerUrgentContactCooldownSeconds.desc": "Minimum time between urgent citizen contacts for the same player, preventing multiple citizens from calling out at once. Set to 0 to disable.",