mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
Basic kill tracking
This commit is contained in:
parent
53d4f44178
commit
f925ec8cbe
@ -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"){{
|
||||
|
@ -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){
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killed(Entity other){
|
||||
if(owner instanceof KillerTrait){
|
||||
((KillerTrait)owner).killed(other);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void absorb(){
|
||||
supressCollision = true;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user