1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

Fixes to shader code, collapsible placement menu

This commit is contained in:
Anuken 2017-12-26 12:57:56 -05:00
parent d44926d4df
commit 40bb499eeb
12 changed files with 30 additions and 19 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
##Packr, build stuff
/core/assets/mindustry-saves/
/core/assets/mindustry-maps/
/deploy/
/desktop/packr-out/
/desktop/packr-export/

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.anuke.mindustry"
android:versionCode="47"
android:versionName="3.2" >
android:versionCode="48"
android:versionName="3.2.1" >
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

View File

@ -7,6 +7,7 @@ import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Shader;
import io.anuke.ucore.scene.ui.layout.Unit;
import io.anuke.ucore.util.Tmp;
public class Shaders{
@ -45,8 +46,9 @@ public class Shaders{
shader.setUniform3fv("u_hits[0]", hits.items, 0, Math.min(hits.size, MAX_HITS));
shader.setUniformi("u_hitamount", Math.min(hits.size, MAX_HITS)/3);
}
shader.setUniformf("u_dp", Unit.dp.scl(1f));
shader.setUniformf("u_color", color);
shader.setUniformf("u_time", Timers.time());
shader.setUniformf("u_time", Timers.time() / Unit.dp.scl(1f));
shader.setUniformf("u_scaling", scaling);
shader.setUniformf("u_offset", Tmp.v1.set(Core.camera.position.x, Core.camera.position.y));
shader.setUniformf("u_texsize", Tmp.v1.set(region.getTexture().getWidth() / scale,

View File

@ -140,6 +140,7 @@ public class MapView extends Element implements GestureListener{
}
if(updated){
if(op == null) op = new DrawOperation(editor.pixmap());
Pixmap next = Pixmaps.copy(editor.pixmap());
op.add(current, next);
current = next;

View File

@ -13,6 +13,7 @@ import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.resource.Recipe;
import io.anuke.mindustry.resource.Section;
import io.anuke.mindustry.ui.FloatingDialog;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.scene.builders.button;
@ -35,6 +36,8 @@ public class BlocksFragment implements Fragment{
abottom();
aright();
visible(() -> !GameState.is(State.menu));
new table(){{
new table("button") {{
@ -133,8 +136,6 @@ public class BlocksFragment implements Fragment{
get().marginLeft(0f);
get().marginRight(0f);
end();
}}.right().bottom().uniformX();
@ -142,10 +143,12 @@ public class BlocksFragment implements Fragment{
}}.end();
//new imagebutton("icon-arrow-right", 10*2, () -> {
// shown = !shown;
//}).uniformY().fillY();
row();
new imagebutton("icon-arrow-down", 10*2, () -> {
shown = !shown;
}).padBottom(-5).uniformX().fillX()
.update(i -> i.getStyle().imageUp = Core.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up"));
}}.end();
}

View File

@ -257,8 +257,8 @@ public class ProductionBlocks{
formalName = "RTG generator";
generateItem = Item.uranium;
powerCapacity = 40f;
powerOutput = 0.05f;
itemDuration = 250f;
powerOutput = 0.04f;
itemDuration = 240f;
description = "Generates power from uranium.";
fullDescription = "Generates small amounts of power from the radioactive decay of uranium. Outputs power as lasers to its 4 sides.";
}

View File

@ -92,7 +92,7 @@ public class WeaponBlocks{
bullet = BulletType.flame;
ammo = Item.coal;
health = 90;
fullDescription = "Advanced close-range turret. Uses coal for ammo. Has very low range, but very high damage and damage. "
fullDescription = "Advanced close-range turret. Uses coal for ammo. Has very low range, but very high damage. "
+ "Good for close quarters. Recommended to be used behind walls.";
}
},

View File

@ -17,9 +17,9 @@ import io.anuke.ucore.util.Strings;
public class ShieldBlock extends PowerBlock{
public float shieldRadius = 40f;
public float powerDrain = 0.005f;
public float powerPerDamage = 0.2f;
public float powerPerDamage = 0.13f;
public float maxRadius = 40f;
public float radiusScale = 160f;
public float radiusScale = 200f;
public ShieldBlock(String name) {
super(name);

View File

@ -24,6 +24,9 @@ public class Conveyor extends Block{
private static ItemPos pos1 = new ItemPos();
private static ItemPos pos2 = new ItemPos();
private static IntArray removals = new IntArray();
private static final float itemSpace = 0.135f;
private static final float offsetScl = 128f*3f;
private static final float itemSize = 4f;
public float speed = 0.02f;
@ -68,7 +71,7 @@ public class Conveyor extends Block{
Draw.rect("icon-" + pos.item.name(),
tile.x * tilesize + Tmp.v1.x * pos.y + Tmp.v2.x,
tile.y * tilesize + Tmp.v1.y * pos.y + Tmp.v2.y, 4, 4);
tile.y * tilesize + Tmp.v1.y * pos.y + Tmp.v2.y, itemSize, itemSize);
}
}
@ -85,13 +88,13 @@ public class Conveyor extends Block{
ItemPos pos = pos1.set(value);
boolean canmove = i == entity.convey.size - 1 ||
!(pos2.set(entity.convey.get(i + 1)).y - pos.y < 0.135 * Timers.delta());
!(pos2.set(entity.convey.get(i + 1)).y - pos.y < itemSpace * Timers.delta());
if(canmove){
pos.y += Math.max(speed * Timers.delta(), 1f/252f); //TODO fix precision issues?
pos.x = Mathf.lerpDelta(pos.x, 0, 0.06f);
}else{
pos.x = Mathf.lerpDelta(pos.x, pos.seed/128f/3f, 0.1f);
pos.x = Mathf.lerpDelta(pos.x, pos.seed/offsetScl, 0.1f);
}
pos.y = Mathf.clamp(pos.y);

View File

@ -25,14 +25,14 @@ public class NuclearReactor extends LiquidItemPowerGenerator{
protected Color coolColor = new Color(1, 1, 1, 0f);
protected Color hotColor = Color.valueOf("ff9575a3");
protected int fuelUseTime = 120; //time to consume 1 fuel
protected float powerMultiplier = 0.3f; //power per frame, depends on full capacity
protected int fuelUseTime = 140; //time to consume 1 fuel
protected float powerMultiplier = 0.4f; //power per frame, depends on full capacity
protected float heating = 0.007f; //heating per frame
protected float coolantPower = 0.007f; //how much heat decreases per coolant unit
protected float smokeThreshold = 0.3f; //threshold at which block starts smoking
protected int explosionRadius = 19;
protected int explosionDamage = 135;
protected float flashThreshold = 0.46f;
protected float flashThreshold = 0.46f; //heat threshold at which the lights start flashing
public NuclearReactor(String name) {
super(name);