This commit is contained in:
Anuken
2020-05-05 14:28:37 -04:00
parent 4161698bb8
commit 07074046e6
6 changed files with 56 additions and 83 deletions

View File

@@ -33,10 +33,31 @@ public class EventType{
}
public static class WinEvent{}
public static class LoseEvent{}
public static class LaunchEvent{}
public static class ResizeEvent{}
public static class MapMakeEvent{}
public static class MapPublishEvent{}
public static class SaveLoadEvent{}
public static class ClientCreateEvent{}
public static class ServerLoadEvent{}
public static class ContentReloadEvent{}
public static class DisposeEvent{}
public static class PlayEvent{}
public static class ResetEvent{}
public static class WaveEvent{}
/** Called when the player places a line, mobile or desktop.*/
public static class LineConfirmEvent{}
/** Called when a turret recieves ammo, but only when the tutorial is active! */
public static class TurretAmmoDeliverEvent{}
/** Called when a core recieves ammo, but only when the tutorial is active! */
public static class CoreItemDeliverEvent{}
/** Called when the player opens info for a specific block.*/
public static class BlockInfoEvent{}
/** Called when the client game is first loaded. */
public static class ClientLoadEvent{}
/** Called when a game begins and the world is loaded. */
public static class WorldLoadEvent{}
public static class LaunchItemEvent{
public final ItemStack stack;
@@ -46,10 +67,6 @@ public class EventType{
}
}
public static class MapMakeEvent{}
public static class MapPublishEvent{}
public static class CommandIssueEvent{
public final Tilec tile;
public final UnitCommand command;
@@ -91,63 +108,6 @@ public class EventType{
}
}
public static class SaveLoadEvent{
}
public static class ClientCreateEvent{
}
/** Called when the client game is first loaded. */
public static class ClientLoadEvent{
}
public static class ServerLoadEvent{
}
public static class ContentReloadEvent{
}
public static class DisposeEvent{
}
public static class PlayEvent{
}
public static class ResetEvent{
}
public static class WaveEvent{
}
/** Called when the player places a line, mobile or desktop.*/
public static class LineConfirmEvent{
}
/** Called when a turret recieves ammo, but only when the tutorial is active! */
public static class TurretAmmoDeliverEvent{
}
/** Called when a core recieves ammo, but only when the tutorial is active! */
public static class CoreItemDeliverEvent{
}
/** Called when the player opens info for a specific block.*/
public static class BlockInfoEvent{
}
/** Called when the player withdraws items from a block. */
public static class WithdrawEvent{
public final Tilec tile;
@@ -210,11 +170,6 @@ public class EventType{
}
}
/** Called when a game begins and the world is loaded. */
public static class WorldLoadEvent{
}
/** Called from the logic thread. Do not access graphics here! */
public static class TileChangeEvent{
public final Tile tile;
@@ -323,10 +278,6 @@ public class EventType{
}
}
public static class ResizeEvent{
}
//TODO rename
public static class MechChangeEvent{
public final Playerc player;
@@ -383,7 +334,6 @@ public class EventType{
public static class PlayerIpBanEvent{
public final String ip;
public PlayerIpBanEvent(String ip){
this.ip = ip;
}
@@ -392,7 +342,6 @@ public class EventType{
public static class PlayerIpUnbanEvent{
public final String ip;
public PlayerIpUnbanEvent(String ip){
this.ip = ip;
}

View File

@@ -17,6 +17,29 @@ import static mindustry.Vars.*;
public class Drawf{
//an experiment, to be removed
public static void runes(float x, float y, int[] text){
int height = 6, width = 5;
float scale = 3;
float th = height * scale, tw = width * scale;
float skewx = width * scale, skewy = 0;
Draw.color(Pal.accent);
for(int i = 0; i < text.length; i++){
float ox = x + i*tw*width;
for(int j = 0; j < width * height; j++){
int cx = j % width, cy = j / width;
float rx = ox + cx * tw + skewx * cy, ry = y + cy * th;
if((text[i] & (1 << j)) != 0){
Fill.quad(rx, ry, rx + tw, ry, rx + tw + skewx, ry + th + skewy, rx + skewx, ry + th + skewy);
}
}
}
}
public static float text(){
float z = Draw.z();
if(renderer.pixelator.enabled()){

View File

@@ -1,14 +1,12 @@
package mindustry.input;
import arc.*;
import arc.struct.*;
import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.pooling.*;
import mindustry.world.*;
import java.util.*;
import static mindustry.Vars.*;
public class Placement{
@@ -97,10 +95,10 @@ public class Placement{
int nodeLimit = 1000;
int totalNodes = 0;
PriorityQueue<Tile> queue = new PriorityQueue<>(10, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + distanceHeuristic(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + distanceHeuristic(b.x, b.y, end.x, end.y)));
PQueue<Tile> queue = new PQueue<>(10, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + distanceHeuristic(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + distanceHeuristic(b.x, b.y, end.x, end.y)));
queue.add(start);
boolean found = false;
while(!queue.isEmpty() && totalNodes++ < nodeLimit){
while(!queue.empty() && totalNodes++ < nodeLimit){
Tile next = queue.poll();
float baseCost = costs.get(next.pos(), 0f);
if(next == end){

View File

@@ -9,8 +9,6 @@ import mindustry.*;
import mindustry.content.*;
import mindustry.world.*;
import java.util.*;
import static mindustry.Vars.*;
public abstract class BasicGenerator implements WorldGenerator{
@@ -319,10 +317,10 @@ public abstract class BasicGenerator implements WorldGenerator{
Tile end = tiles.getn(endX, endY);
GridBits closed = new GridBits(width, height);
IntFloatMap costs = new IntFloatMap();
PriorityQueue<Tile> queue = new PriorityQueue<>(tiles.width * tiles.height / 4, Structs.comparingFloat(a -> costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y)));
PQueue<Tile> queue = new PQueue<>(tiles.width * tiles.height / 4, Structs.comparingFloat(a -> costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y)));
queue.add(start);
boolean found = false;
while(!queue.isEmpty()){
while(!queue.empty()){
Tile next = queue.poll();
float baseCost = costs.get(next.pos(), 0f);
if(next == end){

View File

@@ -32,6 +32,7 @@ public class Fonts{
public static BitmapFont outline;
public static BitmapFont chat;
public static BitmapFont icon;
public static BitmapFont tech;
public static int getUnicode(String content){
return unicodeIcons.get(content, 0);
@@ -135,6 +136,10 @@ public class Fonts{
}};
Core.assets.load("outline", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/font.ttf", param)).loaded = t -> Fonts.outline = (BitmapFont)t;
Core.assets.load("tech", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/tech.ttf", new FreeTypeFontParameter(){{
size = 18;
}})).loaded = f -> Fonts.tech = (BitmapFont)f;
}
/** Merges the UI and font atlas together for better performance. */