Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -22,7 +22,7 @@ bool id(vec2 coords, vec4 base){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cont(vec2 T, vec2 v){
|
bool cont(vec2 T, vec2 v){
|
||||||
float step = 1.0;
|
const float step = 3.0;
|
||||||
vec4 base = texture2D(u_texture, T);
|
vec4 base = texture2D(u_texture, T);
|
||||||
return base.a > 0.1 &&
|
return base.a > 0.1 &&
|
||||||
(id(T + vec2(0, step) * v, base) || id(T + vec2(0, -step) * v, base) ||
|
(id(T + vec2(0, step) * v, base) || id(T + vec2(0, -step) * v, base) ||
|
||||||
@@ -41,13 +41,8 @@ void main() {
|
|||||||
|
|
||||||
vec2 center = ((u_uv + u_uv2)/2.0 - u_uv) /v;
|
vec2 center = ((u_uv + u_uv2)/2.0 - u_uv) /v;
|
||||||
float dst = (abs(center.x - coords.x) + abs(center.y - coords.y))/2.0;
|
float dst = (abs(center.x - coords.x) + abs(center.y - coords.y))/2.0;
|
||||||
float chance = 1.0;
|
|
||||||
|
|
||||||
if(u_progress > 0.8){
|
if((mod(u_time / 1.5 + value, 20.0) < 15.0 && cont(t, v))){
|
||||||
chance = 1.0-(u_progress-0.8)*5.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((mod(u_time / 1.5 + value, 20.0) < 5.0 && cont(t, v))){
|
|
||||||
gl_FragColor = u_color;
|
gl_FragColor = u_color;
|
||||||
}else if(dst > (1.0-u_progress) * (center.x)){
|
}else if(dst > (1.0-u_progress) * (center.x)){
|
||||||
gl_FragColor = color;
|
gl_FragColor = color;
|
||||||
|
|||||||
@@ -673,9 +673,10 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
junction = new Junction("junction"){{
|
junction = new Junction("junction"){{
|
||||||
requirements(Category.distribution, ItemStack.with(Items.copper, 2));
|
requirements(Category.distribution, ItemStack.with(Items.copper, 3));
|
||||||
speed = 26;
|
speed = 26;
|
||||||
capacity = 32;
|
capacity = 32;
|
||||||
|
health = 25;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
itemBridge = new BufferedItemBridge("bridge-conveyor"){{
|
itemBridge = new BufferedItemBridge("bridge-conveyor"){{
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class PlacementFragment extends Fragment{
|
|||||||
final int rowWidth = 4;
|
final int rowWidth = 4;
|
||||||
|
|
||||||
Array<Block> returnArray = new Array<>();
|
Array<Block> returnArray = new Array<>();
|
||||||
|
Array<Category> returnCatArray = new Array<>();
|
||||||
|
boolean[] categoryEmpty = new boolean[Category.values().length];
|
||||||
Category currentCategory = Category.distribution;
|
Category currentCategory = Category.distribution;
|
||||||
Block hovered, lastDisplay;
|
Block hovered, lastDisplay;
|
||||||
Tile lastHover;
|
Tile lastHover;
|
||||||
@@ -56,13 +58,18 @@ public class PlacementFragment extends Fragment{
|
|||||||
|
|
||||||
public PlacementFragment(){
|
public PlacementFragment(){
|
||||||
Events.on(WorldLoadEvent.class, event -> {
|
Events.on(WorldLoadEvent.class, event -> {
|
||||||
currentCategory = Category.turret;
|
control.input(0).block = null;
|
||||||
Group group = toggler.getParent();
|
rebuild();
|
||||||
toggler.remove();
|
|
||||||
build(group);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rebuild(){
|
||||||
|
currentCategory = Category.turret;
|
||||||
|
Group group = toggler.getParent();
|
||||||
|
toggler.remove();
|
||||||
|
build(group);
|
||||||
|
}
|
||||||
|
|
||||||
boolean gridUpdate(InputHandler input){
|
boolean gridUpdate(InputHandler input){
|
||||||
if(Core.input.keyDown(Binding.pick)){ //mouse eyedropper select
|
if(Core.input.keyDown(Binding.pick)){ //mouse eyedropper select
|
||||||
Tile tile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
Tile tile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||||
@@ -121,12 +128,14 @@ public class PlacementFragment extends Fragment{
|
|||||||
group.setMinCheckCount(0);
|
group.setMinCheckCount(0);
|
||||||
|
|
||||||
for(Block block : getByCategory(currentCategory)){
|
for(Block block : getByCategory(currentCategory)){
|
||||||
|
|
||||||
if(index++ % rowWidth == 0){
|
if(index++ % rowWidth == 0){
|
||||||
blockTable.row();
|
blockTable.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean[] unlocked = {false};
|
if(!data.isUnlocked(block)){
|
||||||
|
blockTable.add().size(46);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ImageButton button = blockTable.addImageButton("icon-locked", "select", 8 * 4, () -> {
|
ImageButton button = blockTable.addImageButton("icon-locked", "select", 8 * 4, () -> {
|
||||||
if(data.isUnlocked(block)){
|
if(data.isUnlocked(block)){
|
||||||
@@ -134,21 +143,14 @@ public class PlacementFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
}).size(46f).group(group).get();
|
}).size(46f).group(group).get();
|
||||||
|
|
||||||
|
button.replaceImage(new Image(block.icon(Icon.medium)));
|
||||||
|
|
||||||
button.update(() -> { //color unplacable things gray
|
button.update(() -> { //color unplacable things gray
|
||||||
boolean ulock = data.isUnlocked(block);
|
boolean ulock = data.isUnlocked(block);
|
||||||
TileEntity core = players[0].getClosestCore();
|
TileEntity core = players[0].getClosestCore();
|
||||||
Color color = core != null && (core.items.has(block.buildRequirements) || state.rules.infiniteResources) ? Color.WHITE : ulock ? Color.GRAY : Color.WHITE;
|
Color color = core != null && (core.items.has(block.buildRequirements) || state.rules.infiniteResources) ? Color.WHITE : ulock ? Color.GRAY : Color.WHITE;
|
||||||
button.forEach(elem -> elem.setColor(color));
|
button.forEach(elem -> elem.setColor(color));
|
||||||
button.setChecked(input.block == block);
|
button.setChecked(input.block == block);
|
||||||
|
|
||||||
if(ulock == unlocked[0]) return;
|
|
||||||
unlocked[0] = ulock;
|
|
||||||
|
|
||||||
if(!ulock){
|
|
||||||
button.replaceImage(new Image("icon-locked"));
|
|
||||||
}else{
|
|
||||||
button.replaceImage(new Image(block.icon(Icon.medium)));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
button.hovered(() -> hovered = block);
|
button.hovered(() -> hovered = block);
|
||||||
@@ -246,15 +248,25 @@ public class PlacementFragment extends Fragment{
|
|||||||
|
|
||||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||||
|
|
||||||
|
//update category empty values
|
||||||
for(Category cat : Category.values()){
|
for(Category cat : Category.values()){
|
||||||
if(getByCategory(cat).isEmpty()) continue;
|
Array<Block> blocks = getByCategory(cat);
|
||||||
|
categoryEmpty[cat.ordinal()] = blocks.isEmpty() || !blocks.first().unlocked();
|
||||||
|
}
|
||||||
|
|
||||||
|
int f = 0;
|
||||||
|
for(Category cat : getCategories()){
|
||||||
|
if(f++ % 2 == 0) categories.row();
|
||||||
|
|
||||||
|
if(categoryEmpty[cat.ordinal()]){
|
||||||
|
categories.addImage("flat");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
categories.addImageButton("icon-" + cat.name(), "clear-toggle", 16 * 2, () -> {
|
categories.addImageButton("icon-" + cat.name(), "clear-toggle", 16 * 2, () -> {
|
||||||
currentCategory = cat;
|
currentCategory = cat;
|
||||||
rebuildCategory.run();
|
rebuildCategory.run();
|
||||||
}).group(group).update(i -> i.setChecked(currentCategory == cat));
|
}).group(group).update(i -> i.setChecked(currentCategory == cat));
|
||||||
|
|
||||||
if(cat.ordinal() % 2 == 1) categories.row();
|
|
||||||
}
|
}
|
||||||
}).touchable(Touchable.enabled);
|
}).touchable(Touchable.enabled);
|
||||||
|
|
||||||
@@ -265,6 +277,13 @@ public class PlacementFragment extends Fragment{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Array<Category> getCategories(){
|
||||||
|
returnCatArray.clear();
|
||||||
|
returnCatArray.addAll(Category.values());
|
||||||
|
returnCatArray.sort((c1, c2) -> Boolean.compare(categoryEmpty[c1.ordinal()], categoryEmpty[c2.ordinal()]));
|
||||||
|
return returnCatArray;
|
||||||
|
}
|
||||||
|
|
||||||
Array<Block> getByCategory(Category cat){
|
Array<Block> getByCategory(Category cat){
|
||||||
returnArray.clear();
|
returnArray.clear();
|
||||||
@@ -273,6 +292,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
returnArray.add(block);
|
returnArray.add(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
returnArray.sort((b1, b2) -> -Boolean.compare(b1.unlocked(), b2.unlocked()));
|
||||||
return returnArray;
|
return returnArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -244,10 +244,15 @@ public class ServerControl implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
|
|
||||||
handler.register("maps", "Display all available maps.", arg -> {
|
handler.register("maps", "Display all available maps.", arg -> {
|
||||||
info("Maps:");
|
if(!world.maps.all().isEmpty()){
|
||||||
for(Map map : world.maps.all()){
|
info("Maps:");
|
||||||
info(" &ly{0}: &lb&fi{1} / {2}x{3}", map.name, map.custom ? "Custom" : "Default", map.meta.width, map.meta.height);
|
for(Map map : world.maps.all()){
|
||||||
|
info(" &ly{0}: &lb&fi{1} / {2}x{3}", map.name, map.custom ? "Custom" : "Default", map.meta.width, map.meta.height);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
info("No maps found.");
|
||||||
}
|
}
|
||||||
|
info("&lyMap directory: &lb&fi{0}", customMapDirectory.file().getAbsoluteFile().toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("status", "Display server status.", arg -> {
|
handler.register("status", "Display server status.", arg -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user