Skip to content

Commit

Permalink
Exposing more functions (#183)
Browse files Browse the repository at this point in the history
(cherry picked from commit fcadb08)
  • Loading branch information
leafreynolds authored and 50ap5ud5 committed Dec 18, 2023
1 parent 7c4e277 commit e465199
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ public boolean areDangerZoneEventsComplete() {
/*
* Is a prompt still within the combo time.
* */
private boolean isEventInComboTime() {
public boolean isEventInComboTime() {
return (this.ticksSincePrompted < 3 * 20);
}

/*
* Get the current remaining ticks of cooldown between two controls.
* */
private int getControlRequestCooldown() {
public int getControlRequestCooldown() {
return (isEventInComboTime() ? 20 : 60); // This will be expanded on when Stats are added.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ public boolean isOnCooldown() {
return (ticksSinceCrash > 0);
}

/**
* Accessor for the number of ticks since the Tardis crashed.
* @return private field ticksSinceCrash
*/
public int getCooldownTicks() {
return ticksSinceCrash;
}


/**
* A progress value after crashing that determines how long until cooldown has finished.
* Zero means it has only started, 1 means that cooldown has finished.
* @return a percentage value between 0 - 1.
*/
public int getCooldownDuration() {
return ticksSinceCrash / TICKS_COOLDOWN_MAX;
}

public void endCoolDown() {
this.ticksSinceCrash = TICKS_COOLDOWN_MAX;
}
Expand Down Expand Up @@ -262,7 +280,11 @@ private BlockPos getLegalPosition(Level level, BlockPos pos, int originalY) {
return new BlockPos(pos.getX(), originalY, pos.getZ());
}

private boolean isSafeToLand(TardisNavLocation location)
/** Checks the tardis nav location for a variety of reasons that a given position would be unsafe to land at.
* @param location the coordinates to check against
* @return true if safe to land, otherwise false
*/
public boolean isSafeToLand(TardisNavLocation location)
{
if (!isSolidBlock(location.getLevel(), location.getPosition()) && isSolidBlock(location.getLevel(), location.getPosition().below()) && !isSolidBlock(location.getLevel(), location.getPosition().above())) {
return !location.getLevel().getBlockState(location.getPosition().below()).getFluidState().is(FluidTags.LAVA) && !location.getLevel().getBlockState(location.getPosition().below()).getFluidState().is(FluidTags.WATER);
Expand Down Expand Up @@ -467,6 +489,13 @@ public TardisNavLocation getTargetLocation() {
return this.targetLocation;
}

/**
* @return the current fast return location
*/
public TardisNavLocation getFastReturnLocation() {
return this.fastReturnLocation;
}

public void setTargetLocation(TardisNavLocation targetLocation) {
this.targetLocation = targetLocation;
}
Expand Down

0 comments on commit e465199

Please sign in to comment.