Merge
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package mindustry.entities;
|
||||
|
||||
/** A higher ordinal means a higher priority. Higher priority blocks will always get targeted over those of lower priority, regardless of distance. */
|
||||
public enum TargetPriority{
|
||||
base,
|
||||
turret
|
||||
|
||||
@@ -39,6 +39,8 @@ public abstract class BulletType extends Content{
|
||||
public float reloadMultiplier = 1f;
|
||||
/** Recoil from shooter entities. */
|
||||
public float recoil;
|
||||
/** Whether to kill the shooter when this is shot. For suicide bombers. */
|
||||
public boolean killShooter;
|
||||
|
||||
public float splashDamage = 0f;
|
||||
/** Knockback in velocity. */
|
||||
@@ -146,6 +148,9 @@ public abstract class BulletType extends Content{
|
||||
}
|
||||
|
||||
public void init(Bullet b){
|
||||
if(killShooter && b.getOwner() instanceof HealthTrait){
|
||||
((HealthTrait)b.getOwner()).kill();
|
||||
}
|
||||
}
|
||||
|
||||
public void update(Bullet b){
|
||||
|
||||
@@ -27,7 +27,7 @@ import static mindustry.Vars.*;
|
||||
public class Lightning extends TimedEntity implements DrawTrait, TimeTrait{
|
||||
public static final float lifetime = 10f;
|
||||
|
||||
private static final RandomXS128 random = new RandomXS128();
|
||||
private static final Rand random = new Rand();
|
||||
private static final Rect rect = new Rect();
|
||||
private static final Array<Unit> entities = new Array<>();
|
||||
private static final IntSet hit = new IntSet();
|
||||
|
||||
@@ -67,9 +67,9 @@ public interface BuilderTrait extends Entity, TeamTrait{
|
||||
|
||||
if(!(tile.block() instanceof BuildBlock)){
|
||||
if(!current.initialized && canCreateBlocks() && !current.breaking && Build.validPlace(getTeam(), current.x, current.y, current.block, current.rotation)){
|
||||
Call.beginPlace(getTeam(), current.x, current.y, current.block, current.rotation);
|
||||
Build.beginPlace(getTeam(), current.x, current.y, current.block, current.rotation);
|
||||
}else if(!current.initialized && canCreateBlocks() && current.breaking && Build.validBreak(getTeam(), current.x, current.y)){
|
||||
Call.beginBreak(getTeam(), current.x, current.y);
|
||||
Build.beginBreak(getTeam(), current.x, current.y);
|
||||
}else{
|
||||
buildQueue().removeFirst();
|
||||
return;
|
||||
@@ -118,6 +118,14 @@ public interface BuilderTrait extends Entity, TeamTrait{
|
||||
return request.stuck && !core.items.has(request.block.requirements);
|
||||
}
|
||||
|
||||
default void removeRequest(int x, int y, boolean breaking){
|
||||
//remove matching request
|
||||
int idx = player.buildQueue().indexOf(req -> req.breaking == breaking && req.x == x && req.y == y);
|
||||
if(idx != -1){
|
||||
player.buildQueue().removeIndex(idx);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the queue for storing build requests. */
|
||||
Queue<BuildRequest> buildQueue();
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ public interface HealthTrait{
|
||||
|
||||
void setDead(boolean dead);
|
||||
|
||||
default void kill(){
|
||||
health(-1);
|
||||
damage(1);
|
||||
}
|
||||
|
||||
default void onHit(SolidTrait entity){
|
||||
}
|
||||
|
||||
|
||||
@@ -719,7 +719,6 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
public void sendMessage(String text){
|
||||
if(isLocal){
|
||||
if(Vars.ui != null){
|
||||
Log.info("add " + text);
|
||||
Vars.ui.chatfrag.addMessage(text, null);
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -224,11 +224,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
y = Mathf.clamp(y, 0, world.height() * tilesize - tilesize);
|
||||
}
|
||||
|
||||
public void kill(){
|
||||
health = -1;
|
||||
damage(1);
|
||||
}
|
||||
|
||||
public boolean isImmune(StatusEffect effect){
|
||||
return type.immunities.contains(effect);
|
||||
}
|
||||
@@ -281,6 +276,10 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
return tile == null ? (Floor)Blocks.air : tile.floor();
|
||||
}
|
||||
|
||||
public @Nullable Tile tileOn(){
|
||||
return world.tileWorld(x, y);
|
||||
}
|
||||
|
||||
public void onRespawn(Tile tile){
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user