Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0be674d7af | ||
|
|
e6499f7e5a | ||
|
|
10bd1d1969 | ||
|
|
ec94267b8e | ||
|
|
d3ad113bf5 | ||
|
|
8d7242a1ef | ||
|
|
13879dd374 | ||
|
|
0f519fd358 |
@@ -547,7 +547,7 @@ public class Bullets implements ContentList{
|
|||||||
@Override
|
@Override
|
||||||
public void update(Bullet b){
|
public void update(Bullet b){
|
||||||
if(b.timer.get(1, 5f)){
|
if(b.timer.get(1, 5f)){
|
||||||
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), length);
|
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), length, true);
|
||||||
}
|
}
|
||||||
Effects.shake(1f, 1f, b.x, b.y);
|
Effects.shake(1f, 1f, b.x, b.y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,9 +108,13 @@ public class ContentLoader{
|
|||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initializes all content with the specified function. */
|
|
||||||
public void initialize(Consumer<Content> callable){
|
public void initialize(Consumer<Content> callable){
|
||||||
if(initialization.contains(callable)) return;
|
initialize(callable, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes all content with the specified function. */
|
||||||
|
public void initialize(Consumer<Content> callable, boolean override){
|
||||||
|
if(initialization.contains(callable) && !override) return;
|
||||||
|
|
||||||
for(ContentType type : ContentType.values()){
|
for(ContentType type : ContentType.values()){
|
||||||
for(Content content : contentMap[type.ordinal()]){
|
for(Content content : contentMap[type.ordinal()]){
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class Control implements ApplicationListener{
|
|||||||
content.initialize(Content::init);
|
content.initialize(Content::init);
|
||||||
Core.atlas = new TextureAtlas(maxSize < 2048 ? "sprites/sprites_fallback.atlas" : "sprites/sprites.atlas");
|
Core.atlas = new TextureAtlas(maxSize < 2048 ? "sprites/sprites_fallback.atlas" : "sprites/sprites.atlas");
|
||||||
Draw.scl = 1f / Core.atlas.find("scale_marker").getWidth();
|
Draw.scl = 1f / Core.atlas.find("scale_marker").getWidth();
|
||||||
content.initialize(Content::load);
|
content.initialize(Content::load, true);
|
||||||
|
|
||||||
data.load();
|
data.load();
|
||||||
|
|
||||||
@@ -83,6 +83,8 @@ public class Control implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Events.on(PlayEvent.class, event -> {
|
Events.on(PlayEvent.class, event -> {
|
||||||
|
player.setTeam(defaultTeam);
|
||||||
|
player.setDead(true);
|
||||||
player.add();
|
player.add();
|
||||||
|
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.anuke.arc.Events;
|
|||||||
import io.anuke.arc.collection.ObjectSet.ObjectSetIterator;
|
import io.anuke.arc.collection.ObjectSet.ObjectSetIterator;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.type.Player;
|
import io.anuke.mindustry.entities.type.Player;
|
||||||
@@ -15,7 +16,6 @@ import io.anuke.mindustry.game.EventType.*;
|
|||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -66,9 +66,7 @@ public class Logic implements ApplicationListener{
|
|||||||
for(Team team : Team.all){
|
for(Team team : Team.all){
|
||||||
if(state.teams.isActive(team)){
|
if(state.teams.isActive(team)){
|
||||||
for(Tile core : state.teams.get(team).cores){
|
for(Tile core : state.teams.get(team).cores){
|
||||||
for(ItemStack stack : state.rules.startingItems){
|
core.entity.items.add(Items.copper, 200);
|
||||||
core.entity.items.add(stack.item, stack.amount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
public static void onWorldDataBegin(){
|
public static void onWorldDataBegin(){
|
||||||
Entities.clear();
|
Entities.clear();
|
||||||
netClient.removed.clear();
|
netClient.removed.clear();
|
||||||
|
logic.reset();
|
||||||
|
|
||||||
ui.chatfrag.clearMessages();
|
ui.chatfrag.clearMessages();
|
||||||
Net.setClientLoaded(false);
|
Net.setClientLoaded(false);
|
||||||
|
|||||||
@@ -183,8 +183,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
public void act(float delta){
|
public void act(float delta){
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
|
|
||||||
if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) &&
|
if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) && !Core.input.keyDown(KeyCode.CONTROL_LEFT)){
|
||||||
!Core.input.keyDown(KeyCode.CONTROL_LEFT)){
|
|
||||||
float ax = Core.input.axis(Binding.move_x);
|
float ax = Core.input.axis(Binding.move_x);
|
||||||
float ay = Core.input.axis(Binding.move_y);
|
float ay = Core.input.axis(Binding.move_y);
|
||||||
offsetx -= ax * 15f / zoom;
|
offsetx -= ax * 15f / zoom;
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package io.anuke.mindustry.entities;
|
|||||||
import io.anuke.annotations.Annotations.Struct;
|
import io.anuke.annotations.Annotations.Struct;
|
||||||
import io.anuke.arc.collection.GridBits;
|
import io.anuke.arc.collection.GridBits;
|
||||||
import io.anuke.arc.collection.IntQueue;
|
import io.anuke.arc.collection.IntQueue;
|
||||||
import io.anuke.arc.function.Consumer;
|
import io.anuke.arc.function.*;
|
||||||
import io.anuke.arc.function.Predicate;
|
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.math.geom.*;
|
import io.anuke.arc.math.geom.*;
|
||||||
@@ -78,18 +77,31 @@ public class Damage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void collideLine(Bullet hitter, Team team, Effect effect, float x, float y, float angle, float length){
|
||||||
|
collideLine(hitter, team, effect, x, y, angle, length, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Damages entities in a line.
|
* Damages entities in a line.
|
||||||
* Only enemies of the specified team are damaged.
|
* Only enemies of the specified team are damaged.
|
||||||
*/
|
*/
|
||||||
public static void collideLine(Bullet hitter, Team team, Effect effect, float x, float y, float angle, float length){
|
public static void collideLine(Bullet hitter, Team team, Effect effect, float x, float y, float angle, float length, boolean large){
|
||||||
tr.trns(angle, length);
|
tr.trns(angle, length);
|
||||||
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
|
IntPositionConsumer collider = (cx, cy) -> {
|
||||||
Tile tile = world.ltile(cx, cy);
|
Tile tile = world.ltile(cx, cy);
|
||||||
if(tile != null && tile.entity != null && tile.getTeamID() != team.ordinal() && tile.entity.collide(hitter)){
|
if(tile != null && tile.entity != null && tile.getTeamID() != team.ordinal() && tile.entity.collide(hitter)){
|
||||||
tile.entity.collision(hitter);
|
tile.entity.collision(hitter);
|
||||||
hitter.getBulletType().hit(hitter, tile.worldx(), tile.worldy());
|
hitter.getBulletType().hit(hitter, tile.worldx(), tile.worldy());
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
|
||||||
|
collider.accept(cx, cy);
|
||||||
|
if(large){
|
||||||
|
for(Point2 p : Geometry.d4){
|
||||||
|
collider.accept(cx + p.x, cy + p.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public class Predict{
|
|||||||
*/
|
*/
|
||||||
public static Vector2 intercept(TargetTrait src, TargetTrait dst, float v){
|
public static Vector2 intercept(TargetTrait src, TargetTrait dst, float v){
|
||||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(),
|
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(),
|
||||||
dst.getTargetVelocityX() - src.getTargetVelocityX(),
|
dst.getTargetVelocityX() - src.getTargetVelocityX()/2f,
|
||||||
dst.getTargetVelocityY() - src.getTargetVelocityY(), v);
|
dst.getTargetVelocityY() - src.getTargetVelocityY()/2f, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector2 quad(float a, float b, float c){
|
private static Vector2 quad(float a, float b, float c){
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ public class Units{
|
|||||||
|
|
||||||
/** Returns the closest target enemy. First, units are checked, then tile entities. */
|
/** Returns the closest target enemy. First, units are checked, then tile entities. */
|
||||||
public static TargetTrait closestTarget(Team team, float x, float y, float range, Predicate<Unit> unitPred, Predicate<Tile> tilePred){
|
public static TargetTrait closestTarget(Team team, float x, float y, float range, Predicate<Unit> unitPred, Predicate<Tile> tilePred){
|
||||||
|
if(team == Team.none) return null;
|
||||||
|
|
||||||
Unit unit = closestEnemy(team, x, y, range, unitPred);
|
Unit unit = closestEnemy(team, x, y, range, unitPred);
|
||||||
if(unit != null){
|
if(unit != null){
|
||||||
return unit;
|
return unit;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class RubbleDecal extends Decal{
|
|||||||
public static void create(float x, float y, int size){
|
public static void create(float x, float y, int size){
|
||||||
if(headless) return;
|
if(headless) return;
|
||||||
|
|
||||||
if(regions[size].length == 0){
|
if(regions[size].length == 0 || regions[size][0].getTexture().isDisposed()){
|
||||||
regions[size] = new TextureRegion[2];
|
regions[size] = new TextureRegion[2];
|
||||||
for(int j = 0; j < 2; j++){
|
for(int j = 0; j < 2; j++){
|
||||||
regions[size][j] = Core.atlas.find("rubble-" + size + "-" + j);
|
regions[size][j] = Core.atlas.find("rubble-" + size + "-" + j);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class ScorchDecal extends Decal{
|
|||||||
public static void create(float x, float y){
|
public static void create(float x, float y){
|
||||||
if(headless) return;
|
if(headless) return;
|
||||||
|
|
||||||
if(regions[0] == null){
|
if(regions[0] == null || regions[0].getTexture().isDisposed()){
|
||||||
for(int i = 0; i < regions.length; i++){
|
for(int i = 0; i < regions.length; i++){
|
||||||
regions[i] = Core.atlas.find("scorch" + (i + 1));
|
regions[i] = Core.atlas.find("scorch" + (i + 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package io.anuke.mindustry.game;
|
|||||||
|
|
||||||
import io.anuke.annotations.Annotations.Serialize;
|
import io.anuke.annotations.Annotations.Serialize;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.Array;
|
||||||
import io.anuke.mindustry.content.Items;
|
|
||||||
import io.anuke.mindustry.io.JsonIO;
|
import io.anuke.mindustry.io.JsonIO;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
|
||||||
import io.anuke.mindustry.type.Zone;
|
import io.anuke.mindustry.type.Zone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,11 +63,9 @@ public class Rules{
|
|||||||
public boolean attackMode = false;
|
public boolean attackMode = false;
|
||||||
/** Whether this is the editor gamemode. */
|
/** Whether this is the editor gamemode. */
|
||||||
public boolean editor = false;
|
public boolean editor = false;
|
||||||
/** Items that the player starts with here. Not applicable to zones.*/
|
|
||||||
public Array<ItemStack> startingItems = Array.with(new ItemStack(Items.copper, 200));
|
|
||||||
|
|
||||||
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
||||||
public Rules copy(){
|
public Rules copy(){
|
||||||
return JsonIO.read(Rules.class, JsonIO.write(this));
|
return JsonIO.copy(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ public class JsonIO{
|
|||||||
private static Json json = new Json(){{
|
private static Json json = new Json(){{
|
||||||
setIgnoreUnknownFields(true);
|
setIgnoreUnknownFields(true);
|
||||||
setElementType(Rules.class, "spawns", SpawnGroup.class);
|
setElementType(Rules.class, "spawns", SpawnGroup.class);
|
||||||
setElementType(Rules.class, "startingItems", ItemStack.class);
|
|
||||||
|
|
||||||
setSerializer(Zone.class, new Serializer<Zone>(){
|
setSerializer(Zone.class, new Serializer<Zone>(){
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -100,19 +100,25 @@ public class CrashSender{
|
|||||||
ex(() -> value.addChild("os", new JsonValue(System.getProperty("os.name"))));
|
ex(() -> value.addChild("os", new JsonValue(System.getProperty("os.name"))));
|
||||||
ex(() -> value.addChild("trace", new JsonValue(parseException(exception))));
|
ex(() -> value.addChild("trace", new JsonValue(parseException(exception))));
|
||||||
|
|
||||||
|
boolean[] sent = {false};
|
||||||
|
|
||||||
Log.info("Sending crash report.");
|
Log.info("Sending crash report.");
|
||||||
//post to crash report URL
|
//post to crash report URL
|
||||||
Net.http(Vars.crashReportURL, "POST", value.toJson(OutputType.json), r -> {
|
Net.http(Vars.crashReportURL, "POST", value.toJson(OutputType.json), r -> {
|
||||||
Log.info("Crash sent successfully.");
|
Log.info("Crash sent successfully.");
|
||||||
|
sent[0] = true;
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}, t -> {
|
}, t -> {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
|
sent[0] = true;
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
//sleep for 10 seconds or until crash report is sent
|
//sleep until report is sent
|
||||||
try{
|
try{
|
||||||
Thread.sleep(10000);
|
while(!sent[0]){
|
||||||
|
Thread.sleep(30);
|
||||||
|
}
|
||||||
}catch(InterruptedException ignored){
|
}catch(InterruptedException ignored){
|
||||||
}
|
}
|
||||||
}catch(Throwable death){
|
}catch(Throwable death){
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import io.anuke.arc.Core;
|
|||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.mindustry.entities.Entities;
|
import io.anuke.mindustry.entities.Entities;
|
||||||
import io.anuke.mindustry.entities.type.Player;
|
import io.anuke.mindustry.entities.type.Player;
|
||||||
import io.anuke.mindustry.game.Rules;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.game.Version;
|
|
||||||
import io.anuke.mindustry.io.JsonIO;
|
import io.anuke.mindustry.io.JsonIO;
|
||||||
import io.anuke.mindustry.io.SaveIO;
|
import io.anuke.mindustry.io.SaveIO;
|
||||||
import io.anuke.mindustry.maps.Map;
|
import io.anuke.mindustry.maps.Map;
|
||||||
|
|||||||
@@ -63,9 +63,10 @@ public class MenuFragment extends Fragment{
|
|||||||
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
|
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
|
||||||
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadAnd(ui.editor::show)),
|
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadAnd(ui.editor::show)),
|
||||||
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
|
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
|
||||||
donate = new MobileButton("icon-donate", isize, "$donate", () -> Core.net.openURI(donationURL));
|
donate = new MobileButton("icon-donate", isize, "$donate", () -> Core.net.openURI(donationURL)),
|
||||||
|
exit = new MobileButton("icon-exit", isize, "$quit", () -> Core.app.exit());
|
||||||
|
|
||||||
if(Core.graphics.getWidth() > Core.graphics.getHeight()){
|
if(!Core.graphics.isPortrait()){
|
||||||
container.add(play);
|
container.add(play);
|
||||||
container.add(join);
|
container.add(join);
|
||||||
container.add(custom);
|
container.add(custom);
|
||||||
@@ -79,6 +80,7 @@ public class MenuFragment extends Fragment{
|
|||||||
table.add(tools);
|
table.add(tools);
|
||||||
|
|
||||||
if(Platform.instance.canDonate()) table.add(donate);
|
if(Platform.instance.canDonate()) table.add(donate);
|
||||||
|
table.add(exit);
|
||||||
}).colspan(4);
|
}).colspan(4);
|
||||||
}else{
|
}else{
|
||||||
container.add(play);
|
container.add(play);
|
||||||
@@ -95,6 +97,7 @@ public class MenuFragment extends Fragment{
|
|||||||
table.defaults().set(container.defaults());
|
table.defaults().set(container.defaults());
|
||||||
|
|
||||||
if(Platform.instance.canDonate()) table.add(donate);
|
if(Platform.instance.canDonate()) table.add(donate);
|
||||||
|
table.add(exit);
|
||||||
}).colspan(2);
|
}).colspan(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ public class Block extends BlockStorage{
|
|||||||
cacheRegions[i] = Core.atlas.find(cacheRegionStrings.get(i));
|
cacheRegions[i] = Core.atlas.find(cacheRegionStrings.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cracks == null){
|
if(cracks == null || cracks[0][0].getTexture().isDisposed()){
|
||||||
cracks = new TextureRegion[maxCrackSize][crackRegions];
|
cracks = new TextureRegion[maxCrackSize][crackRegions];
|
||||||
for(int size = 1; size <= maxCrackSize; size++){
|
for(int size = 1; size <= maxCrackSize; size++){
|
||||||
for(int i = 0; i < crackRegions; i++){
|
for(int i = 0; i < crackRegions; i++){
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.mindustry.world.meta.BlockGroup;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class OverflowGate extends Block{
|
public class OverflowGate extends Block{
|
||||||
protected float speed = 8f;
|
protected float speed = 1f;
|
||||||
|
|
||||||
public OverflowGate(String name){
|
public OverflowGate(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -35,7 +35,6 @@ public class OverflowGate extends Block{
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
OverflowGateEntity entity = tile.entity();
|
OverflowGateEntity entity = tile.entity();
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class LiquidConverter extends GenericCrafter{
|
|||||||
if(hasPower){
|
if(hasPower){
|
||||||
use *= entity.power.satisfaction; // Produce less liquid if power is not maxed
|
use *= entity.power.satisfaction; // Produce less liquid if power is not maxed
|
||||||
}
|
}
|
||||||
|
useContent(tile, outputLiquid.liquid);
|
||||||
entity.progress += use / cl.amount / craftTime;
|
entity.progress += use / cl.amount / craftTime;
|
||||||
entity.liquids.add(outputLiquid.liquid, use);
|
entity.liquids.add(outputLiquid.liquid, use);
|
||||||
if(entity.progress >= 1f){
|
if(entity.progress >= 1f){
|
||||||
|
|||||||
@@ -72,16 +72,18 @@ public class MechPad extends Block{
|
|||||||
|
|
||||||
if(entity.player == null) return;
|
if(entity.player == null) return;
|
||||||
Mech mech = ((MechPad)tile.block()).mech;
|
Mech mech = ((MechPad)tile.block()).mech;
|
||||||
|
boolean resetSpawner = !entity.sameMech && entity.player.mech == mech;
|
||||||
entity.player.mech = !entity.sameMech && entity.player.mech == mech ? Mechs.starter : mech;
|
entity.player.mech = !entity.sameMech && entity.player.mech == mech ? Mechs.starter : mech;
|
||||||
|
|
||||||
entity.progress = 0;
|
entity.progress = 0;
|
||||||
entity.player.onRespawn(tile);
|
entity.player.onRespawn(tile);
|
||||||
|
if(resetSpawner) entity.player.lastSpawner = null;
|
||||||
entity.player = null;
|
entity.player = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean checkValidTap(Tile tile, Player player){
|
protected static boolean checkValidTap(Tile tile, Player player){
|
||||||
MechFactoryEntity entity = tile.entity();
|
MechFactoryEntity entity = tile.entity();
|
||||||
return Math.abs(player.x - tile.drawx()) <= tile.block().size * tilesize &&
|
return !player.isDead() && Math.abs(player.x - tile.drawx()) <= tile.block().size * tilesize &&
|
||||||
Math.abs(player.y - tile.drawy()) <= tile.block().size * tilesize && entity.cons.valid() && entity.player == null;
|
Math.abs(player.y - tile.drawy()) <= tile.block().size * tilesize && entity.cons.valid() && entity.player == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
private FileHandle currentLogFile;
|
private FileHandle currentLogFile;
|
||||||
private boolean inExtraRound;
|
private boolean inExtraRound;
|
||||||
private Task lastTask;
|
private Task lastTask;
|
||||||
|
private Gamemode lastMode = Gamemode.survival;
|
||||||
|
|
||||||
private Thread socketThread;
|
private Thread socketThread;
|
||||||
private PrintWriter socketOutput;
|
private PrintWriter socketOutput;
|
||||||
@@ -235,6 +236,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
info("Loading map...");
|
info("Loading map...");
|
||||||
|
|
||||||
logic.reset();
|
logic.reset();
|
||||||
|
lastMode = preset;
|
||||||
try{
|
try{
|
||||||
world.loadMap(result);
|
world.loadMap(result);
|
||||||
state.rules = preset.apply(result.rules());
|
state.rules = preset.apply(result.rules());
|
||||||
@@ -698,12 +700,13 @@ public class ServerControl implements ApplicationListener{
|
|||||||
players.add(p);
|
players.add(p);
|
||||||
p.setDead(true);
|
p.setDead(true);
|
||||||
}
|
}
|
||||||
Rules rules = state.rules;
|
|
||||||
logic.reset();
|
logic.reset();
|
||||||
state.rules = rules;
|
|
||||||
Call.onWorldDataBegin();
|
Call.onWorldDataBegin();
|
||||||
run.run();
|
run.run();
|
||||||
logic.play();
|
logic.play();
|
||||||
|
state.rules = lastMode.apply(world.getMap().rules());
|
||||||
for(Player p : players){
|
for(Player p : players){
|
||||||
p.reset();
|
p.reset();
|
||||||
if(state.rules.pvp){
|
if(state.rules.pvp){
|
||||||
|
|||||||
Reference in New Issue
Block a user