Added test unit type

This commit is contained in:
Anuken
2018-03-16 21:48:44 -04:00
parent ad2e2032e6
commit 714fdc751a
47 changed files with 323 additions and 277 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Fri Mar 16 00:30:24 EDT 2018 #Fri Mar 16 21:46:55 EDT 2018
version=release version=release
androidBuildCode=525 androidBuildCode=528
name=Mindustry name=Mindustry
code=3.4 code=3.4
build=custom build build=custom build

View File

@@ -122,7 +122,7 @@ public class Logic extends Module {
Entities.update(Entities.defaultGroup()); Entities.update(Entities.defaultGroup());
Entities.update(bulletGroup); Entities.update(bulletGroup);
for(EntityGroup group : unitGroups){ for(EntityGroup group : unitGroups){
if(!group.isEmpty()) Entities.update(group); Entities.update(group);
} }
Entities.update(tileGroup); Entities.update(tileGroup);
Entities.update(shieldGroup); Entities.update(shieldGroup);

View File

@@ -86,8 +86,12 @@ public class BaseUnit extends Unit {
@Override @Override
public void added(){ public void added(){
maxhealth = type.health;
hitbox.setSize(type.hitsize); hitbox.setSize(type.hitsize);
hitboxTile.setSize(type.hitsizeTile); hitboxTile.setSize(type.hitsizeTile);
heal();
} }
@Override @Override
@@ -117,6 +121,7 @@ public class BaseUnit extends Unit {
data.putFloat(x); data.putFloat(x);
data.putFloat(y); data.putFloat(y);
data.putShort((short)(rotation *2)); data.putShort((short)(rotation *2));
data.putShort((short)(baseRotation *2));
data.putShort((short)health); data.putShort((short)health);
} }
@@ -124,10 +129,11 @@ public class BaseUnit extends Unit {
public void read(ByteBuffer data, long time) { public void read(ByteBuffer data, long time) {
float x = data.getFloat(); float x = data.getFloat();
float y = data.getFloat(); float y = data.getFloat();
short angle = data.getShort(); short rotation = data.getShort();
short baserotation = data.getShort();
short health = data.getShort(); short health = data.getShort();
interpolator.read(this.x, this.y, x, y, rotation/2f, baserotation/2f, time);
this.health = health; this.health = health;
interpolator.read(this.x, this.y, x, y, angle/2f, time);
} }
} }

View File

@@ -77,11 +77,12 @@ public abstract class UnitType {
if(Net.server()){ if(Net.server()){
NetEvents.handleUnitDeath(unit); NetEvents.handleUnitDeath(unit);
} }
unit.remove();
} }
public void onRemoteDeath(BaseUnit unit){ public void onRemoteDeath(BaseUnit unit){
onDeath(unit); onDeath(unit);
unit.remove();
} }
public void removed(BaseUnit unit){ public void removed(BaseUnit unit){

View File

@@ -1,5 +1,9 @@
package io.anuke.mindustry.entities.units; package io.anuke.mindustry.entities.units;
import io.anuke.mindustry.entities.units.types.Scout;
public class UnitTypes { public class UnitTypes {
//TODO list types here. public static final UnitType
scout = new Scout();
} }

View File

@@ -0,0 +1,10 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.GroundUnitType;
public class Scout extends GroundUnitType {
public Scout(){
super("scout");
}
}

View File

@@ -0,0 +1,6 @@
package io.anuke.mindustry.io;
/**Reads and writes map files.*/
public class MapIO {
//TODO implementation
}

View File

@@ -3,6 +3,8 @@ package io.anuke.mindustry.ui.fragments;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.files.FileHandle;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.units.BaseUnit;
import io.anuke.mindustry.entities.units.UnitTypes;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.scene.builders.button; import io.anuke.ucore.scene.builders.button;
@@ -46,17 +48,13 @@ public class DebugFragment implements Fragment {
row(); row();
new button("noclip", "toggle", () -> noclip = !noclip); new button("noclip", "toggle", () -> noclip = !noclip);
row(); row();
new button("hideplayer", "toggle", () -> showPlayer = !showPlayer);
row();
new button("blocks", "toggle", () -> showBlockDebug = !showBlockDebug); new button("blocks", "toggle", () -> showBlockDebug = !showBlockDebug);
row(); row();
new button("paths", "toggle", () -> showPaths = !showPaths); new button("paths", "toggle", () -> showPaths = !showPaths);
row(); row();
new button("wave", () -> state.wavetime = 0f); new button("wave", () -> state.wavetime = 0f);
row(); row();
new button("time 0", () -> Timers.resetTime(0f)); new button("spawn", () -> new BaseUnit(UnitTypes.scout).set(player.x, player.y).add());
row();
new button("time max", () -> Timers.resetTime(1080000 - 60*10));
row(); row();
}}.end(); }}.end();