Skip to content

Commit

Permalink
several small fixes (#10558)
Browse files Browse the repository at this point in the history
Fix exception with concrete mixer
Fix exception with colonist removal event
Fix issue with citizens not going to bed
Fix citizens constantly pathing to bed if there is none
  • Loading branch information
Raycoms committed Dec 30, 2024
1 parent 57d7965 commit a765f79
Show file tree
Hide file tree
Showing 23 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ else if (homeBuilding.isInBuilding(citizen.blockPosition()))
*/
private boolean findBed()
{
if (!citizen.getCitizenSleepHandler().isAsleep() || bedTicks < MAX_BED_TICKS)
if (!citizen.getCitizenSleepHandler().isAsleep() && bedTicks < MAX_BED_TICKS)
{
findBedAndTryToSleep();
return false;
Expand Down Expand Up @@ -210,6 +210,10 @@ private void findBedAndTryToSleep()
}
citizen.getCitizenData().getCitizenHappinessHandler().resetModifier(SLEPTTONIGHT);
}
else
{
bedTicks = 0;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private IAIState placePowder()
final int slot = getSlotWithPowder();
if (slot == -1)
{
if (InventoryUtils.hasItemInItemHandler(building.getItemHandlerCap(), CONCRETE))
if (InventoryUtils.getCountFromBuilding(building, CONCRETE) > 0)
{
needsCurrently = new Tuple<>(CONCRETE, STACKSIZE);
return GATHERING_REQUIRED_MATERIALS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public static boolean walkCloseToXNearY(
// 1. Navigation Finished
// 2. Navigation is progressing towards a previous task
// 3. Navigation did not try once
boolean isOnRightTask = (nav.getPathResult() != null
&& PathJobMoveCloseToXNearY.isJobFor(nav.getPathResult().getJob(), desiredPosition, nearbyPosition, distToDesired));
boolean isOnRightTask = nav.getPathResult() != null && PathJobMoveCloseToXNearY.isJobFor(nav.getPathResult().getJob(), desiredPosition, nearbyPosition, 1);

if (nav.isDone() || !isOnRightTask)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static boolean isJobFor(final AbstractPathJob job, final BlockPos desired
{
if (job instanceof PathJobMoveCloseToXNearY pathJob)
{
return pathJob.nearbyPosition.equals(desiredPosition) && pathJob.nearbyPosition.equals(nearbyPosition) && pathJob.distToDesired == distance;
return pathJob.desiredPosition.equals(desiredPosition) && pathJob.nearbyPosition.equals(nearbyPosition) && pathJob.distToDesired == distance;
}

return false;
Expand Down

0 comments on commit a765f79

Please sign in to comment.