mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
made the tasks comprehensible
This commit is contained in:
parent
0d33363eaf
commit
ab9f5432a5
@ -62,6 +62,15 @@ public class EntityGlyphid extends EntityMob {
|
||||
public int blastResToDig = Math.min((int) (50 * (getScale() * 2)), 150);
|
||||
public boolean shouldDig;
|
||||
|
||||
// Tasks
|
||||
|
||||
public static final int none = 0;
|
||||
public static final int comm = 1;
|
||||
public static final int expand = 2;
|
||||
public static final int reinforcements = 3;
|
||||
public static final int follow = 4;
|
||||
public static final int terraform = 5;
|
||||
public static final int dig = 6;
|
||||
EntityWaypoint taskWaypoint = null;
|
||||
public EntityGlyphid(World world) {
|
||||
super(world);
|
||||
@ -115,14 +124,14 @@ public class EntityGlyphid extends EntityMob {
|
||||
onBlinded();
|
||||
}
|
||||
|
||||
if(getCurrentTask() == 4){
|
||||
if(getCurrentTask() == follow){
|
||||
|
||||
//incase the waypoint somehow doesn't exist and it got this task anyway
|
||||
if(isAtDestination() && taskX == 0) {
|
||||
setCurrentTask(0, null);
|
||||
if(isAtDestination() && taskX == none) {
|
||||
setCurrentTask(none, null);
|
||||
}
|
||||
//the task cannot be 6 outside of rampant, so this is a non issue p much
|
||||
} else if (getCurrentTask() == 6 && ticksExisted % 20 == 0 && isAtDestination()) {
|
||||
} else if (getCurrentTask() == dig && ticksExisted % 20 == 0 && isAtDestination()) {
|
||||
swingItem();
|
||||
|
||||
ExplosionVNT vnt = new ExplosionVNT(worldObj, taskX, taskY + 2, taskZ, blastSize, this);
|
||||
@ -161,7 +170,7 @@ public class EntityGlyphid extends EntityMob {
|
||||
|
||||
@Override
|
||||
protected void updateWanderPath() {
|
||||
if(getCurrentTask() == 0) {
|
||||
if(getCurrentTask() == none) {
|
||||
super.updateWanderPath();
|
||||
}
|
||||
}
|
||||
@ -176,7 +185,8 @@ public class EntityGlyphid extends EntityMob {
|
||||
// hell yeah!!
|
||||
if (useExtendedTargeting() && this.entityToAttack != null) {
|
||||
this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, true, true));
|
||||
} else if (getCurrentTask() != 0) {
|
||||
} else if (getCurrentTask() != none) {
|
||||
|
||||
this.worldObj.theProfiler.startSection("stroll");
|
||||
|
||||
if (!isAtDestination()) {
|
||||
@ -193,11 +203,11 @@ public class EntityGlyphid extends EntityMob {
|
||||
|
||||
}
|
||||
|
||||
if (taskX != 0) {
|
||||
if (taskX != none) {
|
||||
if(MobConfig.rampantDig) {
|
||||
|
||||
MovingObjectPosition obstacle = findWaypointObstruction();
|
||||
if (getScale() >= 1 && getCurrentTask() != 6 && obstacle != null) {
|
||||
if (getScale() >= 1 && getCurrentTask() != dig && obstacle != null) {
|
||||
digToWaypoint(obstacle);
|
||||
} else {
|
||||
Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ);
|
||||
@ -260,7 +270,7 @@ public class EntityGlyphid extends EntityMob {
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn() {
|
||||
return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == 0;
|
||||
return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == none;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -444,16 +454,16 @@ public class EntityGlyphid extends EntityMob {
|
||||
switch(task){
|
||||
|
||||
//call for reinforcements
|
||||
case 1: if(taskWaypoint != null){
|
||||
communicate(4, taskWaypoint);
|
||||
setCurrentTask(4, taskWaypoint);
|
||||
case comm: if(taskWaypoint != null){
|
||||
communicate(follow, taskWaypoint);
|
||||
setCurrentTask(follow, taskWaypoint);
|
||||
} break;
|
||||
|
||||
//expand the hive, used by the scout
|
||||
//case 2: expandHive(null);
|
||||
|
||||
//retreat
|
||||
case 3:
|
||||
case reinforcements:
|
||||
|
||||
if (!worldObj.isRemote && taskWaypoint == null) {
|
||||
|
||||
@ -463,15 +473,15 @@ public class EntityGlyphid extends EntityMob {
|
||||
|
||||
//First, go home and get reinforcements
|
||||
EntityWaypoint home = new EntityWaypoint(worldObj);
|
||||
home.setWaypointType(1);
|
||||
home.setWaypointType(comm);
|
||||
home.setAdditionalWaypoint(additional);
|
||||
home.setHighPriority();
|
||||
home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0);
|
||||
worldObj.spawnEntityInWorld(home);
|
||||
|
||||
this.taskWaypoint = home;
|
||||
communicate(4, home);
|
||||
setCurrentTask(4, taskWaypoint);
|
||||
communicate(follow, home);
|
||||
setCurrentTask(follow, taskWaypoint);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -482,7 +492,7 @@ public class EntityGlyphid extends EntityMob {
|
||||
//fifth task is used only in the scout and big man johnson, for terraforming
|
||||
|
||||
//dig
|
||||
case 6:
|
||||
case dig:
|
||||
shouldDig = true;
|
||||
break;
|
||||
|
||||
@ -554,13 +564,13 @@ public class EntityGlyphid extends EntityMob {
|
||||
previousTask = getCurrentTask();
|
||||
previousWaypoint = getWaypoint();
|
||||
|
||||
setCurrentTask(6, target);
|
||||
setCurrentTask(dig, target);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ);
|
||||
int maxDist = (int) (Math.sqrt(vec.squareDistanceTo(taskX, taskY, taskZ)) * 1.2);
|
||||
this.setPathToEntity(PathFinderUtils.getPathEntityToCoordPartial(worldObj, this, taskX, taskY, taskZ, maxDist, true, false, true, true));
|
||||
|
||||
communicate(6, target);
|
||||
communicate(dig, target);
|
||||
|
||||
}
|
||||
///DIGGING END
|
||||
|
||||
@ -51,15 +51,15 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (ticksExisted % 20 == 0) {
|
||||
if (isAtDestination() && getCurrentTask() == 4) {
|
||||
setCurrentTask(0, null);
|
||||
if (isAtDestination() && getCurrentTask() == follow) {
|
||||
setCurrentTask(none, null);
|
||||
}
|
||||
|
||||
if(getCurrentTask() == 2 && getAITarget() == null){
|
||||
if(getCurrentTask() == expand && getAITarget() == null){
|
||||
this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10 * 20, 3));
|
||||
}
|
||||
|
||||
if (getCurrentTask() == 5) {
|
||||
if (getCurrentTask() == terraform) {
|
||||
this.setHealth(0);
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
++this.deathTicks;
|
||||
|
||||
if(!hasWaypoint) {
|
||||
communicate(3, null);
|
||||
communicate(reinforcements, null);
|
||||
hasWaypoint = true;
|
||||
}
|
||||
if(deathTicks == 90){
|
||||
|
||||
@ -69,7 +69,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if((getCurrentTask() != 2 || getCurrentTask() != 5) && taskWaypoint == null) {
|
||||
if((getCurrentTask() != expand || getCurrentTask() != terraform) && taskWaypoint == null) {
|
||||
|
||||
if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){
|
||||
if(!hasTarget) {
|
||||
@ -98,7 +98,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
|
||||
}
|
||||
|
||||
if(getCurrentTask() == 2 || getCurrentTask() == 5) {
|
||||
if(getCurrentTask() == expand || getCurrentTask() == terraform) {
|
||||
|
||||
if(!worldObj.isRemote && !hasTarget) {
|
||||
//Check for whether a big man johnson is nearby, this makes the scout switch into its terraforming task
|
||||
@ -123,8 +123,8 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
}
|
||||
}
|
||||
|
||||
if (getCurrentTask() == 5 && super.isAtDestination() && doubleCheckHive()) {
|
||||
communicate(5, taskWaypoint);
|
||||
if (getCurrentTask() == terraform && super.isAtDestination() && doubleCheckHive()) {
|
||||
communicate(terraform, taskWaypoint);
|
||||
}
|
||||
|
||||
if (ticksExisted % 10 == 0 && isAtDestination()) {
|
||||
@ -135,11 +135,11 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
|
||||
EntityWaypoint additional = new EntityWaypoint(worldObj);
|
||||
additional.setLocationAndAngles(posX, posY, posZ, 0, 0);
|
||||
additional.setWaypointType(0);
|
||||
additional.setWaypointType(none);
|
||||
|
||||
//First, go home and get reinforcements
|
||||
EntityWaypoint home = new EntityWaypoint(worldObj);
|
||||
home.setWaypointType(1);
|
||||
home.setWaypointType(comm);
|
||||
home.setAdditionalWaypoint(additional);
|
||||
home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0);
|
||||
home.maxAge = 1200;
|
||||
@ -149,7 +149,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
|
||||
this.taskWaypoint = home;
|
||||
this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10));
|
||||
communicate(1, taskWaypoint);
|
||||
communicate(comm, taskWaypoint);
|
||||
|
||||
} else if (timer >= 5) {
|
||||
|
||||
@ -161,7 +161,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
this.setDead();
|
||||
|
||||
} else {
|
||||
communicate(4, taskWaypoint);
|
||||
communicate(follow, taskWaypoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
if (block == ModBlocks.glyphid_base) {
|
||||
setCurrentTask(0 ,null);
|
||||
setCurrentTask(none ,null);
|
||||
hasTarget = false;
|
||||
return false;
|
||||
}
|
||||
@ -194,7 +194,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
|
||||
@Override
|
||||
public boolean isAtDestination() {
|
||||
return this.getCurrentTask() == 2 && super.isAtDestination();
|
||||
return this.getCurrentTask() == expand && super.isAtDestination();
|
||||
}
|
||||
|
||||
public boolean findJohnson(){
|
||||
@ -252,7 +252,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
|
||||
//updates the task coordinates
|
||||
setCurrentTask(getCurrentTask(), taskWaypoint);
|
||||
communicate(2, taskWaypoint);
|
||||
communicate(expand, taskWaypoint);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -264,7 +264,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
public void carryOutTask() {
|
||||
if (!worldObj.isRemote && taskWaypoint == null) {
|
||||
switch(getCurrentTask()){
|
||||
case 3:
|
||||
case reinforcements:
|
||||
this.removePotionEffect(Potion.moveSlowdown.id);
|
||||
this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 20, 4));
|
||||
|
||||
@ -286,7 +286,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
break;
|
||||
|
||||
//terraforming task, only used if a big man johnson is near the scout
|
||||
case 5:
|
||||
case terraform:
|
||||
scoutingRange = 60;
|
||||
minDistanceToHive = 20;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user