diff --git a/core/assets-raw/sprites/blocks/door-open.png b/core/assets-raw/sprites/blocks/door-open.png new file mode 100644 index 0000000000..dafd8a137b Binary files /dev/null and b/core/assets-raw/sprites/blocks/door-open.png differ diff --git a/core/assets-raw/sprites/blocks/door.png b/core/assets-raw/sprites/blocks/door.png new file mode 100644 index 0000000000..bcbe7a5d03 Binary files /dev/null and b/core/assets-raw/sprites/blocks/door.png differ diff --git a/core/assets-raw/sprites/ui/button-map-over.9.png b/core/assets-raw/sprites/ui/button-map-over.9.png index d16031fafa..afd0581f73 100644 Binary files a/core/assets-raw/sprites/ui/button-map-over.9.png and b/core/assets-raw/sprites/ui/button-map-over.9.png differ diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index ffc2d4d1c5..15bdfbe666 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -277,6 +277,20 @@ blocks/dirtedge orig: 12, 12 offset: 0, 0 index: -1 +blocks/door + rotate: false + xy: 312, 130 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +blocks/door-open + rotate: false + xy: 312, 120 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 blocks/doubleturret rotate: false xy: 370, 220 @@ -286,7 +300,7 @@ blocks/doubleturret index: -1 blocks/duriumwall rotate: false - xy: 312, 130 + xy: 314, 110 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -300,7 +314,7 @@ blocks/duriumwall-large index: -1 blocks/duriumwall-large-icon rotate: false - xy: 312, 120 + xy: 314, 100 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -314,70 +328,70 @@ blocks/flameturret index: -1 blocks/fluxpump rotate: false - xy: 314, 100 + xy: 314, 80 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass1 rotate: false - xy: 314, 90 + xy: 314, 70 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass2 rotate: false - xy: 314, 80 + xy: 314, 60 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass3 rotate: false - xy: 314, 70 + xy: 314, 50 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock-edge-0 rotate: false - xy: 314, 40 + xy: 325, 209 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock-edge-1 rotate: false - xy: 314, 30 + xy: 325, 199 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock-edge-2 rotate: false - xy: 325, 209 + xy: 325, 189 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock-edge-3 rotate: false - xy: 325, 199 + xy: 335, 211 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock1 rotate: false - xy: 314, 60 + xy: 314, 40 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock2 rotate: false - xy: 314, 50 + xy: 314, 30 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -391,21 +405,21 @@ blocks/grassedge index: -1 blocks/ice1 rotate: false - xy: 325, 189 + xy: 345, 211 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ice2 rotate: false - xy: 335, 211 + xy: 335, 201 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ice3 rotate: false - xy: 345, 211 + xy: 335, 191 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -419,84 +433,84 @@ blocks/iceedge index: -1 blocks/icerock1 rotate: false - xy: 335, 201 + xy: 345, 201 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerock2 rotate: false - xy: 335, 191 + xy: 345, 191 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerockshadow1 rotate: false - xy: 345, 201 + xy: 355, 210 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow1 rotate: false - xy: 345, 201 + xy: 355, 210 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerockshadow2 rotate: false - xy: 345, 191 + xy: 365, 210 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow2 rotate: false - xy: 345, 191 + xy: 365, 210 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron1 rotate: false - xy: 325, 163 + xy: 322, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron2 rotate: false - xy: 325, 153 + xy: 322, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron3 rotate: false - xy: 322, 143 + xy: 322, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/irondrill rotate: false - xy: 322, 133 + xy: 324, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ironwall rotate: false - xy: 322, 123 + xy: 324, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/junction rotate: false - xy: 324, 113 + xy: 324, 93 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -510,7 +524,7 @@ blocks/laserturret index: -1 blocks/lava rotate: false - xy: 324, 103 + xy: 324, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -524,28 +538,28 @@ blocks/lavaedge index: -1 blocks/lavasmelter rotate: false - xy: 324, 93 + xy: 324, 73 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquiditemjunction rotate: false - xy: 324, 83 + xy: 324, 63 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidjunction rotate: false - xy: 324, 73 + xy: 324, 53 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidrouter rotate: false - xy: 324, 63 + xy: 324, 43 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -573,14 +587,14 @@ blocks/mortarturret index: -1 blocks/mossblock rotate: false - xy: 324, 43 + xy: 375, 206 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/mossstone rotate: false - xy: 324, 43 + xy: 375, 206 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -601,7 +615,7 @@ blocks/nuclearreactor-center index: -1 blocks/nuclearreactor-icon rotate: false - xy: 375, 206 + xy: 385, 206 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -622,7 +636,7 @@ blocks/nuclearreactor-small index: -1 blocks/oil rotate: false - xy: 375, 196 + xy: 385, 196 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -636,14 +650,14 @@ blocks/oiledge index: -1 blocks/oilrefinery rotate: false - xy: 385, 206 + xy: 375, 186 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/omnidrill rotate: false - xy: 385, 196 + xy: 385, 186 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -657,63 +671,63 @@ blocks/plasmaturret index: -1 blocks/powerbooster rotate: false - xy: 375, 186 + xy: 332, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyor rotate: false - xy: 385, 186 + xy: 332, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyormove rotate: false - xy: 332, 143 + xy: 332, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaser rotate: false - xy: 332, 133 + xy: 334, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaserrouter rotate: false - xy: 332, 123 + xy: 334, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduit rotate: false - xy: 334, 113 + xy: 334, 93 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduitbottom rotate: false - xy: 334, 103 + xy: 334, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduittop rotate: false - xy: 334, 93 + xy: 334, 73 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pump rotate: false - xy: 334, 83 + xy: 334, 63 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -727,70 +741,70 @@ blocks/repairturret index: -1 blocks/rock1 rotate: false - xy: 334, 63 + xy: 334, 43 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2 rotate: false - xy: 334, 53 + xy: 334, 33 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/router rotate: false - xy: 334, 43 + xy: 324, 23 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rtgenerator rotate: false - xy: 334, 33 + xy: 334, 23 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand1 rotate: false - xy: 324, 23 + xy: 321, 13 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand2 rotate: false - xy: 334, 23 + xy: 331, 13 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand3 rotate: false - xy: 321, 13 + xy: 321, 3 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock1 rotate: false - xy: 331, 13 + xy: 331, 3 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock2 rotate: false - xy: 321, 3 + xy: 341, 13 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock3 rotate: false - xy: 331, 3 + xy: 341, 3 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -811,7 +825,7 @@ blocks/shadow index: -1 blocks/shieldgenerator rotate: false - xy: 341, 3 + xy: 448, 209 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -825,21 +839,21 @@ blocks/shotgunturret index: -1 blocks/shrub rotate: false - xy: 466, 387 + xy: 486, 387 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shrubshadow rotate: false - xy: 476, 387 + xy: 461, 349 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/smelter rotate: false - xy: 486, 387 + xy: 459, 339 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -853,42 +867,42 @@ blocks/sniperturret index: -1 blocks/snow1 rotate: false - xy: 461, 349 + xy: 459, 329 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snow2 rotate: false - xy: 459, 339 + xy: 459, 319 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snow3 rotate: false - xy: 459, 329 + xy: 459, 309 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snowblock1 rotate: false - xy: 459, 319 + xy: 459, 299 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snowblock2 rotate: false - xy: 459, 309 + xy: 459, 289 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snowblock3 rotate: false - xy: 459, 299 + xy: 459, 279 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -902,28 +916,28 @@ blocks/snowedge index: -1 blocks/sorter rotate: false - xy: 459, 289 + xy: 459, 269 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelconveyor rotate: false - xy: 459, 279 + xy: 459, 259 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelconveyormove rotate: false - xy: 459, 269 + xy: 459, 249 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelwall rotate: false - xy: 459, 259 + xy: 459, 239 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -937,7 +951,7 @@ blocks/steelwall-large index: -1 blocks/steelwall-large-icon rotate: false - xy: 459, 249 + xy: 459, 229 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -951,84 +965,84 @@ blocks/stone index: -1 blocks/stone1 rotate: false - xy: 459, 239 + xy: 459, 219 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone2 rotate: false - xy: 459, 229 + xy: 458, 209 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone3 rotate: false - xy: 459, 219 + xy: 498, 391 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock-edge-0 rotate: false - xy: 337, 171 + xy: 464, 377 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock-edge-1 rotate: false - xy: 335, 161 + xy: 474, 377 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock-edge-2 rotate: false - xy: 464, 377 + xy: 484, 377 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock-edge-3 rotate: false - xy: 474, 377 + xy: 463, 367 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock-smooth1 rotate: false - xy: 484, 377 + xy: 473, 367 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock1 rotate: false - xy: 458, 209 + xy: 337, 181 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock2 rotate: false - xy: 498, 391 + xy: 337, 171 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock3 rotate: false - xy: 337, 181 + xy: 335, 161 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stonedrill rotate: false - xy: 463, 367 + xy: 483, 367 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1042,35 +1056,35 @@ blocks/stoneedge index: -1 blocks/stoneformer rotate: false - xy: 473, 367 + xy: 469, 339 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stonewall rotate: false - xy: 483, 367 + xy: 469, 329 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/teleporter rotate: false - xy: 469, 339 + xy: 469, 319 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/teleporter-top rotate: false - xy: 469, 329 + xy: 469, 309 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/thermalgenerator rotate: false - xy: 469, 319 + xy: 469, 299 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1091,49 +1105,49 @@ blocks/titancannon-icon index: -1 blocks/titanium1 rotate: false - xy: 469, 309 + xy: 469, 289 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium2 rotate: false - xy: 469, 299 + xy: 469, 279 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium3 rotate: false - xy: 469, 289 + xy: 469, 269 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumdrill rotate: false - xy: 469, 279 + xy: 469, 259 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumpurifier rotate: false - xy: 469, 269 + xy: 469, 249 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumshieldwall rotate: false - xy: 469, 259 + xy: 469, 239 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumwall rotate: false - xy: 469, 249 + xy: 469, 229 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1147,7 +1161,7 @@ blocks/titaniumwall-large index: -1 blocks/titaniumwall-large-icon rotate: false - xy: 469, 239 + xy: 469, 219 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1161,35 +1175,35 @@ blocks/turret index: -1 blocks/uranium1 rotate: false - xy: 468, 209 + xy: 347, 180 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium2 rotate: false - xy: 496, 381 + xy: 357, 180 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium3 rotate: false - xy: 347, 180 + xy: 347, 170 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uraniumdrill rotate: false - xy: 357, 180 + xy: 357, 170 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/water rotate: false - xy: 347, 170 + xy: 345, 160 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1483,49 +1497,49 @@ enemyarrow index: -1 icon-coal rotate: false - xy: 355, 210 + xy: 355, 200 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-dirium rotate: false - xy: 365, 210 + xy: 365, 200 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-iron rotate: false - xy: 355, 200 + xy: 355, 190 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-steel rotate: false - xy: 365, 200 + xy: 365, 190 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-stone rotate: false - xy: 355, 190 + xy: 327, 173 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-titanium rotate: false - xy: 365, 190 + xy: 325, 163 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-uranium rotate: false - xy: 327, 173 + xy: 325, 153 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1553,28 +1567,28 @@ mechs/player index: -1 shell rotate: false - xy: 341, 13 + xy: 438, 213 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shot rotate: false - xy: 438, 213 + xy: 466, 387 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shot-long rotate: false - xy: 448, 209 + xy: 476, 387 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanshell rotate: false - xy: 469, 229 + xy: 468, 209 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -2091,35 +2105,35 @@ weapons/blaster index: -1 weapons/flamer rotate: false - xy: 314, 110 + xy: 314, 90 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/mortar rotate: false - xy: 324, 53 + xy: 324, 33 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/multigun rotate: false - xy: 324, 33 + xy: 375, 196 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/railgun rotate: false - xy: 334, 73 + xy: 334, 53 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/triblaster rotate: false - xy: 469, 219 + xy: 496, 381 size: 8, 8 orig: 8, 8 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index e716407e7c..d03c5f5366 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 3493342967..d2a6f20cfc 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -435,9 +435,7 @@ public class Control extends Module{ Entities.initPhysics(); - Entities.setCollider(tilesize, (x, y)->{ - return world.solid(x, y); - }); + Entities.setCollider(tilesize, (x, y)-> world.solid(x, y)); } @Override diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index ff4d9800a7..4d051f6d63 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -9,6 +9,7 @@ import com.badlogic.gdx.math.Vector2; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.effect.Fx; +import io.anuke.mindustry.input.Input; import io.anuke.mindustry.resource.Recipe; import io.anuke.mindustry.resource.Weapon; import io.anuke.ucore.core.*; @@ -78,7 +79,7 @@ public class Player extends DestructibleEntity{ if(Inputs.keyDown("right")) vector.x += speed; - boolean shooting = Inputs.buttonDown(Buttons.LEFT) && recipe == null && !ui.hasMouse(); + boolean shooting = Inputs.buttonDown(Buttons.LEFT) && recipe == null && !ui.hasMouse() && !Input.onConfigurable(); if(shooting && Timers.get(this, "reload", weapon.reload)){ weapon.shoot(this); diff --git a/core/src/io/anuke/mindustry/entities/effect/Fx.java b/core/src/io/anuke/mindustry/entities/effect/Fx.java index 448f168fae..80c8813870 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Fx.java +++ b/core/src/io/anuke/mindustry/entities/effect/Fx.java @@ -216,6 +216,18 @@ public class Fx{ Draw.reset(); }), + dooropen = new Effect(10, e -> { + Draw.thickness(e.fract() * 1.6f); + Draw.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 2f); + Draw.reset(); + }), + + doorclose= new Effect(10, e -> { + Draw.thickness(e.fract() * 1.6f); + Draw.square(e.x, e.y, Vars.tilesize / 2f + e.fract() * 2f); + Draw.reset(); + }), + purify = new Effect(10, e -> { Draw.color(Color.ROYAL, Color.GRAY, e.ifract()); Draw.thickness(2f); diff --git a/core/src/io/anuke/mindustry/input/Input.java b/core/src/io/anuke/mindustry/input/Input.java index 197f10371d..648ab02c98 100644 --- a/core/src/io/anuke/mindustry/input/Input.java +++ b/core/src/io/anuke/mindustry/input/Input.java @@ -95,6 +95,11 @@ public class Input{ public static boolean cursorNear(){ return Vector2.dst(player.x, player.y, tilex() * tilesize, tiley() * tilesize) <= placerange; } + + public static boolean onConfigurable(){ + Tile tile = Vars.world.tile(tilex(), tiley()); + return tile != null && tile.block() instanceof Configurable; + } public static int tilex(){ return (player.recipe != null && player.recipe.result.isMultiblock() && diff --git a/core/src/io/anuke/mindustry/resource/Recipe.java b/core/src/io/anuke/mindustry/resource/Recipe.java index 3d0abead08..4f1ac1e76b 100644 --- a/core/src/io/anuke/mindustry/resource/Recipe.java +++ b/core/src/io/anuke/mindustry/resource/Recipe.java @@ -17,6 +17,7 @@ public enum Recipe{ steelwalllarge(defense, DefenseBlocks.steelwalllarge, stack(Item.steel, 8)), titaniumwalllarge(defense, DefenseBlocks.titaniumwalllarge, stack(Item.titanium, 8)), duriumwalllarge(defense, DefenseBlocks.diriumwalllarge, stack(Item.dirium, 8)), + door(defense, DefenseBlocks.door, stack(Item.steel, 3), stack(Item.iron, 3)), titaniumshieldwall(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 2)), conveyor(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)), diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 9340af1b92..8c78332778 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -39,6 +39,8 @@ public class Block{ public boolean destructible; /**whether this is solid*/ public boolean solid; + /**whethe this block CAN be solid.*/ + public boolean solidifes; /**whether this is rotateable*/ public boolean rotate; /**whether you can break this with rightblick*/ @@ -89,8 +91,8 @@ public class Block{ return name; } - public String errorMessage(Tile tile){ - return null; + public boolean isSolidFor(Tile tile){ + return false; } public boolean canReplace(Block other){ diff --git a/core/src/io/anuke/mindustry/world/Tile.java b/core/src/io/anuke/mindustry/world/Tile.java index a50e69984e..a520001be9 100644 --- a/core/src/io/anuke/mindustry/world/Tile.java +++ b/core/src/io/anuke/mindustry/world/Tile.java @@ -151,7 +151,7 @@ public class Tile{ public boolean solid(){ Block block = block(); Block floor = floor(); - return block.solid || floor.solid; + return block.solid || (floor.solid && block == Blocks.air) || block.isSolidFor(this); } public boolean breakable(){ diff --git a/core/src/io/anuke/mindustry/world/World.java b/core/src/io/anuke/mindustry/world/World.java index a5481b99b1..4b3b3bb875 100644 --- a/core/src/io/anuke/mindustry/world/World.java +++ b/core/src/io/anuke/mindustry/world/World.java @@ -12,6 +12,7 @@ import io.anuke.mindustry.Vars; import io.anuke.mindustry.ai.Pathfind; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.effect.Fx; +import io.anuke.mindustry.entities.enemies.Enemy; import io.anuke.mindustry.resource.ItemStack; import io.anuke.mindustry.resource.Recipe; import io.anuke.mindustry.world.blocks.*; @@ -64,7 +65,7 @@ public class World extends Module{ public boolean solid(int x, int y){ Tile tile = tile(x, y); - return tile == null || tile.block().solid || (tile.floor().solid && (tile.block() == Blocks.air)); + return tile == null || tile.solid(); } public boolean wallSolid(int x, int y){ @@ -269,7 +270,7 @@ public class World extends Module{ Vector2 offset = type.getPlaceOffset(); Tmp.r2.setCenter(offset.x + x * Vars.tilesize, offset.y + y * Vars.tilesize); - for(SolidEntity e : Entities.getNearby(x * tilesize, y * tilesize, tilesize * 2f)){ + for(SolidEntity e : Entities.getNearby(Entities.getGroup(Enemy.class), x * tilesize, y * tilesize, tilesize * 2f)){ Rectangle rect = e.hitbox.getRect(e.x, e.y); if(Tmp.r2.overlaps(rect)){ @@ -277,6 +278,10 @@ public class World extends Module{ } } + if(Tmp.r2.overlaps(player.hitbox.getRect(player.x, player.y))){ + return false; + } + Tile tile = tile(x, y); if(tile == null) return false; diff --git a/core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java b/core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java index 5258f4322d..8134a536b4 100644 --- a/core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java @@ -2,9 +2,7 @@ package io.anuke.mindustry.world.blocks; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.blocks.types.Wall; -import io.anuke.mindustry.world.blocks.types.defense.RepairTurret; -import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock; -import io.anuke.mindustry.world.blocks.types.defense.ShieldedWallBlock; +import io.anuke.mindustry.world.blocks.types.defense.*; public class DefenseBlocks{ @@ -96,5 +94,9 @@ public class DefenseBlocks{ + "but drains energy quickly on bullet contact."; formalName = "shield generator"; } - }; + }, + door = new Door("door"){{ + fullDescription = "A block than can be opened and closed by clicking it."; + health = 90; + }}; } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/Door.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/Door.java index 123b3b44a9..6bfcd2ce38 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/Door.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/Door.java @@ -1,11 +1,85 @@ package io.anuke.mindustry.world.blocks.types.defense; -import io.anuke.mindustry.world.blocks.types.Wall; +import static io.anuke.mindustry.Vars.*; -public class Door extends Wall{ +import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.ObjectMap; + +import io.anuke.mindustry.Vars; +import io.anuke.mindustry.entities.effect.Fx; +import io.anuke.mindustry.entities.enemies.Enemy; +import io.anuke.mindustry.world.Block; +import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.world.blocks.types.Configurable; +import io.anuke.mindustry.world.blocks.types.Wall; +import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.Effects; +import io.anuke.ucore.core.Effects.Effect; +import io.anuke.ucore.entities.Entities; +import io.anuke.ucore.entities.SolidEntity; +import io.anuke.ucore.scene.ui.layout.Table; +import io.anuke.ucore.util.Tmp; + +public class Door extends Wall implements Configurable{ + private ObjectMap open = new ObjectMap<>(); + + protected Effect openfx = Fx.dooropen; + protected Effect closefx = Fx.doorclose; public Door(String name) { super(name); + solid = false; + } + + @Override + public void draw(Tile tile){ + if(open.get(tile, true)){ + Draw.rect(name, tile.worldx(), tile.worldy()); + }else{ + Draw.rect(name + "-open", tile.worldx(), tile.worldy()); + } + } + + @Override + public boolean isSolidFor(Tile tile){ + return open.get(tile, true); + } + + @Override + public void buildTable(Tile tile, Table table){ + if(anyEntities(tile) && !open.get(tile, true)){ + return; + } + + open.put(tile, !open.get(tile, true)); + if(open.get(tile)){ + Effects.effect(closefx, tile.worldx(), tile.worldy()); + }else{ + Effects.effect(openfx, tile.worldx(), tile.worldy()); + } + } + + boolean anyEntities(Tile tile){ + int x = tile.x, y = tile.y; + Block type = tile.block(); + Tmp.r2.setSize(type.width * Vars.tilesize, type.height * Vars.tilesize); + Vector2 offset = type.getPlaceOffset(); + Tmp.r2.setCenter(offset.x + x * Vars.tilesize, offset.y + y * Vars.tilesize); + + for(SolidEntity e : Entities.getNearby(Entities.getGroup(Enemy.class), x * tilesize, y * tilesize, tilesize * 2f)){ + Rectangle rect = e.hitbox.getRect(e.x, e.y); + + if(Tmp.r2.overlaps(rect)){ + return true; + } + } + + if(Tmp.r2.overlaps(player.hitbox.getRect(player.x, player.y))){ + return true; + } + + return false; } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java index 9ba52183bb..72cb20bdd2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java @@ -1,5 +1,7 @@ package io.anuke.mindustry.world.blocks.types.production; +import com.badlogic.gdx.utils.Array; + import io.anuke.mindustry.entities.effect.Fx; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Block; @@ -21,6 +23,13 @@ public class Drill extends Block{ solid = true; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[iteminfo]Capacity: " + capacity); + list.add("[iteminfo]Seconds/item: " + time); + } + @Override public void update(Tile tile){ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java index 3f8a040353..5830bcf58e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java @@ -26,6 +26,7 @@ public class Generator extends PowerBlock{ public boolean explosive = true; public boolean drawRadius = false; public boolean hasLasers = true; + public boolean outputOnly = false; public Generator(String name) { super(name); @@ -78,15 +79,17 @@ public class Generator extends PowerBlock{ @Override public void drawOver(Tile tile){ PowerEntity entity = tile.entity(); - if(entity.power > powerSpeed){ - Draw.alpha(1f); - }else{ - Draw.alpha(0.5f); - } - + for(int i = 0; i < laserDirections; i++){ + if(entity.power > powerSpeed){ + Draw.alpha(1f); + }else{ + Draw.alpha(0.5f); + } drawLaserTo(tile, (tile.getRotation() + i) - laserDirections/2); } + + Draw.color(); } @Override @@ -121,7 +124,7 @@ public class Generator extends PowerBlock{ Tmp.v1.set(Angles.translation(rotation * 90, target.block().width * Vars.tilesize/2 + 2f + (interfering ? - Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(), target.worldy()) / 2f - Vars.tilesize/2f - 1 : 0))); + Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(), target.worldy()) / 2f - Vars.tilesize/2f * target.block().width - 1 : 0))); Angles.translation(rotation * 90, width * Vars.tilesize/2 + 2f); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java index 3682b51624..dea24293fb 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java @@ -18,6 +18,7 @@ public class ItemPowerGenerator extends Generator{ public ItemPowerGenerator(String name) { super(name); + outputOnly = true; } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidItemPowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidItemPowerGenerator.java index a860b68102..c1a609a59f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidItemPowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidItemPowerGenerator.java @@ -7,6 +7,7 @@ import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Tile; +import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Timers; @@ -29,6 +30,7 @@ public class LiquidItemPowerGenerator extends LiquidPowerGenerator{ Vars.renderer.drawBar(Color.GREEN, tile.worldx() + offset.x, tile.worldy() + 6 + offset.y + height*Vars.tilesize/2f, (float)entity.totalItems() / itemCapacity); + Draw.reset(); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java index a9fdd32fe9..4c8ae97ca4 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java @@ -30,6 +30,7 @@ public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{ public LiquidPowerGenerator(String name) { super(name); + outputOnly = true; } @Override @@ -56,7 +57,7 @@ public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{ public void drawLiquidCenter(Tile tile){ Vector2 offset = getPlaceOffset(); - Draw.rect("black", tile.worldx() + offset.x, tile.worldy() + offset.y, 2, 2); + Draw.rect("blank", tile.worldx() + offset.x, tile.worldy() + offset.y, 2, 2); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java b/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java index bd1879e331..c77139e43b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java @@ -1,5 +1,9 @@ package io.anuke.mindustry.world.blocks.types.production; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; @@ -26,7 +30,7 @@ public class NuclearReactor extends LiquidItemPowerGenerator{ protected float smokeThreshold = 0.3f; //threshold at which block starts smoking protected int explosionRadius = 19; protected int explosionDamage = 128; - protected float flashThreshold = 0.5f; + protected float flashThreshold = 0.46f; public NuclearReactor(String name) { super(name); @@ -91,7 +95,7 @@ public class NuclearReactor extends LiquidItemPowerGenerator{ int fuel = entity.getItem(generateItem); - if(fuel < 5) return; + if(fuel < 5 && entity.heat < 0.5f) return; int waves = 6; float delay = 8f; @@ -156,13 +160,14 @@ public class NuclearReactor extends LiquidItemPowerGenerator{ Draw.rect("white", tile.worldx() + offset.x, tile.worldy() + offset.y, width * Vars.tilesize, height * Vars.tilesize); if(entity.heat > flashThreshold){ - float flash = 9f - ((entity.heat - flashThreshold) / (1f - flashThreshold)) * 4f; - Draw.color(Color.RED, Color.YELLOW, Mathf.absin(Timers.time(), flash, 1f)); + float flash = 1f + ((entity.heat - flashThreshold) / (1f - flashThreshold)) * 5.4f; + entity.flash += flash * Timers.delta(); + Draw.color(Color.RED, Color.YELLOW, Mathf.absin(entity.flash, 9f, 1f)); Draw.alpha(0.6f); Draw.rect(name + "-lights", tile.worldx() + offset.x, tile.worldy() + offset.y); } - Draw.color(); + Draw.reset(); } @Override @@ -172,5 +177,18 @@ public class NuclearReactor extends LiquidItemPowerGenerator{ public static class NuclearReactorEntity extends LiquidPowerEntity{ public float heat; + public float flash; + + @Override + public void write(DataOutputStream stream) throws IOException{ + super.write(stream); + stream.writeFloat(heat); + } + + @Override + public void read(DataInputStream stream) throws IOException{ + super.read(stream); + heat = stream.readFloat(); + } } } diff --git a/desktop/mindustry-saves/0.mins b/desktop/mindustry-saves/0.mins index 25fe6a2ac0..0345804f15 100644 Binary files a/desktop/mindustry-saves/0.mins and b/desktop/mindustry-saves/0.mins differ diff --git a/desktop/mindustry-saves/1.mins b/desktop/mindustry-saves/1.mins index 9d9a8ca039..a5297efc38 100644 Binary files a/desktop/mindustry-saves/1.mins and b/desktop/mindustry-saves/1.mins differ