Many internal changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mindustry.entities;
|
||||
|
||||
import arc.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
@@ -34,14 +35,14 @@ public class Fires{
|
||||
}
|
||||
|
||||
public static Firec get(int x, int y){
|
||||
return map.get(Pos.get(x, y));
|
||||
return map.get(Point2.pack(x, y));
|
||||
}
|
||||
|
||||
public static boolean has(int x, int y){
|
||||
if(!Structs.inBounds(x, y, world.width(), world.height()) || !map.containsKey(Pos.get(x, y))){
|
||||
if(!Structs.inBounds(x, y, world.width(), world.height()) || !map.containsKey(Point2.pack(x, y))){
|
||||
return false;
|
||||
}
|
||||
Firec fire = map.get(Pos.get(x, y));
|
||||
Firec fire = map.get(Point2.pack(x, y));
|
||||
return fire.isAdded() && fire.fin() < 1f && fire.tile() != null && fire.tile().x == x && fire.tile().y == y;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,15 +233,12 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc{
|
||||
}
|
||||
|
||||
/** Tile configuration. Defaults to null. Used for block rebuilding. */
|
||||
@Nullable
|
||||
@Override
|
||||
public Object config(){
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Sets the config object and casts it. Does nothing by default. */
|
||||
public void setConfig(Object config){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(){
|
||||
if(sound != null){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mindustry.entities.units;
|
||||
|
||||
import arc.func.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.world.*;
|
||||
@@ -51,6 +52,28 @@ public class BuildRequest{
|
||||
|
||||
}
|
||||
|
||||
public static Object pointConfig(Object config, Cons<Point2> cons){
|
||||
if(config instanceof Point2){
|
||||
config = ((Point2)config).cpy();
|
||||
cons.get((Point2)config);
|
||||
}else if(config instanceof Point2[]){
|
||||
Point2[] result = new Point2[((Point2[])config).length];
|
||||
int i = 0;
|
||||
for(Point2 p : (Point2[])config){
|
||||
result[i] = p.cpy();
|
||||
cons.get(result[i++]);
|
||||
}
|
||||
config = result;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
/** If this requests's config is a Point2 or an array of Point2s, this returns a copy of them for transformation.
|
||||
* Otherwise does nothing. */
|
||||
public void pointConfig(Cons<Point2> cons){
|
||||
this.config = pointConfig(this.config, cons);
|
||||
}
|
||||
|
||||
public BuildRequest copy(){
|
||||
BuildRequest copy = new BuildRequest();
|
||||
copy.x = x;
|
||||
|
||||
Reference in New Issue
Block a user