Skip to content

Unlimited Fuel with caravans #17

@codexhound

Description

@codexhound

Found an issue with vehicles. They have unlimited fuel when in a caravan (world view). The code to look at is here in CompVehicle.cs

 //If it isn't moving than it shouldn't use fuel
                if ((this.Pawn.pather != null && !this.Pawn.pather.Moving) || (this.Pawn.GetCaravan() != null && (this.Pawn.GetCaravan().CantMove)))
                    compRefuelable.Props.fuelConsumptionRate = 0f;
                else
                    //If it's moving than it should use fuel
                    compRefuelable.Props.fuelConsumptionRate = this.fuelConsumptionRate;

Change to something like this to fix:

if ((this.Pawn.pather != null && this.Pawn.pather.Moving))
                    compRefuelable.Props.fuelConsumptionRate = this.fuelConsumptionRate;
                else if((this.Pawn.GetCaravan() != null && !this.Pawn.GetCaravan().Resting) && (this.Pawn.GetCaravan() != null && !this.Pawn.GetCaravan().CantMove))
                    compRefuelable.Props.fuelConsumptionRate = this.fuelConsumptionRate;
                else  //If it isn't moving than it shouldn't use fuel
                    compRefuelable.Props.fuelConsumptionRate = 0f;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions