This commit is contained in:
Anuken
2020-09-19 11:40:11 -04:00
parent b29c0ab401
commit e19e74cdc5
34 changed files with 155 additions and 131 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

After

Width:  |  Height:  |  Size: 121 B

+1 -1
View File
@@ -15,7 +15,7 @@ void main(){
vec2 c = v_texCoords.xy;
vec2 coords = vec2(c.x * u_resolution.x + u_campos.x, c.y * u_resolution.y + u_campos.y);
float btime = u_time / 8000000.0;
float btime = u_time / 7000000.0;
float noise = sin((texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(abs(sin(btime)) * 1.1) * vec2(-0.8, -1.0)).r) / 2.0);
vec4 color = texture2D(u_texture, c);
+4 -6
View File
@@ -22,12 +22,10 @@ void main(){
float noise = (texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(btime * 1.1) * vec2(0.8, -1.0)).r) / 2.0;
vec4 color = texture2D(u_texture, c);
if(color.a > 0.1){
if(noise > 0.6){
color.rgb = S2;
}else if (noise > 0.54){
color.rgb = S1;
}
if(noise > 0.6){
color.rgb = S2;
}else if (noise > 0.54){
color.rgb = S1;
}
gl_FragColor = color;
+1 -1
View File
@@ -20,7 +20,7 @@ void main(){
vec4 color = texture2D(u_texture, c);
if(!(noise > 0.54 && noise < 0.58)){
color.rgb *= 0.6;
color.rgb *= vec3(0.6, 0.6, 0.7);
}
gl_FragColor = color;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 810 B

+28 -28
View File
@@ -1039,6 +1039,13 @@ toxopid-cannon-outline
orig: 206, 220
offset: 0, 0
index: -1
toxopid-leg
rotate: false
xy: 1, 1
size: 150, 72
orig: 150, 72
offset: 0, 0
index: -1
toxopid-outline
rotate: false
xy: 648, 895
@@ -1235,13 +1242,6 @@ toxopid-cell
orig: 152, 124
offset: 0, 0
index: -1
toxopid-leg
rotate: false
xy: 1, 1
size: 150, 72
orig: 150, 72
offset: 0, 0
index: -1
omura-cannon
rotate: false
xy: 847, 1148
@@ -3768,6 +3768,13 @@ arkyid-joint-base
orig: 70, 70
offset: 0, 0
index: -1
arkyid-leg
rotate: false
xy: 621, 605
size: 56, 56
orig: 56, 56
offset: 0, 0
index: -1
arkyid-leg-base
rotate: false
xy: 473, 1982
@@ -3803,6 +3810,13 @@ atrax-joint
orig: 26, 26
offset: 0, 0
index: -1
atrax-leg
rotate: false
xy: 553, 10
size: 36, 26
orig: 36, 26
offset: 0, 0
index: -1
atrax-leg-base
rotate: false
xy: 1687, 1523
@@ -6120,6 +6134,13 @@ spiroct-joint
orig: 32, 32
offset: 0, 0
index: -1
spiroct-leg
rotate: false
xy: 507, 1848
size: 48, 34
orig: 48, 34
offset: 0, 0
index: -1
spiroct-leg-base
rotate: false
xy: 1941, 1650
@@ -6624,13 +6645,6 @@ alpha-cell
orig: 48, 48
offset: 0, 0
index: -1
arkyid-leg
rotate: false
xy: 621, 605
size: 56, 56
orig: 56, 56
offset: 0, 0
index: -1
atrax
rotate: false
xy: 1, 9
@@ -6652,13 +6666,6 @@ atrax-cell
orig: 88, 64
offset: 0, 0
index: -1
atrax-leg
rotate: false
xy: 553, 10
size: 36, 26
orig: 36, 26
offset: 0, 0
index: -1
beta
rotate: false
xy: 141, 6
@@ -6932,13 +6939,6 @@ spiroct-cell
orig: 94, 75
offset: 0, 0
index: -1
spiroct-leg
rotate: false
xy: 507, 1848
size: 48, 34
orig: 48, 34
offset: 0, 0
index: -1
vanguard
rotate: false
xy: 929, 463
Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 KiB

After

Width:  |  Height:  |  Size: 735 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1013 KiB

After

Width:  |  Height:  |  Size: 1013 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 KiB

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 KiB

After

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

+28 -28
View File
@@ -2811,6 +2811,13 @@ arkyid-joint-base
orig: 70, 70
offset: 0, 0
index: -1
arkyid-leg
rotate: false
xy: 1123, 98
size: 56, 56
orig: 56, 56
offset: 0, 0
index: -1
arkyid-leg-base
rotate: false
xy: 3991, 3641
@@ -2874,6 +2881,13 @@ atrax-joint
orig: 26, 26
offset: 0, 0
index: -1
atrax-leg
rotate: false
xy: 356, 3747
size: 36, 26
orig: 36, 26
offset: 0, 0
index: -1
atrax-leg-base
rotate: false
xy: 3113, 2975
@@ -5821,6 +5835,13 @@ spiroct-joint
orig: 32, 32
offset: 0, 0
index: -1
spiroct-leg
rotate: false
xy: 1098, 1191
size: 48, 34
orig: 48, 34
offset: 0, 0
index: -1
spiroct-leg-base
rotate: false
xy: 1871, 3107
@@ -5975,6 +5996,13 @@ toxopid-joint-base
orig: 70, 70
offset: 0, 0
index: -1
toxopid-leg
rotate: false
xy: 3215, 3507
size: 150, 72
orig: 150, 72
offset: 0, 0
index: -1
toxopid-leg-base
rotate: false
xy: 1, 331
@@ -6458,13 +6486,6 @@ arkyid-cell
orig: 128, 128
offset: 0, 0
index: -1
arkyid-leg
rotate: false
xy: 1123, 98
size: 56, 56
orig: 56, 56
offset: 0, 0
index: -1
atrax
rotate: false
xy: 1, 7
@@ -6486,13 +6507,6 @@ atrax-cell
orig: 88, 64
offset: 0, 0
index: -1
atrax-leg
rotate: false
xy: 356, 3747
size: 36, 26
orig: 36, 26
offset: 0, 0
index: -1
beta
rotate: false
xy: 1459, 778
@@ -6878,13 +6892,6 @@ spiroct-cell
orig: 94, 75
offset: 0, 0
index: -1
spiroct-leg
rotate: false
xy: 1098, 1191
size: 48, 34
orig: 48, 34
offset: 0, 0
index: -1
toxopid
rotate: false
xy: 1229, 2530
@@ -6906,13 +6913,6 @@ toxopid-cell
orig: 152, 124
offset: 0, 0
index: -1
toxopid-leg
rotate: false
xy: 3215, 3507
size: 150, 72
orig: 150, 72
offset: 0, 0
index: -1
vanguard
rotate: false
xy: 4011, 3163
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

After

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

@@ -1010,6 +1010,7 @@ public class UnitTypes implements ContentList{
abilities.add(new HealFieldAbility(5f, 60f * 5, 50f));
weapons.add(new Weapon("heal-weapon-mount"){{
top = false;
y = -2.5f;
x = 3.5f;
reload = 30f;
+5 -1
View File
@@ -64,8 +64,12 @@ public class DrawOperation{
if(type == OpType.floor.ordinal()){
tile.setFloor((Floor)content.block(to));
}else if(type == OpType.block.ordinal()){
tile.getLinkedTiles(t -> editor.renderer.updatePoint(t.x, t.y));
Block block = content.block(to);
tile.setBlock(block, tile.team(), tile.build == null ? 0 : tile.build.rotation);
tile.getLinkedTiles(t -> editor.renderer.updatePoint(t.x, t.y));
}else if(type == OpType.rotation.ordinal()){
if(tile.build != null) tile.build.rotation = to;
}else if(type == OpType.team.ordinal()){
@@ -74,7 +78,7 @@ public class DrawOperation{
tile.setOverlayID(to);
}
});
editor.renderer().updatePoint(tile.x, tile.y);
editor.renderer.updatePoint(tile.x, tile.y);
}
@Struct
+11 -7
View File
@@ -46,14 +46,14 @@ public class EditorTile extends Tile{
return;
}
//if(this.block == type && (build == null || build.rotation == rotation)){
// ui.editor.editor.renderer().updatePoint(x, y);
// return;
//}
if(this.block == type && (build == null || build.rotation == rotation)){
update();
return;
}
if(rotation != 0) op(OpType.rotation, (byte)rotation);
if(team() != Team.derelict) op(OpType.team, (byte)team().id);
op(OpType.block, block.id);
if(rotation != 0) op(OpType.rotation, (byte)rotation);
if(team != Team.derelict) op(OpType.team, (byte)team.id);
super.setBlock(type, team, rotation);
}
@@ -87,7 +87,7 @@ public class EditorTile extends Tile{
if(skip()){
super.fireChanged();
}else{
ui.editor.editor.renderer().updatePoint(x, y);
update();
}
}
@@ -121,6 +121,10 @@ public class EditorTile extends Tile{
}
}
private void update(){
ui.editor.editor.renderer.updatePoint(x, y);
}
private boolean skip(){
return state.isGame() || ui.editor.editor.isLoading();
}
+3 -11
View File
@@ -18,10 +18,10 @@ import static mindustry.Vars.*;
public class MapEditor{
public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15, 20};
private final Context context = new Context();
private StringMap tags = new StringMap();
private MapRenderer renderer = new MapRenderer(this);
public StringMap tags = new StringMap();
public MapRenderer renderer = new MapRenderer(this);
private final Context context = new Context();
private OperationStack stack = new OperationStack();
private DrawOperation currentOp;
private boolean loading;
@@ -35,10 +35,6 @@ public class MapEditor{
return loading;
}
public StringMap getTags(){
return tags;
}
public void beginEdit(int width, int height){
reset();
@@ -214,10 +210,6 @@ public class MapEditor{
}
}
public MapRenderer renderer(){
return renderer;
}
public void resize(int width, int height){
clearOp();
+16 -16
View File
@@ -116,9 +116,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
t.button("@editor.export", Icon.upload, () -> createDialog("@editor.export",
"@editor.exportfile", "@editor.exportfile.description", Icon.file,
(Runnable)() -> platform.export(editor.getTags().get("name", "unknown"), mapExtension, file -> MapIO.writeMap(file, editor.createMap(file))),
(Runnable)() -> platform.export(editor.tags.get("name", "unknown"), mapExtension, file -> MapIO.writeMap(file, editor.createMap(file))),
"@editor.exportimage", "@editor.exportimage.description", Icon.fileImage,
(Runnable)() -> platform.export(editor.getTags().get("name", "unknown"), "png", file -> {
(Runnable)() -> platform.export(editor.tags.get("name", "unknown"), "png", file -> {
Pixmap out = MapIO.writeImage(editor.tiles());
file.writePNG(out);
out.dispose();
@@ -129,16 +129,16 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(steam){
menu.cont.button("@editor.publish.workshop", Icon.link, () -> {
Map builtin = maps.all().find(m -> m.name().equals(editor.getTags().get("name", "").trim()));
Map builtin = maps.all().find(m -> m.name().equals(editor.tags.get("name", "").trim()));
if(editor.getTags().containsKey("steamid") && builtin != null && !builtin.custom){
platform.viewListingID(editor.getTags().get("steamid"));
if(editor.tags.containsKey("steamid") && builtin != null && !builtin.custom){
platform.viewListingID(editor.tags.get("steamid"));
return;
}
Map map = save();
if(editor.getTags().containsKey("steamid") && map != null){
if(editor.tags.containsKey("steamid") && map != null){
platform.viewListing(map);
return;
}
@@ -156,7 +156,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
}
platform.publish(map);
}).padTop(-3).size(swidth * 2f + 10, 60f).update(b -> b.setText(editor.getTags().containsKey("steamid") ? editor.getTags().get("author").equals(player.name) ? "@workshop.listing" : "@view.workshop" : "@editor.publish.workshop"));
}).padTop(-3).size(swidth * 2f + 10, 60f).update(b -> b.setText(editor.tags.containsKey("steamid") ? editor.tags.get("author").equals(player.name) ? "@workshop.listing" : "@view.workshop" : "@editor.publish.workshop"));
menu.cont.row();
}
@@ -235,7 +235,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
state.rules = (lastSavedRules == null ? new Rules() : lastSavedRules);
lastSavedRules = null;
saved = false;
editor.renderer().updateAll();
editor.renderer.updateAll();
}
private void playtest(){
@@ -264,10 +264,10 @@ public class MapEditorDialog extends Dialog implements Disposable{
public @Nullable Map save(){
boolean isEditor = state.rules.editor;
state.rules.editor = false;
String name = editor.getTags().get("name", "").trim();
editor.getTags().put("rules", JsonIO.write(state.rules));
editor.getTags().remove("width");
editor.getTags().remove("height");
String name = editor.tags.get("name", "").trim();
editor.tags.put("rules", JsonIO.write(state.rules));
editor.tags.remove("width");
editor.tags.remove("height");
player.clearUnit();
@@ -281,7 +281,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(map != null && !map.custom){
handleSaveBuiltin(map);
}else{
returned = maps.saveMap(editor.getTags());
returned = maps.saveMap(editor.tags);
ui.showInfoFade("@editor.saved");
}
}
@@ -352,7 +352,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
@Override
public void dispose(){
editor.renderer().dispose();
editor.renderer.dispose();
}
public void beginEditMap(Fi file){
@@ -614,12 +614,12 @@ public class MapEditorDialog extends Dialog implements Disposable{
Tile tile = editor.tile(x, y);
if(tile.block().breakable && tile.block() instanceof Boulder){
tile.setBlock(Blocks.air);
editor.renderer().updatePoint(x, y);
editor.renderer.updatePoint(x, y);
}
if(tile.overlay() != Blocks.air && tile.overlay() != Blocks.spawn){
tile.setOverlay(Blocks.air);
editor.renderer().updatePoint(x, y);
editor.renderer.updatePoint(x, y);
}
}
}
@@ -144,7 +144,7 @@ public class MapGenerateDialog extends BaseDialog{
}
//reset undo stack as generation... messes things up
editor.renderer().updateAll();
editor.renderer.updateAll();
editor.clearOp();
}
+3 -3
View File
@@ -29,7 +29,7 @@ public class MapInfoDialog extends BaseDialog{
private void setup(){
cont.clear();
ObjectMap<String, String> tags = editor.getTags();
ObjectMap<String, String> tags = editor.tags;
cont.pane(t -> {
t.add("@editor.mapname").padRight(8).left();
@@ -73,8 +73,8 @@ public class MapInfoDialog extends BaseDialog{
t.row();
t.add("@editor.generation").padRight(8).left();
t.button("@edit", () -> {
generate.show(Vars.maps.readFilters(editor.getTags().get("genfilters", "")),
filters -> editor.getTags().put("genfilters", JsonIO.write(filters)));
generate.show(Vars.maps.readFilters(editor.tags.get("genfilters", "")),
filters -> editor.tags.put("genfilters", JsonIO.write(filters)));
hide();
}).left().width(200f);
+1 -1
View File
@@ -248,7 +248,7 @@ public class MapView extends Element implements GestureListener{
Draw.color(Pal.remove);
Lines.stroke(2f);
Lines.rect(centerx - sclwidth / 2 - 1, centery - sclheight / 2 - 1, sclwidth + 2, sclheight + 2);
editor.renderer().draw(centerx - sclwidth / 2, centery - sclheight / 2, sclwidth, sclheight);
editor.renderer.draw(centerx - sclwidth / 2, centery - sclheight / 2, sclwidth, sclheight);
Draw.reset();
if(grid){
+10
View File
@@ -1,5 +1,6 @@
package mindustry.entities;
import arc.*;
import arc.func.*;
import arc.math.geom.*;
import mindustry.annotations.Annotations.*;
@@ -18,6 +19,15 @@ public class Units{
private static float cdist;
private static boolean boolResult;
@Remote(called = Loc.server)
public static void unitCapDeath(Unit unit){
if(unit != null){
unit.dead = true;
Fx.unitCapKill.at(unit);
Core.app.post(() -> Call.unitDeath(unit.id));
}
}
@Remote(called = Loc.server)
public static void unitDeath(int uid){
Unit unit = Groups.unit.getByID(uid);
@@ -209,6 +209,10 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
//check if over unit cap
if(count() > cap() && !spawnedByCore){
deactivated = true;
if(!dead){
Call.unitCapDeath(self());
}
}else{
teamIndex.updateActiveCount(team, type, 1);
}
@@ -245,6 +249,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
a.update(self());
}
}
}else if(!dead){
Call.unitCapDeath(self());
}
drag = type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f);
@@ -210,8 +210,8 @@ public class FloorRenderer implements Disposable{
tile.block().drawBase(tile);
}else if(floor.cacheLayer == layer && (world.isAccessible(tile.x, tile.y) || tile.block().cacheLayer != CacheLayer.walls || !tile.block().fillsTile)){
floor.drawBase(tile);
}else if(floor.cacheLayer.ordinal() < layer.ordinal() && layer != CacheLayer.walls){
floor.drawNonLayer(tile);
}else if(floor.cacheLayer != layer && layer != CacheLayer.walls){
floor.drawNonLayer(tile, layer);
}
}
}
+3 -3
View File
@@ -146,7 +146,7 @@ public class Map implements Comparable<Map>, Publishable{
public void addSteamID(String id){
tags.put("steamid", id);
ui.editor.editor.getTags().put("steamid", id);
ui.editor.editor.tags.put("steamid", id);
try{
ui.editor.save();
}catch(Exception e){
@@ -159,7 +159,7 @@ public class Map implements Comparable<Map>, Publishable{
public void removeSteamID(){
tags.remove("steamid");
ui.editor.editor.getTags().remove("steamid");
ui.editor.editor.tags.remove("steamid");
try{
ui.editor.save();
}catch(Exception e){
@@ -203,7 +203,7 @@ public class Map implements Comparable<Map>, Publishable{
@Override
public boolean prePublish(){
tags.put("author", player.name);
ui.editor.editor.getTags().put("author", tags.get("author"));
ui.editor.editor.tags.put("author", tags.get("author"));
ui.editor.save();
return true;
@@ -54,7 +54,7 @@ public class MapsDialog extends BaseDialog{
Runnable show = () -> ui.loadAnd(() -> {
hide();
ui.editor.show();
ui.editor.editor.getTags().put("name", text);
ui.editor.editor.tags.put("name", text);
Events.fire(new MapMakeEvent());
});
@@ -67,7 +67,7 @@ public class Floor extends Block{
protected TextureRegion[][] edges;
protected Seq<Block> blenders = new Seq<>();
protected IntSet blended = new IntSet();
protected Bits blended = new Bits(256);
protected TextureRegion edgeRegion;
public Floor(String name){
@@ -170,30 +170,43 @@ public class Floor extends Block{
return drownTime > 0;
}
public void drawNonLayer(Tile tile){
public void drawNonLayer(Tile tile, CacheLayer layer){
Mathf.rand.setSeed(tile.pos());
drawEdges(tile, true);
}
protected void drawEdges(Tile tile){
drawEdges(tile, false);
}
protected void drawEdges(Tile tile, boolean sameLayer){
blenders.clear();
blended.clear();
for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point);
if(other != null && doEdge(other.floor(), sameLayer) && other.floor().edges() != null){
if(blended.add(other.floor().id)){
if(other != null && other.floor().cacheLayer == layer && other.floor().edges() != null){
if(!blended.getAndSet(other.floor().id)){
blenders.add(other.floor());
}
}
}
drawBlended(tile);
}
protected void drawEdges(Tile tile){
blenders.clear();
blended.clear();
for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point);
if(other != null && doEdge(other.floor()) && other.floor().cacheLayer == cacheLayer && other.floor().edges() != null){
if(!blended.getAndSet(other.floor().id)){
blenders.add(other.floor());
}
}
}
drawBlended(tile);
}
protected void drawBlended(Tile tile){
blenders.sort(a -> a.id);
for(Block block : blenders){
@@ -201,23 +214,18 @@ public class Floor extends Block{
Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point);
if(other != null && other.floor() == block){
TextureRegion region = edge((Floor)block, 2 - (point.x + 1), 2 - (point.y + 1));
TextureRegion region = edge((Floor)block, 1 - point.x, 1 - point.y);
Draw.rect(region, tile.worldx(), tile.worldy());
if(!sameLayer && block.cacheLayer.ordinal() > cacheLayer.ordinal()){
Draw.rect(block.variantRegions()[0], tile.worldx() + point.x*tilesize, tile.worldy() + point.y*tilesize);
}
}
}
}
}
//'new' style of edges with shadows instead of colors, not used currently
protected void drawEdgesFlat(Tile tile, boolean sameLayer){
for(int i = 0; i < 4; i++){
Tile other = tile.getNearby(i);
if(other != null && doEdge(other.floor(), sameLayer)){
if(other != null && doEdge(other.floor())){
Color color = other.floor().mapColor;
Draw.color(color.r, color.g, color.b, 1f);
Draw.rect(edgeRegion, tile.worldx(), tile.worldy(), i*90);
@@ -231,8 +239,8 @@ public class Floor extends Block{
return ((Floor)blendGroup).edges;
}
protected boolean doEdge(Floor other, boolean sameLayer){
return (((other.blendGroup.id > blendGroup.id) || edges() == null) && (other.cacheLayer.ordinal() > this.cacheLayer.ordinal() || !sameLayer));
protected boolean doEdge(Floor other){
return other.blendGroup.id > blendGroup.id || edges() == null;
}
TextureRegion edge(Floor block, int x, int y){
@@ -338,6 +338,7 @@ public class Generators{
outliner.get(type.footRegion);
outliner.get(type.legBaseRegion);
outliner.get(type.baseJointRegion);
if(type.constructor.get() instanceof Legsc) outliner.get(type.legRegion);
Image image = ImagePacker.get(type.region);