Skip to content

Commit

Permalink
move soundsource, prob fixes 10644 (#10645)
Browse files Browse the repository at this point in the history
Move soundsource of raid source to hostile
Fix concrete mixer issue
Remove extra food handout
Fix standup/sitdown loop at restaurant
  • Loading branch information
Raycoms committed Feb 9, 2025
1 parent 36d5573 commit d5d1aa8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public void onStart()
.forManagers();
Log.getLogger().debug("Raiders coming from: " + spawnPoint.toShortString() + " towards colony: " + colony.getName());

PlayAudioMessage audio = new PlayAudioMessage(horde.initialSize <= SMALL_HORDE_SIZE ? RaidSounds.WARNING_EARLY : RaidSounds.WARNING, SoundSource.RECORDS);
PlayAudioMessage audio = new PlayAudioMessage(horde.initialSize <= SMALL_HORDE_SIZE ? RaidSounds.WARNING_EARLY : RaidSounds.WARNING, SoundSource.HOSTILE);
PlayAudioMessage.sendToAll(getColony(), false, false, audio);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ public void onRaidEventFinished(final IColonyRaidEvent finishedRaid)
MessageUtils.format(msgID, colony.getName()).sendTo(colony).forManagers();
}

PlayAudioMessage audio = new PlayAudioMessage(raidHistories.get(0).raiderAmount <= SMALL_HORDE_SIZE ? RaidSounds.VICTORY_EARLY : RaidSounds.VICTORY, SoundSource.RECORDS);
PlayAudioMessage audio = new PlayAudioMessage(raidHistories.get(0).raiderAmount <= SMALL_HORDE_SIZE ? RaidSounds.VICTORY_EARLY : RaidSounds.VICTORY, SoundSource.HOSTILE);
PlayAudioMessage.sendToAll(colony, false, true, audio);

if (colony.getRaiderManager().getLostCitizen() == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,8 @@ private EatingState getFoodYourself()
final ItemStorage storageToGet = FoodUtils.checkForFoodInBuilding(citizen.getCitizenData(), cookBuilding.getModule(RESTAURANT_MENU).getMenu(), cookBuilding);
if (storageToGet != null)
{
int homeBuildingLevel = citizen.getCitizenData().getHomeBuilding() == null ? 1 : citizen.getCitizenData().getHomeBuilding().getBuildingLevel();
int qty = (int) (Math.max(1.0,
(FULL_SATURATION - citizen.getCitizenData().getSaturation()) / FoodUtils.getFoodValue(storageToGet.getItemStack(), citizen) * homeBuildingLevel / 2.0));
(FULL_SATURATION - citizen.getCitizenData().getSaturation()) / FoodUtils.getFoodValue(storageToGet.getItemStack(), citizen)));
InventoryUtils.transferItemStackIntoNextBestSlotInItemHandler(cookBuilding, storageToGet, qty, citizen.getInventoryCitizen());
return EAT;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ private IAIState harvestConcrete()
job.setCraftCounter(job.getCraftCounter() + 1);
if (job.getCraftCounter() >= job.getMaxCraftingCount())
{
incrementActionsDone(getActionRewardForCraftingSuccess());
worker.decreaseSaturationForAction();
job.finishRequest(true);
worker.getCitizenExperienceHandler().addExperience(currentRequest.getRequest().getCount() / 2.0);
currentRequest = null;
currentRecipeStorage = null;
resetValues();

Expand Down Expand Up @@ -165,12 +170,7 @@ private int getSlotWithPowder()
@Override
protected IAIState decide()
{
if (job.getCurrentTask() == null)
{
return performMixingWork();
}

if (walkTo == null && !walkToBuilding())
if ((walkTo == null && !walkToBuilding()) || job.getCurrentTask() == null)
{
return START_WORKING;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ protected int getExtendedCount(final ItemStack primaryOutput)
@Override
protected IAIState craft()
{
if (currentRecipeStorage == null)
if (currentRecipeStorage == null || job.getCurrentTask() == null)
{
return START_WORKING;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ else if (InventoryUtils.hasItemInItemHandler(handler, canEatPredicate))
}

final int countInSlot = worker.getInventoryCitizen().getStackInSlot(foodSlot).getCount();
int homeBuildingLevel = citizen.getCitizenData().getHomeBuilding() == null ? 1 : citizen.getCitizenData().getHomeBuilding().getBuildingLevel();
int qty = (int) (Math.max(1.0, (FULL_SATURATION - citizen.getCitizenData().getSaturation()) / FoodUtils.getFoodValue(worker.getInventoryCitizen().getStackInSlot(foodSlot), citizen)) * homeBuildingLevel/2.0);
int qty = (int) (Math.max(1.0, (FULL_SATURATION - citizen.getCitizenData().getSaturation()) / FoodUtils.getFoodValue(worker.getInventoryCitizen().getStackInSlot(foodSlot), citizen)));

final int transferCount = Math.min(countInSlot, building.getBuildingLevel());
if (InventoryUtils.transferXOfItemStackIntoNextFreeSlotInItemHandler(worker.getInventoryCitizen(), foodSlot, qty, citizenData.getInventory()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1057,18 +1057,17 @@ public void stop()
pathResult.cancel();
pathResult.setStatus(PathFindingStatus.CANCELLED);
pathResult = null;
if (ourEntity.getVehicle() != null)
{
final Entity entity = ourEntity.getVehicle();
ourEntity.stopRiding();
entity.remove(Entity.RemovalReason.DISCARDED);
}
}

safeDestinationPos = BlockPos.ZERO;
stuckHandler.resetGlobalStuckTimers();

if (ourEntity.vehicle != null)
{
final Entity entity = ourEntity.vehicle;
ourEntity.stopRiding();
entity.remove(Entity.RemovalReason.DISCARDED);
}

super.stop();
}

Expand Down

0 comments on commit d5d1aa8

Please sign in to comment.