Deliveryman should deliver food preemptively
cltnschlosser opened this issue · 7 comments
The issue isn't necessarily with the deliveryman himself, but in the way food is requested. Currently he delivers the food a day late, and not enough at a time.
if (buildingToDeliver instanceof BuildingHome)
{
final int extraFood = worker.getCitizenData().getSaturation() < EntityCitizen.HIGH_SATURATION ? 1 : 0;
//Tries to extract a certain amount of the item of the chest.
if (InventoryUtils.transferXOfFirstSlotInProviderWithIntoNextFreeSlotInItemHandler(
tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null),
itemStack -> !InventoryUtils.isItemStackEmpty(itemStack) && itemStack.getItem() instanceof ItemFood,
buildingToDeliver.getBuildingLevel() + extraFood,
new InvWrapper(worker.getInventoryCitizen())))
{
worker.setHeldItem(SLOT_HAND);
setDelay(DUMP_AND_GATHER_DELAY);
return DELIVERY;
}
((BuildingDeliveryman) getOwnBuilding()).setBuildingToDeliver(null);
itemsToDeliver.clear();
return START_WORKING;
}
Really only this line is important:
final int extraFood = worker.getCitizenData().getSaturation() < EntityCitizen.HIGH_SATURATION ? 1 : 0;
We use the deliveryman's saturation to detect if we need extra food, but we should check all the residents of that BuildingHome
Actually, we use the deliveryman saturation to detect if we need extra food.
(Because if the dman is low on saturation he will eat the food he should
deliver)
2017-05-26 13:14 GMT-03:00 xavierh <[email protected]>:
… Wow. Good find
On 26 May 2017 17:10, "Colton Schlosser" ***@***.***> wrote:
> The issue isn't necessarily with the deliveryman himself, but in the way
> food is requested. Currently he delivers the food a day late, and not
> enough at a time.
>
> if (buildingToDeliver instanceof BuildingHome)
> {
> final int extraFood = worker.getCitizenData().getSaturation() <
EntityCitizen.HIGH_SATURATION ? 1 : 0;
>
> //Tries to extract a certain amount of the item of the chest.
> if (InventoryUtils.transferXOfFirstSlotInProvider
WithIntoNextFreeSlotInItemHandler(
> tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,
null),
> itemStack -> !InventoryUtils.isItemStackEmpty(itemStack) &&
itemStack.getItem() instanceof ItemFood,
> buildingToDeliver.getBuildingLevel() + extraFood,
> new InvWrapper(worker.getInventoryCitizen())))
> {
> worker.setHeldItem(SLOT_HAND);
> setDelay(DUMP_AND_GATHER_DELAY);
> return DELIVERY;
> }
>
> ((BuildingDeliveryman) getOwnBuilding()).setBuildingToDeliver(null);
> itemsToDeliver.clear();
> return START_WORKING;
> }
>
> Really only this line is important:
> final int extraFood = worker.getCitizenData().getSaturation() <
> EntityCitizen.HIGH_SATURATION ? 1 : 0;
> We use the deliveryman's saturation to detect if we need extra food, but
> we should check all the residents of that BuildingHome
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#1098>, or mute the
> thread
> <https://github.com/notifications/unsubscribe-auth/
ACplvEzVWGUCHruyprBuFhWRpTkh9iF2ks5r9vl4gaJpZM4NnyTl>
> .
>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1098 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGI9yzvaGqsB_f0J8Te7U15E4RAhgFK9ks5r9vpogaJpZM4NnyTl>
.
Make sense now
…On 26 May 2017 18:25, "Raycoms" ***@***.***> wrote:
Actually, we use the deliveryman saturation to detect if we need extra
food.
(Because if the dman is low on saturation he will eat the food he should
deliver)
2017-05-26 13:14 GMT-03:00 xavierh ***@***.***>:
> Wow. Good find
>
>
> On 26 May 2017 17:10, "Colton Schlosser" ***@***.***>
wrote:
>
> > The issue isn't necessarily with the deliveryman himself, but in the
way
> > food is requested. Currently he delivers the food a day late, and not
> > enough at a time.
> >
> > if (buildingToDeliver instanceof BuildingHome)
> > {
> > final int extraFood = worker.getCitizenData().getSaturation() <
> EntityCitizen.HIGH_SATURATION ? 1 : 0;
> >
> > //Tries to extract a certain amount of the item of the chest.
> > if (InventoryUtils.transferXOfFirstSlotInProvider
> WithIntoNextFreeSlotInItemHandler(
> > tileEntity.getCapability(CapabilityItemHandler.ITEM_
HANDLER_CAPABILITY,
> null),
> > itemStack -> !InventoryUtils.isItemStackEmpty(itemStack) &&
> itemStack.getItem() instanceof ItemFood,
> > buildingToDeliver.getBuildingLevel() + extraFood,
> > new InvWrapper(worker.getInventoryCitizen())))
> > {
> > worker.setHeldItem(SLOT_HAND);
> > setDelay(DUMP_AND_GATHER_DELAY);
> > return DELIVERY;
> > }
> >
> > ((BuildingDeliveryman) getOwnBuilding()).setBuildingToDeliver(null);
> > itemsToDeliver.clear();
> > return START_WORKING;
> > }
> >
> > Really only this line is important:
> > final int extraFood = worker.getCitizenData().getSaturation() <
> > EntityCitizen.HIGH_SATURATION ? 1 : 0;
> > We use the deliveryman's saturation to detect if we need extra food,
but
> > we should check all the residents of that BuildingHome
> >
> > —
> > You are receiving this because you are subscribed to this thread.
> > Reply to this email directly, view it on GitHub
> > <#1098>, or mute
the
> > thread
> > <https://github.com/notifications/unsubscribe-auth/
> ACplvEzVWGUCHruyprBuFhWRpTkh9iF2ks5r9vl4gaJpZM4NnyTl>
> > .
>
> >
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#1098 (comment)
304324134>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AGI9yzvaGqsB_
f0J8Te7U15E4RAhgFK9ks5r9vpogaJpZM4NnyTl>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1098 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACplvMAxkOTShijTZUqT0RmNGrCrGG-3ks5r9wsdgaJpZM4NnyTl>
.
Actually, we use the deliveryman saturation to detect if we need extra food.
(Because if the dman is low on saturation he will eat the food he should
deliver)
Lol
Wow. Good find
…On 26 May 2017 17:10, "Colton Schlosser" ***@***.***> wrote:
The issue isn't necessarily with the deliveryman himself, but in the way
food is requested. Currently he delivers the food a day late, and not
enough at a time.
if (buildingToDeliver instanceof BuildingHome)
{
final int extraFood = worker.getCitizenData().getSaturation() < EntityCitizen.HIGH_SATURATION ? 1 : 0;
//Tries to extract a certain amount of the item of the chest.
if (InventoryUtils.transferXOfFirstSlotInProviderWithIntoNextFreeSlotInItemHandler(
tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null),
itemStack -> !InventoryUtils.isItemStackEmpty(itemStack) && itemStack.getItem() instanceof ItemFood,
buildingToDeliver.getBuildingLevel() + extraFood,
new InvWrapper(worker.getInventoryCitizen())))
{
worker.setHeldItem(SLOT_HAND);
setDelay(DUMP_AND_GATHER_DELAY);
return DELIVERY;
}
((BuildingDeliveryman) getOwnBuilding()).setBuildingToDeliver(null);
itemsToDeliver.clear();
return START_WORKING;
}
Really only this line is important:
final int extraFood = worker.getCitizenData().getSaturation() <
EntityCitizen.HIGH_SATURATION ? 1 : 0;
We use the deliveryman's saturation to detect if we need extra food, but
we should check all the residents of that BuildingHome
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1098>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ACplvEzVWGUCHruyprBuFhWRpTkh9iF2ks5r9vl4gaJpZM4NnyTl>
.