mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
Implemented slopes
This commit is contained in:
parent
4df0641d67
commit
9abbd8c158
BIN
core/assets-raw/sprites/blocks/extra/block-slope.png
Normal file
BIN
core/assets-raw/sprites/blocks/extra/block-slope.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 B |
@ -162,6 +162,7 @@ text.unknown=Unknown
|
|||||||
text.custom=Custom
|
text.custom=Custom
|
||||||
text.builtin=Built-In
|
text.builtin=Built-In
|
||||||
text.map.delete.confirm=Are you sure you want to delete this map? This action cannot be undone!
|
text.map.delete.confirm=Are you sure you want to delete this map? This action cannot be undone!
|
||||||
|
text.editor.slope=\\
|
||||||
text.editor.openin=Open In Editor
|
text.editor.openin=Open In Editor
|
||||||
text.editor.oregen=Ore Generation
|
text.editor.oregen=Ore Generation
|
||||||
text.editor.oregen.info=Ore Generation:
|
text.editor.oregen.info=Ore Generation:
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 112 KiB |
@ -496,15 +496,14 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
get().table("button", t -> {
|
get().table("button", t -> {
|
||||||
t.margin(0);
|
t.margin(0);
|
||||||
t.addImageButton("icon-arrow-left", 16*2f, () -> {
|
t.addImageButton("icon-arrow-left", 16*2f, () -> editor.setDrawElevation(editor.getDrawElevation() - 1))
|
||||||
editor.setDrawElevation(editor.getDrawElevation() - 1);
|
.disabled(b -> editor.getDrawElevation() <= -1).size(size);
|
||||||
}).disabled(b -> editor.getDrawElevation() <= 0).size(size);
|
|
||||||
|
|
||||||
t.label(() -> editor.getDrawElevation() + "").size(size).get().setAlignment(Align.center, Align.center);
|
t.label(() -> editor.getDrawElevation() == -1 ? "$text.editor.slope" : (editor.getDrawElevation() + ""))
|
||||||
|
.size(size).get().setAlignment(Align.center, Align.center);
|
||||||
|
|
||||||
t.addImageButton("icon-arrow-right", 16*2f, () -> {
|
t.addImageButton("icon-arrow-right", 16*2f, () -> editor.setDrawElevation(editor.getDrawElevation() + 1))
|
||||||
editor.setDrawElevation(editor.getDrawElevation() + 1);
|
.disabled(b -> editor.getDrawElevation() >= 127).size(size);
|
||||||
}).disabled(b -> editor.getDrawElevation() >= 127).size(size);
|
|
||||||
}).colspan(3).height(size).padTop(-5).width(size*3f);
|
}).colspan(3).height(size).padTop(-5).width(size*3f);
|
||||||
|
|
||||||
}}.left().growY().end();
|
}}.left().growY().end();
|
||||||
|
@ -71,6 +71,7 @@ public class MapRenderer implements Disposable{
|
|||||||
add("clear", packer);
|
add("clear", packer);
|
||||||
add("block-border", packer);
|
add("block-border", packer);
|
||||||
add("block-elevation", packer);
|
add("block-elevation", packer);
|
||||||
|
add("block-slope", packer);
|
||||||
|
|
||||||
if(packer.getPages().size > 1){
|
if(packer.getPages().size > 1){
|
||||||
throw new IllegalArgumentException("Pixmap packer may not have more than 1 page!");
|
throw new IllegalArgumentException("Pixmap packer may not have more than 1 page!");
|
||||||
@ -213,6 +214,8 @@ public class MapRenderer implements Disposable{
|
|||||||
}else if(elev > 0 && check){
|
}else if(elev > 0 && check){
|
||||||
mesh.setColor(tmpColor.fromHsv((360f * elev/127f * 4f) % 360f, 0.5f + (elev / 4f) % 0.5f, 1f));
|
mesh.setColor(tmpColor.fromHsv((360f * elev/127f * 4f) % 360f, 0.5f + (elev / 4f) % 0.5f, 1f));
|
||||||
region = regions.get("block-elevation");
|
region = regions.get("block-elevation");
|
||||||
|
}else if(elev == -1){
|
||||||
|
region = regions.get("block-slope");
|
||||||
}else{
|
}else{
|
||||||
region = regions.get("clear");
|
region = regions.get("clear");
|
||||||
}
|
}
|
||||||
|
@ -189,6 +189,11 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
if(tile.block() != Blocks.air){
|
if(tile.block() != Blocks.air){
|
||||||
onLiquid = false;
|
onLiquid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//on slope
|
||||||
|
if(tile.elevation == -1){
|
||||||
|
velocity.scl(0.7f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(onLiquid && velocity.len() > 0.4f && Timers.get(this, "flooreffect", 14 - (velocity.len() * floor.speedMultiplier)*2f)){
|
if(onLiquid && velocity.len() > 0.4f && Timers.get(this, "flooreffect", 14 - (velocity.len() * floor.speedMultiplier)*2f)){
|
||||||
|
@ -5,18 +5,19 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
|
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.type.Recipe;
|
import io.anuke.mindustry.type.Recipe;
|
||||||
import io.anuke.mindustry.world.blocks.Floor;
|
import io.anuke.mindustry.world.blocks.Floor;
|
||||||
import io.anuke.mindustry.world.blocks.modules.InventoryModule;
|
import io.anuke.mindustry.world.blocks.modules.InventoryModule;
|
||||||
import io.anuke.mindustry.world.blocks.modules.LiquidModule;
|
import io.anuke.mindustry.world.blocks.modules.LiquidModule;
|
||||||
import io.anuke.mindustry.world.blocks.modules.PowerModule;
|
import io.anuke.mindustry.world.blocks.modules.PowerModule;
|
||||||
|
import io.anuke.ucore.entities.trait.PosTrait;
|
||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.util.Bits;
|
import io.anuke.ucore.util.Bits;
|
||||||
import io.anuke.ucore.entities.trait.PosTrait;
|
|
||||||
import io.anuke.ucore.util.Geometry;
|
import io.anuke.ucore.util.Geometry;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
@ -325,21 +326,29 @@ public class Tile implements PosTrait, TargetTrait {
|
|||||||
//check for bitmasking cliffs
|
//check for bitmasking cliffs
|
||||||
for(int i = 0; i < 4; i ++){
|
for(int i = 0; i < 4; i ++){
|
||||||
GridPoint2 pc = Geometry.d4[i];
|
GridPoint2 pc = Geometry.d4[i];
|
||||||
|
GridPoint2 pcprev = Geometry.d4[Mathf.mod(i - 1, 4)];
|
||||||
|
GridPoint2 pcnext = Geometry.d4[(i + 1) % 4];
|
||||||
GridPoint2 pe = Geometry.d8edge[i];
|
GridPoint2 pe = Geometry.d8edge[i];
|
||||||
|
|
||||||
Tile tc = world.tile(x + pc.x, y + pc.y);
|
Tile tc = world.tile(x + pc.x, y + pc.y);
|
||||||
|
Tile tprev = world.tile(x + pcprev.x, y + pcprev.y);
|
||||||
|
Tile tnext = world.tile(x + pcnext.x, y + pcnext.y);
|
||||||
Tile te = world.tile(x + pe.x, y + pe.y);
|
Tile te = world.tile(x + pe.x, y + pe.y);
|
||||||
Tile tex = world.tile(x, y + pe.y);
|
Tile tex = world.tile(x, y + pe.y);
|
||||||
Tile tey = world.tile(x + pe.x, y);
|
Tile tey = world.tile(x + pe.x, y);
|
||||||
|
|
||||||
//check for cardinal direction elevation changes and bitmask that
|
//check for cardinal direction elevation changes and bitmask that
|
||||||
if(tc != null && tc.elevation < elevation){
|
if(tc != null && tprev != null && tnext != null && ((tc.elevation < elevation && tc.elevation != -1))){
|
||||||
cliffs |= (1 << (i*2));
|
cliffs |= (1 << (i*2));
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for corner bitmasking
|
//00S
|
||||||
if(te != null && tex != null && tey != null && te.elevation < elevation && tex.elevation < elevation && tey.elevation < elevation){
|
//0X0
|
||||||
cliffs |= (1 << (i*2 + 1));
|
//010
|
||||||
|
|
||||||
|
//check for corner bitmasking: doesn't even get checked so it doesn't matter
|
||||||
|
if(te != null && tex != null && tey != null && te.elevation == -1 && elevation > 0){
|
||||||
|
cliffs |= (1 << (((i+1)%4)*2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(occluded){
|
if(occluded){
|
||||||
|
Loading…
Reference in New Issue
Block a user