Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
Conflicts: core/src/mindustry/core/ContentLoader.java core/src/mindustry/world/Block.java
This commit is contained in:
@@ -2062,6 +2062,7 @@ public class UnitTypes{
|
||||
weaveMag = 4;
|
||||
weaveScale = 4;
|
||||
lifetime = 60f;
|
||||
keepVelocity = false;
|
||||
shootEffect = Fx.shootHeal;
|
||||
smokeEffect = Fx.hitLaser;
|
||||
splashDamage = 13f;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ContentLoader{
|
||||
}
|
||||
}
|
||||
|
||||
/** Logs content statistics.*/
|
||||
/** Logs content statistics. */
|
||||
public void logContent(){
|
||||
//check up ID mapping, make sure it's linear (debug only)
|
||||
for(Seq<Content> arr : contentMap){
|
||||
@@ -82,14 +82,14 @@ public class ContentLoader{
|
||||
Log.debug("-------------------");
|
||||
}
|
||||
|
||||
/** Calls Content#init() on everything. Use only after all modules have been created.*/
|
||||
/** Calls Content#init() on everything. Use only after all modules have been created. */
|
||||
public void init(){
|
||||
initialize(Content::init);
|
||||
if(constants != null) constants.init();
|
||||
Events.fire(new ContentInitEvent());
|
||||
}
|
||||
|
||||
/** Calls Content#load() on everything. Use only after all modules have been created on the client.*/
|
||||
/** Calls Content#loadIcon() and Content#load() on everything. Use only after all modules have been created on the client. */
|
||||
public void load(){
|
||||
initialize(Content::loadIcon);
|
||||
initialize(Content::load);
|
||||
@@ -310,4 +310,4 @@ public class ContentLoader{
|
||||
public Planet planet(String name){
|
||||
return getByName(ContentType.planet, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class Content implements Comparable<Content>{
|
||||
*/
|
||||
public void load(){}
|
||||
|
||||
/** Called right after load(). */
|
||||
/** Called right before load(). */
|
||||
public void loadIcon(){}
|
||||
|
||||
/** @return whether an error occurred during mod loading. */
|
||||
|
||||
@@ -1395,6 +1395,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return self() != other;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this block's config menu is closed
|
||||
*/
|
||||
public void onConfigureClosed(){}
|
||||
|
||||
/** Returns whether this config menu should show when the specified player taps it. */
|
||||
public boolean shouldShowConfigure(Player player){
|
||||
return true;
|
||||
|
||||
@@ -1287,19 +1287,24 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
int endRotation = -1;
|
||||
var start = world.build(startX, startY);
|
||||
var end = world.build(endX, endY);
|
||||
if(diagonal){
|
||||
var start = world.build(startX, startY);
|
||||
var end = world.build(endX, endY);
|
||||
if(block != null && start instanceof ChainedBuilding && end instanceof ChainedBuilding
|
||||
&& block.canReplace(end.block) && block.canReplace(start.block)){
|
||||
points = Placement.upgradeLine(startX, startY, endX, endY);
|
||||
endRotation = end.rotation;
|
||||
}else{
|
||||
points = Placement.pathfindLine(block != null && block.conveyorPlacement, startX, startY, endX, endY);
|
||||
}
|
||||
}else{
|
||||
points = Placement.normalizeLine(startX, startY, endX, endY);
|
||||
}
|
||||
if(points.size > 1 && end instanceof ChainedBuilding){
|
||||
Point2 secondToLast = points.get(points.size - 2);
|
||||
if (!(world.build(secondToLast.x, secondToLast.y) instanceof ChainedBuilding)){
|
||||
endRotation = end.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
if(block != null){
|
||||
block.changePlacementPath(points, rotation);
|
||||
|
||||
@@ -590,6 +590,30 @@ public class SettingsMenuDialog extends BaseDialog{
|
||||
rebuild();
|
||||
}
|
||||
|
||||
public void textPref(String name, String def){
|
||||
list.add(new TextSetting(name, def, null));
|
||||
settings.defaults(name, def);
|
||||
rebuild();
|
||||
}
|
||||
|
||||
public void textPref(String name, String def, Cons<String> changed){
|
||||
list.add(new TextSetting(name, def, changed));
|
||||
settings.defaults(name, def);
|
||||
rebuild();
|
||||
}
|
||||
|
||||
public void areaTextPref(String name, String def){
|
||||
list.add(new AreaTextSetting(name, def, null));
|
||||
settings.defaults(name, def);
|
||||
rebuild();
|
||||
}
|
||||
|
||||
public void areaTextPref(String name, String def, Cons<String> changed){
|
||||
list.add(new AreaTextSetting(name, def, changed));
|
||||
settings.defaults(name, def);
|
||||
rebuild();
|
||||
}
|
||||
|
||||
public void rebuild(){
|
||||
clearChildren();
|
||||
|
||||
@@ -705,6 +729,67 @@ public class SettingsMenuDialog extends BaseDialog{
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
public static class TextSetting extends Setting{
|
||||
String def;
|
||||
Cons<String> changed;
|
||||
|
||||
public TextSetting(String name, String def, Cons<String> changed){
|
||||
super(name);
|
||||
this.def = def;
|
||||
this.changed = changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SettingsTable table){
|
||||
TextField field = new TextField();
|
||||
|
||||
field.update(() -> field.setText(settings.getString(name)));
|
||||
|
||||
field.changed(() -> {
|
||||
settings.put(name, field.getText());
|
||||
if(changed != null){
|
||||
changed.get(field.getText());
|
||||
}
|
||||
});
|
||||
|
||||
Table prefTable = table.table().left().padTop(3f).get();
|
||||
prefTable.add(field);
|
||||
prefTable.label(() -> title);
|
||||
addDesc(prefTable);
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
public static class AreaTextSetting extends TextSetting{
|
||||
String def;
|
||||
Cons<String> changed;
|
||||
|
||||
public AreaTextSetting(String name, String def, Cons<String> changed){
|
||||
super(name, def, changed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SettingsTable table){
|
||||
TextArea area = new TextArea("");
|
||||
area.setPrefRows(5);
|
||||
|
||||
area.update(() -> {
|
||||
area.setText(settings.getString(name));
|
||||
area.setWidth(table.getWidth());
|
||||
});
|
||||
|
||||
area.changed(() -> {
|
||||
settings.put(name, area.getText());
|
||||
if(changed != null){
|
||||
changed.get(area.getText());
|
||||
}
|
||||
});
|
||||
|
||||
addDesc(table.label(() -> title).left().padTop(3f).get());
|
||||
table.row().add(area).left();
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
}
|
||||
|
||||
public void showConfig(Building tile){
|
||||
if(configTile != null) configTile.onConfigureClosed();
|
||||
if(tile.configTapped()){
|
||||
configTile = tile;
|
||||
|
||||
@@ -82,6 +83,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
}
|
||||
|
||||
public void hideConfig(){
|
||||
if(configTile != null) configTile.onConfigureClosed();
|
||||
configTile = null;
|
||||
table.actions(Actions.scaleTo(0f, 1f, 0.06f, Interp.pow3Out), Actions.visible(false));
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ public class Block extends UnlockableContent{
|
||||
return hasItems;
|
||||
}
|
||||
|
||||
/** Returns whether this block can be place on the specified */
|
||||
/** @return whether this block can be placed on the specified tile. */
|
||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||
return canPlaceOn(tile, team);
|
||||
}
|
||||
|
||||
@@ -79,8 +79,6 @@ public class PowerNode extends PowerBlock{
|
||||
});
|
||||
|
||||
config(Point2[].class, (tile, value) -> {
|
||||
tile.power.links.clear();
|
||||
|
||||
IntSeq old = new IntSeq(tile.power.links);
|
||||
|
||||
//clear old
|
||||
|
||||
@@ -24,7 +24,6 @@ public class LiquidConverter extends GenericCrafter{
|
||||
|
||||
ConsumeLiquid cl = consumes.get(ConsumeType.liquid);
|
||||
cl.update(false);
|
||||
outputLiquid.amount = cl.amount;
|
||||
super.init();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user