Basic kill tracking
This commit is contained in:
@@ -1194,7 +1194,7 @@ public class Blocks implements ContentList{
|
|||||||
rotateSpeed = 1.4f;
|
rotateSpeed = 1.4f;
|
||||||
attribute = Attribute.water;
|
attribute = Attribute.water;
|
||||||
|
|
||||||
consumes.power(0.90f);
|
consumes.power(1f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
cultivator = new Cultivator("cultivator"){{
|
cultivator = new Cultivator("cultivator"){{
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package io.anuke.mindustry.entities.traits;
|
package io.anuke.mindustry.entities.traits;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.entities.type.*;
|
||||||
|
|
||||||
public interface DamageTrait{
|
public interface DamageTrait{
|
||||||
float damage();
|
float damage();
|
||||||
|
|
||||||
|
default void killed(Entity other){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package io.anuke.mindustry.entities.traits;
|
||||||
|
|
||||||
|
public interface KillerTrait{
|
||||||
|
void killed(Entity other);
|
||||||
|
}
|
||||||
@@ -134,6 +134,13 @@ public class Bullet extends SolidEntity implements DamageTrait, ScaleTrait, Pool
|
|||||||
return 1f;
|
return 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void killed(Entity other){
|
||||||
|
if(owner instanceof KillerTrait){
|
||||||
|
((KillerTrait)owner).killed(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void absorb(){
|
public void absorb(){
|
||||||
supressCollision = true;
|
supressCollision = true;
|
||||||
|
|||||||
@@ -15,8 +15,12 @@ public abstract class DestructibleEntity extends SolidEntity implements HealthTr
|
|||||||
@Override
|
@Override
|
||||||
public void collision(SolidTrait other, float x, float y){
|
public void collision(SolidTrait other, float x, float y){
|
||||||
if(other instanceof DamageTrait){
|
if(other instanceof DamageTrait){
|
||||||
|
boolean wasDead = isDead();
|
||||||
onHit(other);
|
onHit(other);
|
||||||
damage(((DamageTrait)other).damage());
|
damage(((DamageTrait)other).damage());
|
||||||
|
if(!wasDead && isDead()){
|
||||||
|
((DamageTrait)other).killed(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
public class DesktopLauncher extends ClientLauncher{
|
public class DesktopLauncher extends ClientLauncher{
|
||||||
public final static String discordID = "610508934456934412";
|
public final static String discordID = "610508934456934412";
|
||||||
|
|
||||||
boolean useDiscord = OS.is64Bit, showConsole = true;
|
boolean useDiscord = OS.is64Bit, showConsole = false;
|
||||||
|
|
||||||
public static void main(String[] arg){
|
public static void main(String[] arg){
|
||||||
try{
|
try{
|
||||||
@@ -217,6 +217,7 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NetProvider getNet(){
|
public NetProvider getNet(){
|
||||||
|
if(steam && SVars.net == null) SVars.net = new SNet(new ArcNetImpl());
|
||||||
return steam ? SVars.net : new ArcNetImpl();
|
return steam ? SVars.net : new ArcNetImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user