1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-21 21:38:29 +03:00

Basic kill tracking

This commit is contained in:
Anuken 2019-09-27 16:04:34 -04:00
parent 53d4f44178
commit f925ec8cbe
6 changed files with 25 additions and 2 deletions

View File

@ -1194,7 +1194,7 @@ public class Blocks implements ContentList{
rotateSpeed = 1.4f;
attribute = Attribute.water;
consumes.power(0.90f);
consumes.power(1f);
}};
cultivator = new Cultivator("cultivator"){{

View File

@ -1,5 +1,11 @@
package io.anuke.mindustry.entities.traits;
import io.anuke.mindustry.entities.type.*;
public interface DamageTrait{
float damage();
default void killed(Entity other){
}
}

View File

@ -0,0 +1,5 @@
package io.anuke.mindustry.entities.traits;
public interface KillerTrait{
void killed(Entity other);
}

View File

@ -134,6 +134,13 @@ public class Bullet extends SolidEntity implements DamageTrait, ScaleTrait, Pool
return 1f;
}
@Override
public void killed(Entity other){
if(owner instanceof KillerTrait){
((KillerTrait)owner).killed(other);
}
}
@Override
public void absorb(){
supressCollision = true;

View File

@ -15,8 +15,12 @@ public abstract class DestructibleEntity extends SolidEntity implements HealthTr
@Override
public void collision(SolidTrait other, float x, float y){
if(other instanceof DamageTrait){
boolean wasDead = isDead();
onHit(other);
damage(((DamageTrait)other).damage());
if(!wasDead && isDead()){
((DamageTrait)other).killed(this);
}
}
}

View File

@ -35,7 +35,7 @@ import static io.anuke.mindustry.Vars.*;
public class DesktopLauncher extends ClientLauncher{
public final static String discordID = "610508934456934412";
boolean useDiscord = OS.is64Bit, showConsole = true;
boolean useDiscord = OS.is64Bit, showConsole = false;
public static void main(String[] arg){
try{
@ -217,6 +217,7 @@ public class DesktopLauncher extends ClientLauncher{
@Override
public NetProvider getNet(){
if(steam && SVars.net == null) SVars.net = new SNet(new ArcNetImpl());
return steam ? SVars.net : new ArcNetImpl();
}