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

View File

@@ -15,7 +15,7 @@ void main(){
vec2 c = v_texCoords.xy; vec2 c = v_texCoords.xy;
vec2 coords = vec2(c.x * u_resolution.x + u_campos.x, c.y * u_resolution.y + u_campos.y); 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); 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); vec4 color = texture2D(u_texture, c);

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; 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); vec4 color = texture2D(u_texture, c);
if(color.a > 0.1){ if(noise > 0.6){
if(noise > 0.6){ color.rgb = S2;
color.rgb = S2; }else if (noise > 0.54){
}else if (noise > 0.54){ color.rgb = S1;
color.rgb = S1;
}
} }
gl_FragColor = color; gl_FragColor = color;

View File

@@ -20,7 +20,7 @@ void main(){
vec4 color = texture2D(u_texture, c); vec4 color = texture2D(u_texture, c);
if(!(noise > 0.54 && noise < 0.58)){ if(!(noise > 0.54 && noise < 0.58)){
color.rgb *= 0.6; color.rgb *= vec3(0.6, 0.6, 0.7);
} }
gl_FragColor = color; gl_FragColor = color;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 810 B

View File

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

View File

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

View File

@@ -1010,6 +1010,7 @@ public class UnitTypes implements ContentList{
abilities.add(new HealFieldAbility(5f, 60f * 5, 50f)); abilities.add(new HealFieldAbility(5f, 60f * 5, 50f));
weapons.add(new Weapon("heal-weapon-mount"){{ weapons.add(new Weapon("heal-weapon-mount"){{
top = false;
y = -2.5f; y = -2.5f;
x = 3.5f; x = 3.5f;
reload = 30f; reload = 30f;

View File

@@ -64,8 +64,12 @@ public class DrawOperation{
if(type == OpType.floor.ordinal()){ if(type == OpType.floor.ordinal()){
tile.setFloor((Floor)content.block(to)); tile.setFloor((Floor)content.block(to));
}else if(type == OpType.block.ordinal()){ }else if(type == OpType.block.ordinal()){
tile.getLinkedTiles(t -> editor.renderer.updatePoint(t.x, t.y));
Block block = content.block(to); Block block = content.block(to);
tile.setBlock(block, tile.team(), tile.build == null ? 0 : tile.build.rotation); 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()){ }else if(type == OpType.rotation.ordinal()){
if(tile.build != null) tile.build.rotation = to; if(tile.build != null) tile.build.rotation = to;
}else if(type == OpType.team.ordinal()){ }else if(type == OpType.team.ordinal()){
@@ -74,7 +78,7 @@ public class DrawOperation{
tile.setOverlayID(to); tile.setOverlayID(to);
} }
}); });
editor.renderer().updatePoint(tile.x, tile.y); editor.renderer.updatePoint(tile.x, tile.y);
} }
@Struct @Struct

View File

@@ -46,14 +46,14 @@ public class EditorTile extends Tile{
return; return;
} }
//if(this.block == type && (build == null || build.rotation == rotation)){ if(this.block == type && (build == null || build.rotation == rotation)){
// ui.editor.editor.renderer().updatePoint(x, y); update();
// return; return;
//} }
if(rotation != 0) op(OpType.rotation, (byte)rotation);
if(team() != Team.derelict) op(OpType.team, (byte)team().id);
op(OpType.block, block.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); super.setBlock(type, team, rotation);
} }
@@ -87,7 +87,7 @@ public class EditorTile extends Tile{
if(skip()){ if(skip()){
super.fireChanged(); super.fireChanged();
}else{ }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(){ private boolean skip(){
return state.isGame() || ui.editor.editor.isLoading(); return state.isGame() || ui.editor.editor.isLoading();
} }

View File

@@ -18,10 +18,10 @@ import static mindustry.Vars.*;
public class MapEditor{ public class MapEditor{
public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15, 20}; public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15, 20};
private final Context context = new Context(); public StringMap tags = new StringMap();
private StringMap tags = new StringMap(); public MapRenderer renderer = new MapRenderer(this);
private MapRenderer renderer = new MapRenderer(this);
private final Context context = new Context();
private OperationStack stack = new OperationStack(); private OperationStack stack = new OperationStack();
private DrawOperation currentOp; private DrawOperation currentOp;
private boolean loading; private boolean loading;
@@ -35,10 +35,6 @@ public class MapEditor{
return loading; return loading;
} }
public StringMap getTags(){
return tags;
}
public void beginEdit(int width, int height){ public void beginEdit(int width, int height){
reset(); reset();
@@ -214,10 +210,6 @@ public class MapEditor{
} }
} }
public MapRenderer renderer(){
return renderer;
}
public void resize(int width, int height){ public void resize(int width, int height){
clearOp(); clearOp();

View File

@@ -116,9 +116,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
t.button("@editor.export", Icon.upload, () -> createDialog("@editor.export", t.button("@editor.export", Icon.upload, () -> createDialog("@editor.export",
"@editor.exportfile", "@editor.exportfile.description", Icon.file, "@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, "@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()); Pixmap out = MapIO.writeImage(editor.tiles());
file.writePNG(out); file.writePNG(out);
out.dispose(); out.dispose();
@@ -129,16 +129,16 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(steam){ if(steam){
menu.cont.button("@editor.publish.workshop", Icon.link, () -> { 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){ if(editor.tags.containsKey("steamid") && builtin != null && !builtin.custom){
platform.viewListingID(editor.getTags().get("steamid")); platform.viewListingID(editor.tags.get("steamid"));
return; return;
} }
Map map = save(); Map map = save();
if(editor.getTags().containsKey("steamid") && map != null){ if(editor.tags.containsKey("steamid") && map != null){
platform.viewListing(map); platform.viewListing(map);
return; return;
} }
@@ -156,7 +156,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
} }
platform.publish(map); 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(); menu.cont.row();
} }
@@ -235,7 +235,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
state.rules = (lastSavedRules == null ? new Rules() : lastSavedRules); state.rules = (lastSavedRules == null ? new Rules() : lastSavedRules);
lastSavedRules = null; lastSavedRules = null;
saved = false; saved = false;
editor.renderer().updateAll(); editor.renderer.updateAll();
} }
private void playtest(){ private void playtest(){
@@ -264,10 +264,10 @@ public class MapEditorDialog extends Dialog implements Disposable{
public @Nullable Map save(){ public @Nullable Map save(){
boolean isEditor = state.rules.editor; boolean isEditor = state.rules.editor;
state.rules.editor = false; state.rules.editor = false;
String name = editor.getTags().get("name", "").trim(); String name = editor.tags.get("name", "").trim();
editor.getTags().put("rules", JsonIO.write(state.rules)); editor.tags.put("rules", JsonIO.write(state.rules));
editor.getTags().remove("width"); editor.tags.remove("width");
editor.getTags().remove("height"); editor.tags.remove("height");
player.clearUnit(); player.clearUnit();
@@ -281,7 +281,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(map != null && !map.custom){ if(map != null && !map.custom){
handleSaveBuiltin(map); handleSaveBuiltin(map);
}else{ }else{
returned = maps.saveMap(editor.getTags()); returned = maps.saveMap(editor.tags);
ui.showInfoFade("@editor.saved"); ui.showInfoFade("@editor.saved");
} }
} }
@@ -352,7 +352,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
@Override @Override
public void dispose(){ public void dispose(){
editor.renderer().dispose(); editor.renderer.dispose();
} }
public void beginEditMap(Fi file){ public void beginEditMap(Fi file){
@@ -614,12 +614,12 @@ public class MapEditorDialog extends Dialog implements Disposable{
Tile tile = editor.tile(x, y); Tile tile = editor.tile(x, y);
if(tile.block().breakable && tile.block() instanceof Boulder){ if(tile.block().breakable && tile.block() instanceof Boulder){
tile.setBlock(Blocks.air); tile.setBlock(Blocks.air);
editor.renderer().updatePoint(x, y); editor.renderer.updatePoint(x, y);
} }
if(tile.overlay() != Blocks.air && tile.overlay() != Blocks.spawn){ if(tile.overlay() != Blocks.air && tile.overlay() != Blocks.spawn){
tile.setOverlay(Blocks.air); tile.setOverlay(Blocks.air);
editor.renderer().updatePoint(x, y); editor.renderer.updatePoint(x, y);
} }
} }
} }

View File

@@ -144,7 +144,7 @@ public class MapGenerateDialog extends BaseDialog{
} }
//reset undo stack as generation... messes things up //reset undo stack as generation... messes things up
editor.renderer().updateAll(); editor.renderer.updateAll();
editor.clearOp(); editor.clearOp();
} }

View File

@@ -29,7 +29,7 @@ public class MapInfoDialog extends BaseDialog{
private void setup(){ private void setup(){
cont.clear(); cont.clear();
ObjectMap<String, String> tags = editor.getTags(); ObjectMap<String, String> tags = editor.tags;
cont.pane(t -> { cont.pane(t -> {
t.add("@editor.mapname").padRight(8).left(); t.add("@editor.mapname").padRight(8).left();
@@ -73,8 +73,8 @@ public class MapInfoDialog extends BaseDialog{
t.row(); t.row();
t.add("@editor.generation").padRight(8).left(); t.add("@editor.generation").padRight(8).left();
t.button("@edit", () -> { t.button("@edit", () -> {
generate.show(Vars.maps.readFilters(editor.getTags().get("genfilters", "")), generate.show(Vars.maps.readFilters(editor.tags.get("genfilters", "")),
filters -> editor.getTags().put("genfilters", JsonIO.write(filters))); filters -> editor.tags.put("genfilters", JsonIO.write(filters)));
hide(); hide();
}).left().width(200f); }).left().width(200f);

View File

@@ -248,7 +248,7 @@ public class MapView extends Element implements GestureListener{
Draw.color(Pal.remove); Draw.color(Pal.remove);
Lines.stroke(2f); Lines.stroke(2f);
Lines.rect(centerx - sclwidth / 2 - 1, centery - sclheight / 2 - 1, sclwidth + 2, sclheight + 2); 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(); Draw.reset();
if(grid){ if(grid){

View File

@@ -1,5 +1,6 @@
package mindustry.entities; package mindustry.entities;
import arc.*;
import arc.func.*; import arc.func.*;
import arc.math.geom.*; import arc.math.geom.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
@@ -18,6 +19,15 @@ public class Units{
private static float cdist; private static float cdist;
private static boolean boolResult; 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) @Remote(called = Loc.server)
public static void unitDeath(int uid){ public static void unitDeath(int uid){
Unit unit = Groups.unit.getByID(uid); Unit unit = Groups.unit.getByID(uid);

View File

@@ -209,6 +209,10 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
//check if over unit cap //check if over unit cap
if(count() > cap() && !spawnedByCore){ if(count() > cap() && !spawnedByCore){
deactivated = true; deactivated = true;
if(!dead){
Call.unitCapDeath(self());
}
}else{ }else{
teamIndex.updateActiveCount(team, type, 1); teamIndex.updateActiveCount(team, type, 1);
} }
@@ -245,6 +249,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
a.update(self()); a.update(self());
} }
} }
}else if(!dead){
Call.unitCapDeath(self());
} }
drag = type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f); drag = type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f);

View File

@@ -210,8 +210,8 @@ public class FloorRenderer implements Disposable{
tile.block().drawBase(tile); tile.block().drawBase(tile);
}else if(floor.cacheLayer == layer && (world.isAccessible(tile.x, tile.y) || tile.block().cacheLayer != CacheLayer.walls || !tile.block().fillsTile)){ }else if(floor.cacheLayer == layer && (world.isAccessible(tile.x, tile.y) || tile.block().cacheLayer != CacheLayer.walls || !tile.block().fillsTile)){
floor.drawBase(tile); floor.drawBase(tile);
}else if(floor.cacheLayer.ordinal() < layer.ordinal() && layer != CacheLayer.walls){ }else if(floor.cacheLayer != layer && layer != CacheLayer.walls){
floor.drawNonLayer(tile); floor.drawNonLayer(tile, layer);
} }
} }
} }

View File

@@ -146,7 +146,7 @@ public class Map implements Comparable<Map>, Publishable{
public void addSteamID(String id){ public void addSteamID(String id){
tags.put("steamid", id); tags.put("steamid", id);
ui.editor.editor.getTags().put("steamid", id); ui.editor.editor.tags.put("steamid", id);
try{ try{
ui.editor.save(); ui.editor.save();
}catch(Exception e){ }catch(Exception e){
@@ -159,7 +159,7 @@ public class Map implements Comparable<Map>, Publishable{
public void removeSteamID(){ public void removeSteamID(){
tags.remove("steamid"); tags.remove("steamid");
ui.editor.editor.getTags().remove("steamid"); ui.editor.editor.tags.remove("steamid");
try{ try{
ui.editor.save(); ui.editor.save();
}catch(Exception e){ }catch(Exception e){
@@ -203,7 +203,7 @@ public class Map implements Comparable<Map>, Publishable{
@Override @Override
public boolean prePublish(){ public boolean prePublish(){
tags.put("author", player.name); 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(); ui.editor.save();
return true; return true;

View File

@@ -54,7 +54,7 @@ public class MapsDialog extends BaseDialog{
Runnable show = () -> ui.loadAnd(() -> { Runnable show = () -> ui.loadAnd(() -> {
hide(); hide();
ui.editor.show(); ui.editor.show();
ui.editor.editor.getTags().put("name", text); ui.editor.editor.tags.put("name", text);
Events.fire(new MapMakeEvent()); Events.fire(new MapMakeEvent());
}); });

View File

@@ -67,7 +67,7 @@ public class Floor extends Block{
protected TextureRegion[][] edges; protected TextureRegion[][] edges;
protected Seq<Block> blenders = new Seq<>(); protected Seq<Block> blenders = new Seq<>();
protected IntSet blended = new IntSet(); protected Bits blended = new Bits(256);
protected TextureRegion edgeRegion; protected TextureRegion edgeRegion;
public Floor(String name){ public Floor(String name){
@@ -170,30 +170,43 @@ public class Floor extends Block{
return drownTime > 0; return drownTime > 0;
} }
public void drawNonLayer(Tile tile){ public void drawNonLayer(Tile tile, CacheLayer layer){
Mathf.rand.setSeed(tile.pos()); 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(); blenders.clear();
blended.clear(); blended.clear();
for(int i = 0; i < 8; i++){ for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i]; Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point); Tile other = tile.getNearby(point);
if(other != null && doEdge(other.floor(), sameLayer) && other.floor().edges() != null){ if(other != null && other.floor().cacheLayer == layer && other.floor().edges() != null){
if(blended.add(other.floor().id)){ if(!blended.getAndSet(other.floor().id)){
blenders.add(other.floor()); 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); blenders.sort(a -> a.id);
for(Block block : blenders){ for(Block block : blenders){
@@ -201,23 +214,18 @@ public class Floor extends Block{
Point2 point = Geometry.d8[i]; Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point); Tile other = tile.getNearby(point);
if(other != null && other.floor() == block){ 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()); 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 //'new' style of edges with shadows instead of colors, not used currently
protected void drawEdgesFlat(Tile tile, boolean sameLayer){ protected void drawEdgesFlat(Tile tile, boolean sameLayer){
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
Tile other = tile.getNearby(i); Tile other = tile.getNearby(i);
if(other != null && doEdge(other.floor(), sameLayer)){ if(other != null && doEdge(other.floor())){
Color color = other.floor().mapColor; Color color = other.floor().mapColor;
Draw.color(color.r, color.g, color.b, 1f); Draw.color(color.r, color.g, color.b, 1f);
Draw.rect(edgeRegion, tile.worldx(), tile.worldy(), i*90); Draw.rect(edgeRegion, tile.worldx(), tile.worldy(), i*90);
@@ -231,8 +239,8 @@ public class Floor extends Block{
return ((Floor)blendGroup).edges; return ((Floor)blendGroup).edges;
} }
protected boolean doEdge(Floor other, boolean sameLayer){ protected boolean doEdge(Floor other){
return (((other.blendGroup.id > blendGroup.id) || edges() == null) && (other.cacheLayer.ordinal() > this.cacheLayer.ordinal() || !sameLayer)); return other.blendGroup.id > blendGroup.id || edges() == null;
} }
TextureRegion edge(Floor block, int x, int y){ TextureRegion edge(Floor block, int x, int y){

View File

@@ -338,6 +338,7 @@ public class Generators{
outliner.get(type.footRegion); outliner.get(type.footRegion);
outliner.get(type.legBaseRegion); outliner.get(type.legBaseRegion);
outliner.get(type.baseJointRegion); outliner.get(type.baseJointRegion);
if(type.constructor.get() instanceof Legsc) outliner.get(type.legRegion);
Image image = ImagePacker.get(type.region); Image image = ImagePacker.get(type.region);