Guard Illness#11637
Conversation
In order for this pull request to be merged, make sure you test whether your changes work.If the changes are working as intended, remove the https://github.com/ldtteam/minecolonies/labels/undefined label from the pull request. Contributors, please review this pull request! |
|
Please remove the "Untested" label. Tested as described above. |
| { | ||
| if (citizen.getCitizenJobHandler().getColonyJob() instanceof AbstractJobGuard guardJob) | ||
| { | ||
| if (shouldEat()) |
There was a problem hiding this comment.
I'm not 100% sure if sick should be > food
There was a problem hiding this comment.
Restored eating > sick.
|
Please remove the "Untested" label. Tested by poisoning my barracks and observing that they headed off to the hospital. |
| return SEARCH_HOSPITAL; | ||
| } | ||
|
|
||
| citizen.getCitizenSleepHandler().onWakeUp(); |
There was a problem hiding this comment.
Won 't this make them get up from the hospital bed if they're inside?
There was a problem hiding this comment.
The intention is actually if they are asleep somewhere NOT a hospital bed, that it wakes them up and restarts their search. (Full snippet in this area is
if (citizen.getCitizenSleepHandler().isAsleep())
{
if (isSleepingInHospitalBed())
{
return SEARCH_HOSPITAL;
}
citizen.getCitizenSleepHandler().onWakeUp();
return GO_TO_HUT;
}
However, per your comment from three weeks ago we can make this smarter - no need to go to the hut in this situation. This could be
if (citizen.getCitizenSleepHandler().isAsleep())
{
if (isSleepingInHospitalBed())
{
return WAIT_FOR_CURE;
}
citizen.getCitizenSleepHandler().onWakeUp();
return SEARCH_HOSPITAL;
}
There was a problem hiding this comment.
Yes, this could be triggered at night... I will give some thought as to what to do with "asleep not in a hospital bed at night, and sick".
| if (citizen.getCitizenData().getCitizenDiseaseHandler().isSick()) | ||
| { | ||
| return GO_TO_HUT; | ||
| return SEARCH_HOSPITAL; |
There was a problem hiding this comment.
In search hospital we should add a "if closer to building than closest hospital go to building first"
There was a problem hiding this comment.
Currently the main path to SEARCH_HOSPITAL is from GO_TO_HUT (so effectively they go to their work location first, not the hospital). I think if we want to add the "if closer to building than closest hospital, go to building first" (which suggests "if closer to hospital than work building, go to hospital first") logic we would actually want to do that from goToHut(). Unless you object, I will add it there.
|
Might they accidentally trigger that at night? https://proton.me/mail/home
…-------- Original Message --------
On Sunday, 05/24/26 at 20:03 Al Mele ***@***.***> wrote:
@armele commented on this pull request.
---------------------------------------------------------------
In [src/main/java/com/minecolonies/core/entity/ai/minimal/EntityAISickTask.java](#11637 (comment)):
> @@ -378,7 +378,18 @@ private IState goToHut()
return SEARCH_HOSPITAL;
}
- if (citizen.getCitizenSleepHandler().isAsleep() || EntityNavigationUtils.walkToBuilding(citizen, buildingWorker))
+ if (citizen.getCitizenSleepHandler().isAsleep())
+ {
+ if (isSleepingInHospitalBed())
+ {
+ return SEARCH_HOSPITAL;
+ }
+
+ citizen.getCitizenSleepHandler().onWakeUp();
The intention is actually if they are asleep somewhere NOT a hospital bed, that it wakes them up and restarts their search. (Full snippet in this area is ``` if (citizen.getCitizenSleepHandler().isAsleep())
{
if (isSleepingInHospitalBed())
{
return SEARCH_HOSPITAL;
}
citizen.getCitizenSleepHandler().onWakeUp();
return GO_TO_HUT;
}``` However, per your comment from three weeks ago we can make this smarter - no need to go to the hut in this situation. This could be``` if (citizen.getCitizenSleepHandler().isAsleep())
{
if (isSleepingInHospitalBed())
{
return WAIT_FOR_CURE;
}
citizen.getCitizenSleepHandler().onWakeUp();
return SEARCH_HOSPITAL;
}```
—
Reply to this email directly, [view it on GitHub](#11637 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABRD3S3SHY4772RAPE5N2UT44LQJNAVCNFSM6AAAAACYISQTISVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHM2DGNJSGQZTKNJRG4).
Triage notifications on the go with GitHub Mobile for [iOS](https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or [Android](https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub).
You are receiving this because you commented.Message ID: ***@***.***>
|
|
Addressed code review feedback and re-tested with adjusted logic. I also exposed the immunity ticks on the API for future potential use in add-on mods. |
Closes #11597
I could not reliably reproduce the symptom (guards not going to the hospital when sick) in a consistent, repeatable pattern, so I am not 100% sure that these fixes completely resolve it - but they address the theories I have as to the root cause.
Changes proposed in this pull request
Testing
I poisoned my entire barracks full of guards with rotten flesh and noted that they went to the hospital if closer to the hospital, and the hut block if closer to work. Once at the hospital, they found a bed until cured, then left and resumed their guard duties.
Poisoned guards and citizens without a hospital to ensure no exceptions or adverse behavior.
Review please