Exemple #1
0
    public override void onAtDestination()
    {
        base.onAtDestination();

        if (this.isDeliveringItem)
        {
            // Drop off item at deposit point.
            this.depositPoint.deposit(this.minerData.heldItem);
            this.minerData.heldItem = null;

            this.locateUnloadPoint();
        }
        else
        {
            // Pick up item.
            this.minerData.heldItem = this.unloadPoint.minecart.inventory.pullItem();

            this.isDeliveringItem = true;

            // Head to the deposit point.
            this.depositPoint = this.calculateAndSetPathToClosest <AbstractDepositPoint>(
                true,
                behavior => behavior.isOpen());

            // Manualy set it
            this.agent.setPath(this.navPath);
        }
    }
Exemple #2
0
    public override void onTaskStop()
    {
        base.onTaskStop();

        this.isDeliveringItem = false;

        if (this.unloadPoint != null)
        {
            this.unloadPoint.setOccupant(null);
        }

        this.unloadPoint  = null;
        this.depositPoint = null;
    }
Exemple #3
0
    public override bool shouldExecute()
    {
        if (this.minerData.heldItem != null)
        {
            this.depositPoint = this.calculateAndSetPathToClosest <AbstractDepositPoint>(
                true,
                behavior => behavior.isOpen());

            if (this.navPath != null)
            {
                return(this.navPath != null);
            }
            else
            {
                this.owner.emote.startEmote(new Emote("question", 0.1f).setTooltip("Can't find a deposit point"));
            }
        }

        return(false);
    }
Exemple #4
0
    public override void onTaskStop()
    {
        base.onTaskStop();

        this.depositPoint = null;
    }