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