Added explicit message when ship dimensions aren't set yet

This commit is contained in:
Unknown 2019-05-09 15:57:01 +02:00 committed by unknown
parent 4b5327c277
commit b0ddb61e1f
8 changed files with 27 additions and 12 deletions

View file

@ -229,6 +229,24 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
// scan ship content progressively
if (timeLastShipScanDone <= 0L) {
timeLastShipScanDone = world.getTotalWorldTime();
// validate ship side constrains before scanning
if ( getBack() == 0 && getFront() == 0
&& getLeft() == 0 && getRight() == 0
&& getDown() == 0 && getUp() == 0 ) {
reasonInvalid = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.no_dimension_set");
isValid = false;
return;
}
if ( (getBack() + getFront()) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]
|| (getLeft() + getRight()) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]
|| (getDown() + getUp() ) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()] ) {
reasonInvalid = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.too_large_side_for_tier",
WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]);
isValid = false;
return;
}
shipScanner = new ShipScanner(world, minX, minY, minZ, maxX, maxY, maxZ);
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
WarpDrive.logger.info(String.format("%s scanning started",
@ -304,6 +322,8 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
return;
}
}
reasonInvalid = new WarpDriveText();
isValid = true;
}
// skip state handling while cooling down
@ -762,20 +782,8 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
// update dimensions to client
markDirty();
// validate ship side constrains
if ( (getBack() + getFront()) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]
|| (getLeft() + getRight()) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]
|| (getDown() + getUp() ) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()] ) {
reasonInvalid = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.too_large_side_for_tier",
WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]);
isValid = false;
return;
}
// request new ship scan
timeLastShipScanDone = -1;
isValid = true;
}
private boolean validateShipMovementParameters(final WarpDriveText reason) {

View file

@ -848,6 +848,7 @@ warpdrive.ship.guide.insufficient_energy=Insufficient energy in core.
warpdrive.ship.guide.warp_field_overlapping=Own warp field contains another ship.\nDisable ship core %1$s to continue.
warpdrive.ship.guide.cloaking_field_overlapping=Core is cloaked.\nDisable cloak to continue.
warpdrive.ship.guide.pre_jump_success=Ok
warpdrive.ship.guide.no_dimension_set=Ship has no dimension set yet.
warpdrive.ship.guide.too_large_side_for_tier=Ship is too large, max is %1$d per side.\nUpgrade ship core or reduce span.
warpdrive.ship.guide.too_much_mass_for_planet=Ship is too big for a planet.\nReduce your mass below %1$d blocks.
warpdrive.ship.guide.insufficient_mass_for_tier=Ship is too small, min is %1$d block.\nDowngrade ship core or increase mass.

View file

@ -848,6 +848,7 @@ warpdrive.ship.guide.insufficient_energy=Insufficient energy in core.
warpdrive.ship.guide.warp_field_overlapping=Own warp field contains another ship.\nDisable ship core %1$s to continue.
warpdrive.ship.guide.cloaking_field_overlapping=Core is cloaked.\nDisable cloak to continue.
warpdrive.ship.guide.pre_jump_success=Ok
warpdrive.ship.guide.no_dimension_set=Ship has no dimension set yet.
warpdrive.ship.guide.too_large_side_for_tier=Ship is too large, max is %1$d per side.\nUpgrade ship core or reduce span.
warpdrive.ship.guide.too_much_mass_for_planet=Ship is too big for a planet.\nReduce your mass below %1$d blocks.
warpdrive.ship.guide.insufficient_mass_for_tier=Ship is too small, min is %1$d block.\nDowngrade ship core or increase mass.

View file

@ -849,6 +849,7 @@ warpdrive.ship.guide.insufficient_energy=Energie insuffisante dans le cœur.
warpdrive.ship.guide.warp_field_overlapping=Notre champ de warp contient un autre vaisseau.\nDésactive le cœur de vaisseau %1$s pour continuer.
warpdrive.ship.guide.cloaking_field_overlapping=Le cœur est dans un champ d'invisiblité.\nDésactive l'invisibilité pour continuer.
warpdrive.ship.guide.pre_jump_success=Ok
warpdrive.ship.guide.no_dimension_set=Le vaisseau n'a pas encore de dimensions.
warpdrive.ship.guide.too_large_side_for_tier=Vaisseau trop grand, le max est %1$d par côté.\nAméliorer le cœur de vaisseau ou réduit la masse.
warpdrive.ship.guide.too_much_mass_for_planet=Vaisseau trop lourd pour une planète.\nRéduit la masse en-dessous de %1$d blocks.
warpdrive.ship.guide.insufficient_mass_for_tier=Vaisseau trop léger, le min est %1$d blocks.\nDéclasse le cœur de vaisseau ou augmente la masse.

View file

@ -847,6 +847,7 @@ warpdrive.ship.guide.insufficient_energy=Insufficient energy in core.
warpdrive.ship.guide.warp_field_overlapping=Own warp field contains another ship.\nDisable ship core %1$s to continue.
warpdrive.ship.guide.cloaking_field_overlapping=Core is cloaked.\nDisable cloak to continue.
warpdrive.ship.guide.pre_jump_success=Ok
warpdrive.ship.guide.no_dimension_set=Ship has no dimension set yet.
warpdrive.ship.guide.too_large_side_for_tier=Ship is too large, max is %1$d per side.\nUpgrade ship core or reduce span.
warpdrive.ship.guide.too_much_mass_for_planet=Ship is too big for a planet.\nReduce your mass below %1$d blocks.
warpdrive.ship.guide.insufficient_mass_for_tier=Ship is too small, min is %1$d block.\nDowngrade ship core or increase mass.

View file

@ -848,6 +848,7 @@ warpdrive.ship.guide.insufficient_energy=Insufficient energy in core.
warpdrive.ship.guide.warp_field_overlapping=Own warp field contains another ship.\nDisable ship core %1$s to continue.
warpdrive.ship.guide.cloaking_field_overlapping=Core is cloaked.\nDisable cloak to continue.
warpdrive.ship.guide.pre_jump_success=Ok
warpdrive.ship.guide.no_dimension_set=Ship has no dimension set yet.
warpdrive.ship.guide.too_large_side_for_tier=Ship is too large, max is %1$d per side.\nUpgrade ship core or reduce span.
warpdrive.ship.guide.too_much_mass_for_planet=Ship is too big for a planet.\nReduce your mass below %1$d blocks.
warpdrive.ship.guide.insufficient_mass_for_tier=Ship is too small, min is %1$d block.\nDowngrade ship core or increase mass.

View file

@ -849,6 +849,7 @@ warpdrive.ship.guide.insufficient_energy=Insufficient energy in core.
warpdrive.ship.guide.warp_field_overlapping=Own warp field contains another ship.\nDisable ship core %1$s to continue.
warpdrive.ship.guide.cloaking_field_overlapping=Core is cloaked.\nDisable cloak to continue.
warpdrive.ship.guide.pre_jump_success=Ok
warpdrive.ship.guide.no_dimension_set=Ship has no dimension set yet.
warpdrive.ship.guide.too_large_side_for_tier=Ship is too large, max is %1$d per side.\nUpgrade ship core or reduce span.
warpdrive.ship.guide.too_much_mass_for_planet=Ship is too big for a planet.\nReduce your mass below %1$d blocks.
warpdrive.ship.guide.insufficient_mass_for_tier=Ship is too small, min is %1$d block.\nDowngrade ship core or increase mass.

View file

@ -848,6 +848,7 @@ warpdrive.ship.guide.insufficient_energy=Insufficient energy in core.
warpdrive.ship.guide.warp_field_overlapping=Own warp field contains another ship.\nDisable ship core %1$s to continue.
warpdrive.ship.guide.cloaking_field_overlapping=Core is cloaked.\nDisable cloak to continue.
warpdrive.ship.guide.pre_jump_success=Ok
warpdrive.ship.guide.no_dimension_set=Ship has no dimension set yet.
warpdrive.ship.guide.too_large_side_for_tier=Ship is too large, max is %1$d per side.\nUpgrade ship core or reduce span.
warpdrive.ship.guide.too_much_mass_for_planet=Ship is too big for a planet.\nReduce your mass below %1$d blocks.
warpdrive.ship.guide.insufficient_mass_for_tier=Ship is too small, min is %1$d block.\nDowngrade ship core or increase mass.