Actual updating and rendering
This commit is contained in:
@@ -442,6 +442,8 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
if(!method.isVoid()){
|
if(!method.isVoid()){
|
||||||
if(method.name().equals("isNull")){
|
if(method.name().equals("isNull")){
|
||||||
builder.addStatement("return true");
|
builder.addStatement("return true");
|
||||||
|
}else if(method.name().equals("id")){
|
||||||
|
builder.addStatement("return -1");
|
||||||
}else{
|
}else{
|
||||||
Svar variable = compType == null || method.params().size > 0 ? null : compType.fields().find(v -> v.name().equals(method.name()));
|
Svar variable = compType == null || method.params().size > 0 ? null : compType.fields().find(v -> v.name().equals(method.name()));
|
||||||
if(variable == null || !varInitializers.containsKey(variable)){
|
if(variable == null || !varInitializers.containsKey(variable)){
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mindustry.content;
|
package mindustry.content;
|
||||||
|
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
public class UnitTypes implements ContentList{
|
public class UnitTypes implements ContentList{
|
||||||
@@ -14,6 +15,20 @@ public class UnitTypes implements ContentList{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
|
dagger = new UnitDef("dagger", GenericUnitEntity::create){{
|
||||||
|
speed = 0.2f;
|
||||||
|
drag = 0.4f;
|
||||||
|
hitsize = 8f;
|
||||||
|
mass = 1.75f;
|
||||||
|
health = 130;
|
||||||
|
weapons.add(new Weapon("chain-blaster"){{
|
||||||
|
reload = 28f;
|
||||||
|
alternate = true;
|
||||||
|
ejectEffect = Fx.shellEjectSmall;
|
||||||
|
bullet = Bullets.standardCopper;
|
||||||
|
}});
|
||||||
|
}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
draug = new UnitDef("draug", MinerDrone::new){{
|
draug = new UnitDef("draug", MinerDrone::new){{
|
||||||
flying = true;
|
flying = true;
|
||||||
|
|||||||
@@ -221,6 +221,8 @@ public class Logic implements ApplicationListener{
|
|||||||
runWave();
|
runWave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Groups.all.update();
|
||||||
|
|
||||||
//TODO update groups
|
//TODO update groups
|
||||||
/*
|
/*
|
||||||
if(!headless){
|
if(!headless){
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import static mindustry.Vars.collisions;
|
|||||||
/** Represents a group of a certain type of entity.*/
|
/** Represents a group of a certain type of entity.*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||||
|
private static int lastId = 0;
|
||||||
|
|
||||||
private final Array<T> array;
|
private final Array<T> array;
|
||||||
private final Array<T> intersectArray = new Array<>();
|
private final Array<T> intersectArray = new Array<>();
|
||||||
private final Rect viewport = new Rect();
|
private final Rect viewport = new Rect();
|
||||||
@@ -23,6 +25,10 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
|||||||
|
|
||||||
private int index;
|
private int index;
|
||||||
|
|
||||||
|
public static int nextId(){
|
||||||
|
return lastId++;
|
||||||
|
}
|
||||||
|
|
||||||
public EntityGroup(Class<T> type, boolean spatial, boolean mapping){
|
public EntityGroup(Class<T> type, boolean spatial, boolean mapping){
|
||||||
array = new Array<>(false, 32, type);
|
array = new Array<>(false, 32, type);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import mindustry.annotations.Annotations.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
abstract class DrawShadowComp implements Drawc, Rotc, Flyingc, DrawLayerFlyingShadowsc, DrawLayerGroundShadowsc{
|
abstract class DrawShadowComp implements Drawc, Rotc, Flyingc, DrawLayerFlyingShadowsc{
|
||||||
static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
|
static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
|
||||||
|
|
||||||
transient float x, y, rotation;
|
transient float x, y, rotation;
|
||||||
@@ -16,19 +16,6 @@ abstract class DrawShadowComp implements Drawc, Rotc, Flyingc, DrawLayerFlyingSh
|
|||||||
@Override
|
@Override
|
||||||
public void drawFlyingShadows(){
|
public void drawFlyingShadows(){
|
||||||
if(isFlying()){
|
if(isFlying()){
|
||||||
drawShadow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawGroundShadows(){
|
|
||||||
if(isGrounded()){
|
|
||||||
drawShadow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawShadow(){
|
|
||||||
if(!isGrounded()){
|
|
||||||
Draw.color(shadowColor);
|
Draw.color(shadowColor);
|
||||||
Draw.rect(getShadowRegion(), x + shadowTX * elevation(), y + shadowTY * elevation(), rotation - 90);
|
Draw.rect(getShadowRegion(), x + shadowTX * elevation(), y + shadowTY * elevation(), rotation - 90);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package mindustry.entities.def;
|
|||||||
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.entities.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -12,7 +13,7 @@ import static mindustry.Vars.player;
|
|||||||
@BaseComponent
|
@BaseComponent
|
||||||
abstract class EntityComp{
|
abstract class EntityComp{
|
||||||
private boolean added;
|
private boolean added;
|
||||||
int id;
|
int id = EntityGroup.nextId();
|
||||||
|
|
||||||
boolean isAdded(){
|
boolean isAdded(){
|
||||||
return added;
|
return added;
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ abstract class PosComp implements Position{
|
|||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set(Position pos){
|
||||||
|
set(pos.getX(), pos.getY());
|
||||||
|
}
|
||||||
|
|
||||||
void trns(float x, float y){
|
void trns(float x, float y){
|
||||||
set(this.x + x, this.y + y);
|
set(this.x + x, this.y + y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
ui.listfrag.toggle();
|
ui.listfrag.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((player.closestCore() == null && player.dead()) || state.isPaused()) && !ui.chatfrag.shown()){
|
if(((player.dead()) || state.isPaused()) && !ui.chatfrag.shown()){
|
||||||
//move camera around
|
//move camera around
|
||||||
float camSpeed = !Core.input.keyDown(Binding.dash) ? 3f : 8f;
|
float camSpeed = !Core.input.keyDown(Binding.dash) ? 3f : 8f;
|
||||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
|
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
|
||||||
|
|||||||
Reference in New Issue
Block a user