Merge branches 'master' and 'new-map-format' of https://github.com/Anuken/Mindustry into new-map-format

# Conflicts:
#	core/src/io/anuke/mindustry/editor/MapEditorDialog.java
#	core/src/io/anuke/mindustry/io/MapIO.java
#	core/src/io/anuke/mindustry/maps/MapTileData.java
This commit is contained in:
Anuken
2019-01-23 13:52:36 -05:00
202 changed files with 9917 additions and 6290 deletions

View File

@@ -8,7 +8,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.android.tools.build:gradle:3.3.0'
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 B

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 B

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

After

Width:  |  Height:  |  Size: 272 B

View File

@@ -14,10 +14,16 @@ screenshot = Screenshot saved to {0}
gameover = Game Over gameover = Game Over
gameover.pvp = The[accent] {0}[] team is victorious! gameover.pvp = The[accent] {0}[] team is victorious!
highscore = [accent]New highscore! highscore = [accent]New highscore!
wave.lasted = You lasted until wave [accent]{0}[].
level.highscore = High Score: [accent]{0} stat.wave = Waves Defeated:[accent] {0}
level.delete.title = Confirm Delete stat.enemiesDestroyed = Enemies Destroyed:[accent] {0}
stat.built = Buildings Built:[accent] {0}
stat.destroyed = Buildings Destroyed:[accent] {0}
stat.deconstructed = Buildings Deconstructed:[accent] {0}
stat.delivered = Resources Launched:
map.delete = Are you sure you want to delete the map "[accent]{0}[]"? map.delete = Are you sure you want to delete the map "[accent]{0}[]"?
level.highscore = High Score: [accent]{0}
level.select = Level Select level.select = Level Select
level.mode = Gamemode: level.mode = Gamemode:
construction.desktop = To deselect a block or stop building, [accent]use space[]. construction.desktop = To deselect a block or stop building, [accent]use space[].
@@ -27,7 +33,7 @@ deconstruction.title = Block Deconstruction Guide
deconstruction = You've just selected [accent]block deconstruction mode[].\n\nTo begin breaking, simply tap a block near your ship.\nOnce you have selected some blocks, press the checkbox to confirm, and your ship will begin de-constructing them.\n\n- [accent]Remove blocks[] from your selection by tapping them.\n- [accent]Remove blocks in an area[] by tapping and holding an empty spot, then dragging in a direction.\n- [accent]Cancel deconstruction or selection[] by pressing the X at the bottom left. deconstruction = You've just selected [accent]block deconstruction mode[].\n\nTo begin breaking, simply tap a block near your ship.\nOnce you have selected some blocks, press the checkbox to confirm, and your ship will begin de-constructing them.\n\n- [accent]Remove blocks[] from your selection by tapping them.\n- [accent]Remove blocks in an area[] by tapping and holding an empty spot, then dragging in a direction.\n- [accent]Cancel deconstruction or selection[] by pressing the X at the bottom left.
showagain = Don't show again next session showagain = Don't show again next session
coreattack = < Core is under attack! > coreattack = < Core is under attack! >
unlocks = Unlocks database = Core Database
savegame = Save Game savegame = Save Game
loadgame = Load Game loadgame = Load Game
joingame = Join Game joingame = Join Game
@@ -43,8 +49,12 @@ about.button = About
name = Name: name = Name:
noname = Pick a[accent] player name[] first. noname = Pick a[accent] player name[] first.
filename = File Name: filename = File Name:
unlocked = New Block Unlocked! unlocked = New content unlocked!
unlocked.plural = New Blocks Unlocked! completed = [accent]Completed
techtree = Tech Tree
research.list = [LIGHT_GRAY]Research:
research = Research
researched = [LIGHT_GRAY]{0} researched.
players = {0} players online players = {0} players online
players.single = {0} player online players.single = {0} player online
server.closing = [accent]Closing server... server.closing = [accent]Closing server...
@@ -138,6 +148,7 @@ save.wave = Wave {0}
save.difficulty = Difficulty: {0} save.difficulty = Difficulty: {0}
save.date = Last Saved: {0} save.date = Last Saved: {0}
save.playtime = Playtime: {0} save.playtime = Playtime: {0}
warning = Warning.
confirm = Confirm confirm = Confirm
delete = Delete delete = Delete
ok = OK ok = OK
@@ -229,6 +240,16 @@ editor = Editor
mapeditor = Map Editor mapeditor = Map Editor
donate = Donate donate = Donate
abandon = Abandon
abandon.text = This zone and all its resources will be lost to the enemy.
locked = Locked
complete = [LIGHT_GRAY]Complete:
resume = Resume Zone:\n[LIGHT_GRAY]{0}
bestwave = [LIGHT_GRAY]Best: {0}
launch = Launch
launch.title = Launch Successful
zone.unlocked = [LIGHT_GRAY]{0} unlocked.
connectfail = [crimson]Failed to connect to server:\n\n[accent]{0} connectfail = [crimson]Failed to connect to server:\n\n[accent]{0}
error.unreachable = Server unreachable.\nIs the address spelled correctly? error.unreachable = Server unreachable.\nIs the address spelled correctly?
error.invalidaddress = Invalid address. error.invalidaddress = Invalid address.
@@ -239,7 +260,18 @@ error.mapnotfound = Map file not found!
error.io = Network I/O error. error.io = Network I/O error.
error.any = Unknown network error. error.any = Unknown network error.
zone.wasteland.name = Wasteland zone.groundZero.name = Ground Zero
zone.craters.name = The Craters
zone.frozenForest.name = Frozen Forest
zone.ruinousShores.name = Ruinous Shores
zone.crags.name = Crags
zone.stainedMountains.name = Stained Mountains
zone.impact.name = Impact 0079
zone.desolateRift.name = Desolate Rift
zone.arcticDesert.name = Arctic Desert
zone.dryWastes.name = Dry Wastes
zone.nuclearComplex.name = Nuclear Production Complex
zone.moltenFault.name = Molten Fault
settings.language = Language settings.language = Language
settings.reset = Reset to Defaults settings.reset = Reset to Defaults
@@ -392,7 +424,7 @@ mode.attack.descrption = No waves, with the goal to destroy the enemy base.
content.item.name = Items content.item.name = Items
content.liquid.name = Liquids content.liquid.name = Liquids
content.unit.name = Units content.unit.name = Units
content.recipe.name = Blocks content.block.name = Blocks
content.mech.name = Mechs content.mech.name = Mechs
item.copper.name = Copper item.copper.name = Copper
item.copper.description = A useful structure material. Used extensively in all types of blocks. item.copper.description = A useful structure material. Used extensively in all types of blocks.
@@ -421,8 +453,10 @@ item.blast-compound.name = Blast Compound
item.blast-compound.description = A volatile compound used in bombs and explosives. While it can burned as fuel, this is not advised. item.blast-compound.description = A volatile compound used in bombs and explosives. While it can burned as fuel, this is not advised.
item.pyratite.name = Pyratite item.pyratite.name = Pyratite
item.pyratite.description = An extremely flammable substance used in incendiary weapons. item.pyratite.description = An extremely flammable substance used in incendiary weapons.
item.bioglass.name = Bioglass item.metaglass.name = Metaglass
item.metaglass.description = A super-tough glass compound. Extensively used for liquid distribution and storage.
item.scrap.name = Scrap item.scrap.name = Scrap
item.scrap.description = Leftover remnants of old structures and units. Contains trace amounts of many different metals.
liquid.water.name = Water liquid.water.name = Water
liquid.lava.name = Lava liquid.lava.name = Lava
liquid.oil.name = Oil liquid.oil.name = Oil
@@ -675,7 +709,7 @@ block.cyclone.description = A large rapid fire turret.
block.fuse.description = A large turret which shoots powerful short-range beams. block.fuse.description = A large turret which shoots powerful short-range beams.
block.spectre.description = A large turret which shoots two powerful bullets at once. block.spectre.description = A large turret which shoots two powerful bullets at once.
block.meltdown.description = A large turret which shoots powerful long-range beams. block.meltdown.description = A large turret which shoots powerful long-range beams.
block.conveyor.description = Basic item transport block. Moved items forward and automatically deposits them into turrets or crafters. Rotatable. block.conveyor.description = Basic item transport block. Moves items forward and automatically deposits them into turrets or crafters. Rotatable.
block.titanium-conveyor.description = Advanced item transport block. Moves items faster than standard conveyors. block.titanium-conveyor.description = Advanced item transport block. Moves items faster than standard conveyors.
block.phase-conveyor.description = Advanced item transport block. Uses power to teleport items to a connected phase conveyor over several tiles. block.phase-conveyor.description = Advanced item transport block. Uses power to teleport items to a connected phase conveyor over several tiles.
block.junction.description = Acts as a bridge for two crossing conveyor belts. Useful in situations with two different conveyors carrying different materials to different locations. block.junction.description = Acts as a bridge for two crossing conveyor belts. Useful in situations with two different conveyors carrying different materials to different locations.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

After

Width:  |  Height:  |  Size: 992 KiB

View File

@@ -24,6 +24,7 @@ ButtonStyle: {
}, },
TextButtonStyle: { TextButtonStyle: {
default: {over: button-over, disabled: button, font: default-font, fontColor: white, disabledFontColor: gray, down: button-down, up: button}, default: {over: button-over, disabled: button, font: default-font, fontColor: white, disabledFontColor: gray, down: button-down, up: button},
node: {disabled: content-background, font: default-font, fontColor: white, disabledFontColor: gray, up: content-background, over: content-background-over},
right: {over: button-right-over, font: default-font, fontColor: white, disabledFontColor: gray, down: button-right-down, up: button-right}, right: {over: button-right-over, font: default-font, fontColor: white, disabledFontColor: gray, down: button-right-down, up: button-right},
wave: {font: default-font, fontColor: white, disabledFontColor: gray, up: button-edge-4}, wave: {font: default-font, fontColor: white, disabledFontColor: gray, up: button-edge-4},
clear: {over: flat-over, font: default-font, fontColor: white, disabledFontColor: gray, down: flat-over, up: flat}, clear: {over: flat-over, font: default-font, fontColor: white, disabledFontColor: gray, down: flat-over, up: flat},
@@ -37,6 +38,7 @@ TextButtonStyle: {
}, },
ImageButtonStyle: { ImageButtonStyle: {
default: {down: button-down, up: button, over: button-over, imageDisabledColor: gray, imageUpColor: white }, default: {down: button-down, up: button, over: button-over, imageDisabledColor: gray, imageUpColor: white },
node: {up: content-background, over: content-background-over},
right: {over: button-right-over, down: button-right-down, up: button-right}, right: {over: button-right-over, down: button-right-down, up: button-right},
empty: { imageDownColor: accent, imageUpColor: white}, empty: { imageDownColor: accent, imageUpColor: white},
emptytoggle: {imageCheckedColor: white, imageDownColor: white, imageUpColor: gray}, emptytoggle: {imageCheckedColor: white, imageDownColor: white, imageUpColor: gray},

View File

@@ -1,57 +0,0 @@
info face="Title" size=16 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0
common lineHeight=14 base=0 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="title.png"
chars count=53
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=0
char id=97 x=1 y=0 width=9 height=12 xoffset=0 yoffset=-12 xadvance=8 page=0 chnl=0
char id=65 x=1 y=0 width=9 height=12 xoffset=0 yoffset=-12 xadvance=8 page=0 chnl=0
char id=98 x=14 y=0 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=66 x=14 y=0 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=99 x=26 y=0 width=7 height=12 xoffset=0 yoffset=-12 xadvance=6 page=0 chnl=0
char id=67 x=26 y=0 width=7 height=12 xoffset=0 yoffset=-12 xadvance=6 page=0 chnl=0
char id=100 x=39 y=0 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=68 x=39 y=0 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=101 x=50 y=0 width=7 height=12 xoffset=0 yoffset=-12 xadvance=6 page=0 chnl=0
char id=69 x=50 y=0 width=7 height=12 xoffset=0 yoffset=-12 xadvance=6 page=0 chnl=0
char id=102 x=63 y=0 width=7 height=12 xoffset=0 yoffset=-12 xadvance=6 page=0 chnl=0
char id=70 x=63 y=0 width=7 height=12 xoffset=0 yoffset=-12 xadvance=6 page=0 chnl=0
char id=103 x=74 y=0 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=71 x=74 y=0 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=104 x=86 y=0 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=72 x=86 y=0 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=105 x=100 y=0 width=4 height=12 xoffset=0 yoffset=-12 xadvance=3 page=0 chnl=0
char id=73 x=100 y=0 width=4 height=12 xoffset=0 yoffset=-12 xadvance=3 page=0 chnl=0
char id=106 x=2 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=74 x=2 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=107 x=14 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=75 x=14 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=108 x=28 y=12 width=7 height=12 xoffset=0 yoffset=-12 xadvance=6 page=0 chnl=0
char id=76 x=28 y=12 width=7 height=12 xoffset=0 yoffset=-12 xadvance=6 page=0 chnl=0
char id=109 x=38 y=12 width=10 height=12 xoffset=0 yoffset=-12 xadvance=9 page=0 chnl=0
char id=77 x=38 y=12 width=10 height=12 xoffset=0 yoffset=-12 xadvance=9 page=0 chnl=0
char id=110 x=50 y=12 width=9 height=12 xoffset=0 yoffset=-12 xadvance=8 page=0 chnl=0
char id=78 x=50 y=12 width=9 height=12 xoffset=0 yoffset=-12 xadvance=8 page=0 chnl=0
char id=111 x=63 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=79 x=63 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=112 x=75 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=80 x=75 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=113 x=87 y=12 width=9 height=12 xoffset=0 yoffset=-12 xadvance=8 page=0 chnl=0
char id=81 x=87 y=12 width=9 height=12 xoffset=0 yoffset=-12 xadvance=8 page=0 chnl=0
char id=114 x=99 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=82 x=99 y=12 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=115 x=2 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=83 x=2 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=116 x=14 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=84 x=14 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=117 x=26 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=85 x=26 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=118 x=37 y=24 width=9 height=12 xoffset=0 yoffset=-12 xadvance=8 page=0 chnl=0
char id=86 x=37 y=24 width=9 height=12 xoffset=0 yoffset=-12 xadvance=8 page=0 chnl=0
char id=119 x=50 y=24 width=10 height=12 xoffset=0 yoffset=-12 xadvance=9 page=0 chnl=0
char id=87 x=50 y=24 width=10 height=12 xoffset=0 yoffset=-12 xadvance=9 page=0 chnl=0
char id=120 x=62 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=88 x=62 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=121 x=75 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=89 x=75 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=122 x=86 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0
char id=90 x=86 y=24 width=8 height=12 xoffset=0 yoffset=-12 xadvance=7 page=0 chnl=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,770 +0,0 @@
uiskin.png
size: 512,128
format: RGBA8888
filter: Nearest,Nearest
repeat: none
blank
rotate: false
xy: 202, 14
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
border
rotate: false
xy: 360, 35
size: 12, 12
split: 4, 4, 4, 4
orig: 12, 12
offset: 0, 0
index: -1
border-circle
rotate: false
xy: 418, 35
size: 28, 28
orig: 28, 28
offset: 0, 0
index: -1
border-circle-error
rotate: false
xy: 82, 10
size: 28, 28
orig: 28, 28
offset: 0, 0
index: -1
border-dark-blue
rotate: false
xy: 500, 42
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
border-error
rotate: false
xy: 37, 7
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
border-white
rotate: false
xy: 58, 2
size: 12, 12
split: 4, 4, 4, 4
orig: 12, 12
offset: 0, 0
index: -1
button
rotate: false
xy: 212, 2
size: 24, 40
split: 10, 10, 6, 10
orig: 24, 40
offset: 0, 0
index: -1
button-blue
rotate: false
xy: 82, 40
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
orig: 24, 40
offset: 0, 0
index: -1
button-blue-down
rotate: false
xy: 448, 40
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
orig: 24, 40
offset: 0, 0
index: -1
button-blue-over
rotate: false
xy: 474, 40
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
orig: 24, 40
offset: 0, 0
index: -1
button-down
rotate: false
xy: 108, 40
size: 24, 40
split: 10, 10, 6, 10
orig: 24, 40
offset: 0, 0
index: -1
button-over
rotate: false
xy: 108, 40
size: 24, 40
split: 10, 10, 6, 10
orig: 24, 40
offset: 0, 0
index: -1
button-gray
rotate: false
xy: 160, 40
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
orig: 24, 40
offset: 0, 0
index: -1
button-gray-over
rotate: false
xy: 134, 40
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
orig: 24, 40
offset: 0, 0
index: -1
button-map
rotate: false
xy: 212, 44
size: 24, 40
split: 10, 10, 5, 10
orig: 24, 40
offset: 0, 0
index: -1
button-map-down
rotate: false
xy: 186, 40
size: 24, 40
split: 10, 10, 5, 10
orig: 24, 40
offset: 0, 0
index: -1
button-map-over
rotate: false
xy: 186, 40
size: 24, 40
split: 10, 10, 5, 10
orig: 24, 40
offset: 0, 0
index: -1
button-red
rotate: false
xy: 238, 44
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
orig: 24, 40
offset: 0, 0
index: -1
button-select
rotate: false
xy: 330, 39
size: 24, 24
split: 4, 4, 4, 4
orig: 24, 24
offset: 0, 0
index: -1
button-window-bg
rotate: false
xy: 264, 44
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
orig: 24, 40
offset: 0, 0
index: -1
button-window-over
rotate: false
xy: 290, 44
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
orig: 24, 40
offset: 0, 0
index: -1
check-off
rotate: false
xy: 474, 6
size: 28, 32
orig: 28, 32
offset: 0, 0
index: -1
check-on
rotate: false
xy: 238, 10
size: 28, 32
orig: 28, 32
offset: 0, 0
index: -1
check-over
rotate: false
xy: 268, 10
size: 28, 32
orig: 28, 32
offset: 0, 0
index: -1
clear
rotate: false
xy: 500, 50
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
color-picker-bar-selector
rotate: false
xy: 495, 98
size: 14, 28
orig: 14, 28
offset: 0, 0
index: -1
color-picker-cross
rotate: false
xy: 360, 23
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
color-picker-selector-horizontal
rotate: false
xy: 495, 95
size: 6, 1
orig: 6, 1
offset: 0, 0
index: -1
color-picker-selector-vertical
rotate: false
xy: 72, 2
size: 1, 6
orig: 1, 6
offset: 0, 0
index: -1
cursor
rotate: false
xy: 316, 44
size: 4, 4
orig: 4, 4
offset: 0, 0
index: -1
cursor-normal
rotate: false
xy: 374, 37
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
default-pane
rotate: false
xy: 389, 37
size: 5, 3
split: 1, 1, 1, 1
orig: 5, 3
offset: 0, 0
index: -1
default-pane-no-border
rotate: false
xy: 75, 2
size: 1, 1
split: 0, 0, 0, 0
orig: 1, 1
offset: 0, 0
index: -1
default-select
rotate: false
xy: 2, 12
size: 54, 48
split: 8, 32, 0, 48
orig: 54, 48
offset: 0, 0
index: -1
default-select-selection
rotate: false
xy: 37, 2
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
grey
rotate: false
xy: 78, 2
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
menu-bg
rotate: false
xy: 78, 2
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
icon-cancel
rotate: false
xy: 356, 49
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
icon-check
rotate: false
xy: 372, 49
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
icon-close
rotate: false
xy: 205, 86
size: 40, 40
orig: 40, 40
offset: 0, 0
index: -1
icon-close-down
rotate: false
xy: 247, 86
size: 40, 40
orig: 40, 40
offset: 0, 0
index: -1
icon-close-over
rotate: false
xy: 289, 86
size: 40, 40
orig: 40, 40
offset: 0, 0
index: -1
icon-cursor
rotate: false
xy: 332, 11
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-defense
rotate: false
xy: 344, 11
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-distribution
rotate: false
xy: 356, 11
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-menu
rotate: false
xy: 368, 11
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-pause
rotate: false
xy: 372, 23
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-play
rotate: false
xy: 380, 11
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-production
rotate: false
xy: 384, 23
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-rotate
rotate: false
xy: 328, 23
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
icon-rotate-arrow
rotate: false
xy: 344, 23
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
icon-settings
rotate: false
xy: 396, 30
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-touch
rotate: false
xy: 396, 18
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
list-selection
rotate: false
xy: 386, 36
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
logotext
rotate: false
xy: 68, 105
size: 89, 21
orig: 89, 21
offset: 0, 0
index: -1
logotext-gray
rotate: false
xy: 68, 82
size: 89, 21
orig: 89, 21
offset: 0, 0
index: -1
padded-list-selection
rotate: false
xy: 500, 47
size: 10, 1
split: 4, 4, 0, 1
orig: 10, 1
offset: 0, 0
index: -1
pane
rotate: false
xy: 448, 2
size: 24, 36
split: 10, 10, 5, 5
orig: 24, 36
offset: 0, 0
index: -1
progressbar
rotate: false
xy: 324, 52
size: 1, 32
orig: 1, 32
offset: 0, 0
index: -1
progressbar-filled
rotate: false
xy: 327, 52
size: 1, 32
orig: 1, 32
offset: 0, 0
index: -1
progressbar-filled-vertical
rotate: false
xy: 474, 3
size: 32, 1
orig: 32, 1
offset: 0, 0
index: -1
progressbar-vertical
rotate: false
xy: 298, 11
size: 32, 1
orig: 32, 1
offset: 0, 0
index: -1
radio-off
rotate: false
xy: 112, 10
size: 28, 28
orig: 28, 28
offset: 0, 0
index: -1
radio-on
rotate: false
xy: 142, 10
size: 28, 28
orig: 28, 28
offset: 0, 0
index: -1
scroll
rotate: false
xy: 274, 2
size: 34, 6
split: 4, 4, 2, 2
orig: 34, 6
offset: 0, 0
index: -1
scroll-horizontal
rotate: false
xy: 316, 50
size: 6, 34
split: 2, 2, 0, 34
pad: 0, 5, 5, 4
orig: 6, 34
offset: 0, 0
index: -1
scroll-knob-horizontal
rotate: false
xy: 504, 62
size: 6, 34
split: 2, 2, 0, 34
pad: 0, 5, 13, 12
orig: 6, 34
offset: 0, 0
index: -1
scroll-knob-vertical
rotate: false
xy: 238, 2
size: 34, 6
split: 12, 12, 2, 2
orig: 34, 6
offset: 0, 0
index: -1
select-box-list-bg
rotate: false
xy: 205, 83
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
window-bg
rotate: false
xy: 205, 83
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
select-down
rotate: false
xy: 2, 2
size: 14, 8
orig: 14, 8
offset: 0, 0
index: -1
select-up
rotate: false
xy: 18, 2
size: 14, 8
orig: 14, 8
offset: 0, 0
index: -1
selection
rotate: false
xy: 328, 20
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
separator
rotate: false
xy: 404, 15
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
tree-over
rotate: false
xy: 404, 15
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
separator-menu
rotate: false
xy: 392, 20
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
slider
rotate: false
xy: 386, 39
size: 1, 8
orig: 1, 8
offset: 0, 0
index: -1
slider-knob
rotate: false
xy: 447, 82
size: 22, 44
orig: 22, 44
offset: 0, 0
index: -1
slider-knob-disabled
rotate: false
xy: 471, 82
size: 22, 44
orig: 22, 44
offset: 0, 0
index: -1
slider-knob-down
rotate: false
xy: 58, 16
size: 22, 44
orig: 22, 44
offset: 0, 0
index: -1
slider-knob-over
rotate: false
xy: 58, 16
size: 22, 44
orig: 22, 44
offset: 0, 0
index: -1
slider-vertical
rotate: false
xy: 72, 13
size: 8, 1
orig: 8, 1
offset: 0, 0
index: -1
slot
rotate: false
xy: 2, 62
size: 64, 64
split: 4, 8, 8, 4
orig: 64, 64
offset: 0, 0
index: -1
splitpane
rotate: false
xy: 202, 11
size: 8, 1
orig: 8, 1
offset: 0, 0
index: -1
splitpane-over
rotate: false
xy: 72, 10
size: 8, 1
orig: 8, 1
offset: 0, 0
index: -1
splitpane-vertical
rotate: false
xy: 34, 2
size: 1, 8
orig: 1, 8
offset: 0, 0
index: -1
splitpane-vertical-over
rotate: false
xy: 356, 39
size: 1, 8
orig: 1, 8
offset: 0, 0
index: -1
sub-menu
rotate: false
xy: 202, 24
size: 8, 14
orig: 8, 14
offset: 0, 0
index: -1
textfield
rotate: false
xy: 298, 14
size: 28, 28
split: 6, 6, 6, 6
orig: 28, 28
offset: 0, 0
index: -1
textfield-over
rotate: false
xy: 172, 10
size: 28, 28
split: 2, 2, 2, 2
orig: 28, 28
offset: 0, 0
index: -1
tooltip-bg
rotate: false
xy: 408, 37
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
touchpad-knob
rotate: false
xy: 159, 82
size: 44, 44
orig: 44, 44
offset: 0, 0
index: -1
tree-minus
rotate: false
xy: 392, 6
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
tree-plus
rotate: false
xy: 68, 64
size: 12, 16
orig: 12, 16
offset: 0, 0
index: -1
tree-selection
rotate: false
xy: 413, 37
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
white
rotate: false
xy: 75, 5
size: 3, 3
orig: 3, 3
offset: 0, 0
index: -1
window
rotate: false
xy: 418, 65
size: 27, 61
split: 8, 8, 44, 11
orig: 27, 61
offset: 0, 0
index: -1
window-border-bg
rotate: false
xy: 495, 90
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
window-gray
rotate: false
xy: 331, 65
size: 27, 61
split: 5, 4, 52, 4
orig: 27, 61
offset: 0, 0
index: -1
window-noborder
rotate: false
xy: 360, 65
size: 27, 61
split: 5, 4, 53, 3
orig: 27, 61
offset: 0, 0
index: -1
window-resizable
rotate: false
xy: 389, 42
size: 27, 84
split: 3, 19, 2, 20
pad: 5, 5, 50, 7
orig: 27, 84
offset: 0, 0
index: -1

View File

@@ -205,7 +205,7 @@ public class BlockIndexer{
for(int x = Math.max(0, tile.x - oreQuadrantSize / 2); x < tile.x + oreQuadrantSize / 2 && x < world.width(); x++){ for(int x = Math.max(0, tile.x - oreQuadrantSize / 2); x < tile.x + oreQuadrantSize / 2 && x < world.width(); x++){
for(int y = Math.max(0, tile.y - oreQuadrantSize / 2); y < tile.y + oreQuadrantSize / 2 && y < world.height(); y++){ for(int y = Math.max(0, tile.y - oreQuadrantSize / 2); y < tile.y + oreQuadrantSize / 2 && y < world.height(); y++){
Tile res = world.tile(x, y); Tile res = world.tile(x, y);
if(res.block() == Blocks.air && res.floor().drops != null && res.floor().drops.item == item){ if(res.block() == Blocks.air && res.floor().itemDrop == item){
return res; return res;
} }
} }
@@ -243,9 +243,9 @@ public class BlockIndexer{
for(int x = quadrantX * structQuadrantSize; x < world.width() && x < (quadrantX + 1) * structQuadrantSize; x++){ for(int x = quadrantX * structQuadrantSize; x < world.width() && x < (quadrantX + 1) * structQuadrantSize; x++){
for(int y = quadrantY * structQuadrantSize; y < world.height() && y < (quadrantY + 1) * structQuadrantSize; y++){ for(int y = quadrantY * structQuadrantSize; y < world.height() && y < (quadrantY + 1) * structQuadrantSize; y++){
Tile result = world.tile(x, y); Tile result = world.tile(x, y);
if( result == null || result.block().drops == null || !scanOres.contains(result.block().drops.item)) continue; if( result == null || result.floor().itemDrop == null || !scanOres.contains(result.floor().itemDrop)) continue;
itemSet.add(result.block().drops.item); itemSet.add(result.floor().itemDrop);
} }
} }
@@ -322,8 +322,8 @@ public class BlockIndexer{
Tile tile = world.tile(x, y); Tile tile = world.tile(x, y);
//add position of quadrant to list when an ore is found //add position of quadrant to list when an ore is found
if(tile.floor().drops != null && scanOres.contains(tile.floor().drops.item) && tile.block() == Blocks.air){ if(tile.floor().itemDrop != null && scanOres.contains(tile.floor().itemDrop) && tile.block() == Blocks.air){
ores.get(tile.floor().drops.item).add(world.tile( ores.get(tile.floor().itemDrop).add(world.tile(
//make sure to clamp quadrant middle position, since it might go off bounds //make sure to clamp quadrant middle position, since it might go off bounds
Mathf.clamp(qx * oreQuadrantSize + oreQuadrantSize / 2, 0, world.width() - 1), Mathf.clamp(qx * oreQuadrantSize + oreQuadrantSize / 2, 0, world.width() - 1),
Mathf.clamp(qy * oreQuadrantSize + oreQuadrantSize / 2, 0, world.height() - 1))); Mathf.clamp(qy * oreQuadrantSize + oreQuadrantSize / 2, 0, world.height() - 1)));

View File

@@ -182,8 +182,6 @@ public class Pathfinder{
createFor(team); createFor(team);
} }
} }
world.spawner.checkAllQuadrants();
} }
class PathData{ class PathData{

View File

@@ -2,32 +2,18 @@ package io.anuke.mindustry.ai;
import io.anuke.arc.Events; import io.anuke.arc.Events;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.GridBits; import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf; import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.Blocks; import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.units.BaseUnit; import io.anuke.mindustry.entities.units.BaseUnit;
import io.anuke.mindustry.entities.units.Squad; import io.anuke.mindustry.entities.units.Squad;
import io.anuke.mindustry.game.EventType.WorldLoadEvent; import io.anuke.mindustry.game.EventType.WorldLoadEvent;
import io.anuke.mindustry.game.SpawnGroup; import io.anuke.mindustry.game.SpawnGroup;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Waves;
import io.anuke.mindustry.world.Tile;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
public class WaveSpawner{ public class WaveSpawner{
private static final int quadsize = 6;
private GridBits quadrants;
private Array<SpawnGroup> groups; private Array<SpawnGroup> groups;
private boolean dynamicSpawn;
private Array<FlyerSpawn> flySpawns = new Array<>(); private Array<FlyerSpawn> flySpawns = new Array<>();
private Array<GroundSpawn> groundSpawns = new Array<>(); private Array<GroundSpawn> groundSpawns = new Array<>();
@@ -35,273 +21,76 @@ public class WaveSpawner{
Events.on(WorldLoadEvent.class, e -> reset()); Events.on(WorldLoadEvent.class, e -> reset());
} }
public void write(DataOutput output) throws IOException{
output.writeShort(flySpawns.size);
for(FlyerSpawn spawn : flySpawns){
output.writeFloat(spawn.angle);
}
output.writeShort(groundSpawns.size);
for(GroundSpawn spawn : groundSpawns){
output.writeShort((short) spawn.x);
output.writeShort((short) spawn.y);
}
}
public void read(DataInput input) throws IOException{
short flya = input.readShort();
for(int i = 0; i < flya; i++){
FlyerSpawn spawn = new FlyerSpawn();
spawn.angle = input.readFloat();
flySpawns.add(spawn);
}
short grounda = input.readShort();
for(int i = 0; i < grounda; i++){
GroundSpawn spawn = new GroundSpawn();
spawn.x = input.readShort();
spawn.y = input.readShort();
groundSpawns.add(spawn);
}
}
public void spawnEnemies(){ public void spawnEnemies(){
int flyGroups = 0;
int groundGroups = 0;
//count total subgroups spawned by flying/group types
for(SpawnGroup group : groups){
int amount = group.getGroupsSpawned(state.wave);
if(group.type.isFlying){
flyGroups += amount;
}else if(dynamicSpawn){
groundGroups += amount;
}
}
int addGround = groundGroups - groundSpawns.size, addFly = flyGroups - flySpawns.size;
//add extra groups if the total exceeds it
if(dynamicSpawn){
for(int i = 0; i < addGround; i++){
GroundSpawn spawn = new GroundSpawn();
findLocation(spawn);
groundSpawns.add(spawn);
}
}
for(int i = 0; i < addFly; i++){
FlyerSpawn spawn = new FlyerSpawn();
findLocation(spawn);
flySpawns.add(spawn);
}
//store index of last used fly/ground spawn locations
int flyCount = 0, groundCount = 0;
for(SpawnGroup group : groups){ for(SpawnGroup group : groups){
int groups = group.getGroupsSpawned(state.wave);
int spawned = group.getUnitsSpawned(state.wave); int spawned = group.getUnitsSpawned(state.wave);
for(int i = 0; i < groups; i++){ float spawnX, spawnY;
Squad squad = new Squad(); float spread;
float spawnX, spawnY;
float spread;
if(!group.type.isFlying && groundCount >= groundSpawns.size) continue;
if(group.type.isFlying){
FlyerSpawn spawn = flySpawns.get(flyCount);
if(group.type.isFlying){
for(FlyerSpawn spawn : flySpawns){
Squad squad = new Squad();
float margin = 40f; //how far away from the edge flying units spawn float margin = 40f; //how far away from the edge flying units spawn
spawnX = world.width() * tilesize / 2f + sqrwavex(spawn.angle) * (world.width() / 2f * tilesize + margin); float trns = (world.width() + world.height()) * tilesize;
spawnY = world.height() * tilesize / 2f + sqrwavey(spawn.angle) * (world.height() / 2f * tilesize + margin); spawnX = Mathf.clamp(world.width() * tilesize / 2f + Angles.trnsx(spawn.angle, trns), -margin, world.width() * tilesize + margin);
spawnY = Mathf.clamp(world.height() * tilesize / 2f + Angles.trnsy(spawn.angle, trns), -margin, world.height() * tilesize + margin);
spread = margin / 1.5f; spread = margin / 1.5f;
flyCount++; for(int i = 0; i < spawned; i++){
}else{ //make sure it works for non-dynamic spawns BaseUnit unit = group.createUnit(waveTeam);
GroundSpawn spawn = groundSpawns.get(groundCount); unit.setWave();
unit.setSquad(squad);
if(dynamicSpawn){ unit.set(spawnX + Mathf.range(spread), spawnY + Mathf.range(spread));
checkQuadrant(spawn.x, spawn.y); unit.add();
if(!getQuad(spawn.x, spawn.y)){
findLocation(spawn);
}
} }
spawnX = spawn.x * quadsize * tilesize + quadsize * tilesize / 2f;
spawnY = spawn.y * quadsize * tilesize + quadsize * tilesize / 2f;
spread = quadsize * tilesize / 3f;
groundCount++;
} }
}else{
for(GroundSpawn spawn : groundSpawns){
Squad squad = new Squad();
spawnX = spawn.x * tilesize;
spawnY = spawn.y * tilesize;
spread = tilesize;
for(int j = 0; j < spawned; j++){ for(int i = 0; i < spawned; i++){
BaseUnit unit = group.createUnit(Team.red); BaseUnit unit = group.createUnit(waveTeam);
unit.setWave(); unit.setWave();
unit.setSquad(squad); unit.setSquad(squad);
unit.set(spawnX + Mathf.range(spread), spawnY + Mathf.range(spread)); unit.set(spawnX + Mathf.range(spread), spawnY + Mathf.range(spread));
unit.add(); unit.add();
} }
}
}
}
public void checkAllQuadrants(){
for(int x = 0; x < quadWidth(); x++){
for(int y = 0; y < quadHeight(); y++){
checkQuadrant(x, y);
}
}
}
private void checkQuadrant(int quadx, int quady){
setQuad(quadx, quady, true);
outer:
for(int x = quadx * quadsize; x < world.width() && x < (quadx + 1) * quadsize; x++){
for(int y = quady * quadsize; y < world.height() && y < (quady + 1) * quadsize; y++){
Tile tile = world.tile(x, y);
if(tile == null || tile.solid() || tile.getTeam() == defaultTeam || world.pathfinder.getValueforTeam(Team.red, x, y) == Float.MAX_VALUE || tile.floor().isLiquid){
setQuad(quadx, quady, false);
break outer;
} }
} }
} }
} }
private void reset(){ private void reset(){
dynamicSpawn = false;
flySpawns.clear(); flySpawns.clear();
groundSpawns.clear(); groundSpawns.clear();
quadrants = new GridBits(quadWidth(), quadHeight()); groups = state.rules.spawns;
groups = Waves.getSpawns();
dynamicSpawn = true;
for(int x = 0; x < world.width(); x++){ for(int x = 0; x < world.width(); x++){
for(int y = 0; y < world.height(); y++){ for(int y = 0; y < world.height(); y++){
if(world.tile(x, y).block() == Blocks.spawn){ if(world.tile(x, y).block() == Blocks.spawn){
dynamicSpawn = false;
GroundSpawn spawn = new GroundSpawn(); GroundSpawn spawn = new GroundSpawn();
spawn.x = x/quadsize; spawn.x = x;
spawn.y = y/quadsize; spawn.y = y;
groundSpawns.add(spawn); groundSpawns.add(spawn);
FlyerSpawn fspawn = new FlyerSpawn();
fspawn.angle = Angles.angle(world.width()/2f, world.height()/2f, x, y);
flySpawns.add(fspawn);
} }
} }
} }
} }
private boolean getQuad(int quadx, int quady){
return quadrants.get(quadx, quady);
}
private void setQuad(int quadx, int quady, boolean valid){
if(quadrants == null){
quadrants = new GridBits(quadWidth(), quadHeight());
}
if(!Structs.inBounds(quadx, quady, quadWidth(), quadHeight())){
return;
}
quadrants.set(quadx, quady, valid);
}
//TODO instead of randomly scattering locations around the map, find spawns close to each other
private void findLocation(GroundSpawn spawn){
spawn.x = Mathf.random(quadWidth()-1);
spawn.y = Mathf.random(quadHeight()-1);
int shellWidth = quadWidth() * 2 + quadHeight() * 2 * 6;
shellWidth = Math.min(quadWidth() * quadHeight() / 4, shellWidth);
traverseSpiral(quadWidth(), quadHeight(), Mathf.random(shellWidth), (x, y) -> {
if(getQuad(x, y)){
spawn.x = x;
spawn.y = y;
return true;
}
return false;
});
}
//TODO instead of randomly scattering locations around the map, find spawns close to each other
private void findLocation(FlyerSpawn spawn){
spawn.angle = Mathf.random(360f);
}
private int quadWidth(){
return Mathf.ceil(world.width() / (float) quadsize);
}
private int quadHeight(){
return Mathf.ceil(world.height() / (float) quadsize);
}
private class FlyerSpawn{ private class FlyerSpawn{
//square angle
float angle; float angle;
} }
private class GroundSpawn{ private class GroundSpawn{
//quadrant spawn coordinates
int x, y; int x, y;
} }
//utility methods
float sqrwavex(float degrees){
degrees = Mathf.mod(degrees, 360f);
if(degrees < 45){
return 1;
}else if(degrees < 135){
return 1f - (degrees - 45f) / 90f;
}else if(degrees < 225){
return -1f;
}else if(degrees < 315){
return (degrees - 225) / 90f;
}else{
return 1f;
}
}
float sqrwavey(float degrees){
return sqrwavex(degrees + 90f);
}
void traverseSpiral(int width, int height, int offset, SpiralTraverser con){
int directionIdx = 0;
int curRow = 0, curCol = 0;
for(int i = 0; i < height * width; i++){
if(i >= offset && con.accept(curCol, curRow)) break;
int same = 1, row = curRow, col = curCol;
if(row > height - 1 - row){
row = height - 1 - row;
same = 0;
}
if(col >= width - 1 - col){
col = width - 1 - col;
same = 0;
}
row -= same;
if(row == col){
directionIdx = (directionIdx + 1) % 4;
}
curRow += directions[directionIdx][0];
curCol += directions[directionIdx][1];
}
}
interface SpiralTraverser{
boolean accept(int x, int y);
}
private static int[][] directions = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
} }

View File

@@ -2,11 +2,9 @@ package io.anuke.mindustry.content;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.game.ContentList; import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.CacheLayer; import io.anuke.mindustry.graphics.CacheLayer;
import io.anuke.mindustry.type.Category;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -22,16 +20,20 @@ import io.anuke.mindustry.world.blocks.storage.CoreBlock;
import io.anuke.mindustry.world.blocks.storage.LaunchPad; import io.anuke.mindustry.world.blocks.storage.LaunchPad;
import io.anuke.mindustry.world.blocks.storage.SortedUnloader; import io.anuke.mindustry.world.blocks.storage.SortedUnloader;
import io.anuke.mindustry.world.blocks.storage.Vault; import io.anuke.mindustry.world.blocks.storage.Vault;
import io.anuke.mindustry.world.blocks.units.*; import io.anuke.mindustry.world.blocks.units.MechPad;
import io.anuke.mindustry.world.blocks.units.Reconstructor;
import io.anuke.mindustry.world.blocks.units.RepairPoint;
import io.anuke.mindustry.world.blocks.units.UnitFactory;
import static io.anuke.mindustry.Vars.content; import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.state;
public class Blocks implements ContentList{ public class Blocks implements ContentList{
public static Block public static Block
//environment //environment
air, blockpart, spawn, space, metalfloor, deepwater, water, tar, stone, blackstone, dirt, sand, ice, snow, air, part, spawn, space, metalfloor, deepwater, water, tar, stone, craters, blackstone, dirt, sand, ice, snow,
grass, shrub, rock, icerock, blackrock, rocksSmall, rocksMedium, grass, shrub, rock, icerock, blackrock, rocks,
//crafting //crafting
siliconSmelter, plastaniumCompressor, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer, siliconSmelter, plastaniumCompressor, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
@@ -61,7 +63,7 @@ public class Blocks implements ContentList{
core, vault, container, unloader, launchPad, core, vault, container, unloader, launchPad,
//turrets //turrets
duo, scorch, hail, wave, lancer, arc, swarmer, salvo, fuse, ripple, cyclone, spectre, meltdown, duo, hail, arc, wave, lancer, swarmer, salvo, fuse, ripple, cyclone, spectre, meltdown,
//units //units
spiritFactory, phantomFactory, wraithFactory, ghoulFactory, revenantFactory, daggerFactory, titanFactory, spiritFactory, phantomFactory, wraithFactory, ghoulFactory, revenantFactory, daggerFactory, titanFactory,
@@ -74,9 +76,7 @@ public class Blocks implements ContentList{
public void load(){ public void load(){
//region environment //region environment
air = new Floor("air"){ air = new Floor("air"){{
{
blend = false;
alwaysReplace = true; alwaysReplace = true;
} }
@@ -85,17 +85,10 @@ public class Blocks implements ContentList{
public void init(){} public void init(){}
}; };
blockpart = new BlockPart(); part = new BlockPart();
spawn = new Block("spawn"){ spawn = new Block("spawn"){
public void drawShadow(Tile tile){} public void drawShadow(Tile tile){}
public void draw(Tile tile){
Draw.color(Color.SCARLET);
Lines.circle(tile.worldx(), tile.worldy(), 4f +Mathf.absin(Time.time(), 6f, 6f));
Draw.color();
}
}; };
//Registers build blocks from size 1-6 //Registers build blocks from size 1-6
@@ -109,7 +102,6 @@ public class Blocks implements ContentList{
variants = 0; variants = 0;
cacheLayer = CacheLayer.space; cacheLayer = CacheLayer.space;
solid = true; solid = true;
blend = false;
minimapColor = Color.valueOf("000001"); minimapColor = Color.valueOf("000001");
}}; }};
@@ -157,9 +149,11 @@ public class Blocks implements ContentList{
stone = new Floor("stone"){{ stone = new Floor("stone"){{
hasOres = true; hasOres = true;
blends = block -> block != this && !(block instanceof OreBlock);
minimapColor = Color.valueOf("323232"); minimapColor = Color.valueOf("323232");
playerUnmineable = true; }};
craters = new Floor("craters"){{
minimapColor = Color.valueOf("323232");
}}; }};
blackstone = new Floor("blackstone"){{ blackstone = new Floor("blackstone"){{
@@ -173,7 +167,7 @@ public class Blocks implements ContentList{
}}; }};
sand = new Floor("sand"){{ sand = new Floor("sand"){{
drops = new ItemStack(Items.sand, 1); itemDrop = Items.sand;
minimapColor = Color.valueOf("988a67"); minimapColor = Color.valueOf("988a67");
hasOres = true; hasOres = true;
playerUnmineable = true; playerUnmineable = true;
@@ -210,22 +204,15 @@ public class Blocks implements ContentList{
variants = 1; variants = 1;
}}; }};
rocksSmall = new Rock("rocks-small"){{ rocks = new StaticWall("rocks"){{
variants = 2; variants = 2;
breakable = alwaysReplace = false;
solid = true;
}}; }};
rocksMedium = new Rock("rocks-medium"){{
variants = 2;
breakable = alwaysReplace = false;
solid = true;
}};
//endregion //endregion
//region crafting //region crafting
siliconSmelter = new PowerSmelter("silicon-smelter"){{ siliconSmelter = new PowerSmelter("silicon-smelter"){{
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.lead, 50));
health = 90; health = 90;
craftEffect = Fx.smeltsmoke; craftEffect = Fx.smeltsmoke;
result = Items.silicon; result = Items.silicon;
@@ -239,6 +226,7 @@ public class Blocks implements ContentList{
}}; }};
plastaniumCompressor = new PlastaniumCompressor("plastanium-compressor"){{ plastaniumCompressor = new PlastaniumCompressor("plastanium-compressor"){{
requirements(Category.crafting, ItemStack.with(Items.silicon, 160, Items.lead, 230, Items.graphite, 120, Items.titanium, 160));
hasItems = true; hasItems = true;
liquidCapacity = 60f; liquidCapacity = 60f;
craftTime = 60f; craftTime = 60f;
@@ -255,6 +243,7 @@ public class Blocks implements ContentList{
}}; }};
phaseWeaver = new PhaseWeaver("phase-weaver"){{ phaseWeaver = new PhaseWeaver("phase-weaver"){{
requirements(Category.crafting, ItemStack.with(Items.silicon, 260, Items.lead, 240, Items.thorium, 150));
craftEffect = Fx.smeltsmoke; craftEffect = Fx.smeltsmoke;
result = Items.phasefabric; result = Items.phasefabric;
craftTime = 120f; craftTime = 120f;
@@ -265,6 +254,7 @@ public class Blocks implements ContentList{
}}; }};
surgeSmelter = new PowerSmelter("alloy-smelter"){{ surgeSmelter = new PowerSmelter("alloy-smelter"){{
requirements(Category.crafting, ItemStack.with(Items.silicon, 160, Items.lead, 160, Items.thorium, 140));
craftEffect = Fx.smeltsmoke; craftEffect = Fx.smeltsmoke;
result = Items.surgealloy; result = Items.surgealloy;
craftTime = 75f; craftTime = 75f;
@@ -278,6 +268,7 @@ public class Blocks implements ContentList{
}}; }};
cryofluidMixer = new LiquidMixer("cryofluidmixer"){{ cryofluidMixer = new LiquidMixer("cryofluidmixer"){{
requirements(Category.crafting, ItemStack.with(Items.lead, 130, Items.silicon, 80, Items.thorium, 90));
outputLiquid = Liquids.cryofluid; outputLiquid = Liquids.cryofluid;
liquidPerItem = 50f; liquidPerItem = 50f;
size = 2; size = 2;
@@ -289,6 +280,7 @@ public class Blocks implements ContentList{
}}; }};
blastMixer = new GenericCrafter("blast-mixer"){{ blastMixer = new GenericCrafter("blast-mixer"){{
requirements(Category.crafting, ItemStack.with(Items.lead, 60, Items.titanium, 40));
hasItems = true; hasItems = true;
hasPower = true; hasPower = true;
hasLiquids = true; hasLiquids = true;
@@ -301,6 +293,7 @@ public class Blocks implements ContentList{
}}; }};
pyratiteMixer = new PowerSmelter("pyratite-mixer"){{ pyratiteMixer = new PowerSmelter("pyratite-mixer"){{
requirements(Category.crafting, ItemStack.with(Items.copper, 100, Items.lead, 50));
flameColor = Color.CLEAR; flameColor = Color.CLEAR;
hasItems = true; hasItems = true;
hasPower = true; hasPower = true;
@@ -313,6 +306,7 @@ public class Blocks implements ContentList{
}}; }};
melter = new PowerCrafter("melter"){{ melter = new PowerCrafter("melter"){{
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.lead, 70, Items.graphite, 90));
health = 200; health = 200;
outputLiquid = Liquids.slag; outputLiquid = Liquids.slag;
outputLiquidAmount = 1.5f; outputLiquidAmount = 1.5f;
@@ -324,11 +318,12 @@ public class Blocks implements ContentList{
}}; }};
separator = new Separator("separator"){{ separator = new Separator("separator"){{
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.titanium, 50));
results = new ItemStack[]{ results = new ItemStack[]{
new ItemStack(Items.copper, 5), new ItemStack(Items.copper, 5),
new ItemStack(Items.lead, 3), new ItemStack(Items.lead, 3),
new ItemStack(Items.titanium, 2), new ItemStack(Items.titanium, 2),
new ItemStack(Items.thorium, 1) new ItemStack(Items.thorium, 1)
}; };
hasPower = true; hasPower = true;
filterTime = 15f; filterTime = 15f;
@@ -343,6 +338,7 @@ public class Blocks implements ContentList{
}}; }};
biomatterCompressor = new Compressor("biomattercompressor"){{ biomatterCompressor = new Compressor("biomattercompressor"){{
requirements(Category.crafting, ItemStack.with(Items.lead, 70, Items.silicon, 60));
liquidCapacity = 60f; liquidCapacity = 60f;
craftTime = 20f; craftTime = 20f;
outputLiquid = Liquids.oil; outputLiquid = Liquids.oil;
@@ -356,6 +352,7 @@ public class Blocks implements ContentList{
}}; }};
pulverizer = new Pulverizer("pulverizer"){{ pulverizer = new Pulverizer("pulverizer"){{
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.lead, 50));
output = Items.sand; output = Items.sand;
craftEffect = Fx.pulverize; craftEffect = Fx.pulverize;
craftTime = 40f; craftTime = 40f;
@@ -367,73 +364,107 @@ public class Blocks implements ContentList{
}}; }};
incinerator = new Incinerator("incinerator"){{ incinerator = new Incinerator("incinerator"){{
requirements(Category.crafting, ItemStack.with(Items.graphite, 10, Items.lead, 30));
health = 90; health = 90;
}}; }};
//endregion //endregion
//region sandbox //region sandbox
powerVoid = new PowerVoid("power-void"); powerVoid = new PowerVoid("power-void"){{
powerSource = new PowerSource("power-source"); requirements(Category.power, () -> state.rules.infiniteResources, ItemStack.with());
itemSource = new ItemSource("item-source"); alwaysUnlocked = true;
itemVoid = new ItemVoid("item-void"); }};
liquidSource = new LiquidSource("liquid-source"); powerSource = new PowerSource("power-source"){{
requirements(Category.power, () -> state.rules.infiniteResources, ItemStack.with());
alwaysUnlocked = true;
}};
itemSource = new ItemSource("item-source"){{
requirements(Category.distribution, () -> state.rules.infiniteResources, ItemStack.with());
alwaysUnlocked = true;
}};
itemVoid = new ItemVoid("item-void"){{
requirements(Category.distribution, () -> state.rules.infiniteResources, ItemStack.with());
alwaysUnlocked = true;
}};
liquidSource = new LiquidSource("liquid-source"){{
requirements(Category.liquid, () -> state.rules.infiniteResources, ItemStack.with());
alwaysUnlocked = true;
}};
//endregion //endregion
//region defense //region defense
int wallHealthMultiplier = 3; int wallHealthMultiplier = 3;
copperWall = new Wall("copper-wall"){{ copperWall = new Wall("copper-wall"){{
requirements(Category.defense, ItemStack.with(Items.copper, 12));
health = 80 * wallHealthMultiplier; health = 80 * wallHealthMultiplier;
}}; }};
copperWallLarge = new Wall("copper-wall-large"){{ copperWallLarge = new Wall("copper-wall-large"){{
requirements(Category.defense, ItemStack.with(Items.copper, 12 * 4));
requirements(Category.defense, ItemStack.with(Items.copper, 12));
health = 80 * 4 * wallHealthMultiplier; health = 80 * 4 * wallHealthMultiplier;
size = 2; size = 2;
}}; }};
titaniumWall = new Wall("titanium-wall"){{ titaniumWall = new Wall("titanium-wall"){{
requirements(Category.defense, ItemStack.with(Items.titanium, 12));
health = 110 * wallHealthMultiplier; health = 110 * wallHealthMultiplier;
}}; }};
titaniumWallLarge = new Wall("titanium-wall-large"){{ titaniumWallLarge = new Wall("titanium-wall-large"){{
requirements(Category.defense, ItemStack.with(Items.titanium, 12 * 4));
requirements(Category.defense, ItemStack.with(Items.titanium, 12));
health = 110 * wallHealthMultiplier * 4; health = 110 * wallHealthMultiplier * 4;
size = 2; size = 2;
}}; }};
thoriumWall = new Wall("thorium-wall"){{ thoriumWall = new Wall("thorium-wall"){{
requirements(Category.defense, ItemStack.with(Items.thorium, 12));
health = 200 * wallHealthMultiplier; health = 200 * wallHealthMultiplier;
}}; }};
thoriumWallLarge = new Wall("thorium-wall-large"){{ thoriumWallLarge = new Wall("thorium-wall-large"){{
requirements(Category.defense, ItemStack.with(Items.thorium, 12 * 4));
requirements(Category.defense, ItemStack.with(Items.thorium, 12));
health = 200 * wallHealthMultiplier * 4; health = 200 * wallHealthMultiplier * 4;
size = 2; size = 2;
}}; }};
phaseWall = new DeflectorWall("phase-wall"){{ phaseWall = new DeflectorWall("phase-wall"){{
requirements(Category.defense, ItemStack.with(Items.phasefabric, 12));
health = 150 * wallHealthMultiplier; health = 150 * wallHealthMultiplier;
}}; }};
phaseWallLarge = new DeflectorWall("phase-wall-large"){{ phaseWallLarge = new DeflectorWall("phase-wall-large"){{
requirements(Category.defense, ItemStack.with(Items.phasefabric, 12 * 4));
requirements(Category.defense, ItemStack.with(Items.phasefabric, 12));
health = 150 * 4 * wallHealthMultiplier; health = 150 * 4 * wallHealthMultiplier;
size = 2; size = 2;
}}; }};
surgeWall = new SurgeWall("surge-wall"){{ surgeWall = new SurgeWall("surge-wall"){{
requirements(Category.defense, ItemStack.with(Items.surgealloy, 12));
health = 230 * wallHealthMultiplier; health = 230 * wallHealthMultiplier;
}}; }};
surgeWallLarge = new SurgeWall("surge-wall-large"){{ surgeWallLarge = new SurgeWall("surge-wall-large"){{
requirements(Category.defense, ItemStack.with(Items.surgealloy, 12 * 4));
requirements(Category.defense, ItemStack.with(Items.surgealloy, 12));
health = 230 * 4 * wallHealthMultiplier; health = 230 * 4 * wallHealthMultiplier;
size = 2; size = 2;
}}; }};
door = new Door("door"){{ door = new Door("door"){{
requirements(Category.defense, ItemStack.with(Items.titanium, 12, Items.silicon, 8));
health = 100 * wallHealthMultiplier; health = 100 * wallHealthMultiplier;
}}; }};
doorLarge = new Door("door-large"){{ doorLarge = new Door("door-large"){{
requirements(Category.defense, ItemStack.with(Items.titanium, 12 * 4, Items.silicon, 8 * 4));
requirements(Category.defense, ItemStack.with(Items.titanium, 12, Items.silicon, 8));
openfx = Fx.dooropenlarge; openfx = Fx.dooropenlarge;
closefx = Fx.doorcloselarge; closefx = Fx.doorcloselarge;
health = 100 * 4 * wallHealthMultiplier; health = 100 * 4 * wallHealthMultiplier;
@@ -441,85 +472,107 @@ public class Blocks implements ContentList{
}}; }};
mendProjector = new MendProjector("mend-projector"){{ mendProjector = new MendProjector("mend-projector"){{
requirements(Category.effect, ItemStack.with(Items.lead, 200, Items.titanium, 150, Items.titanium, 50, Items.silicon, 180));
consumes.power(0.2f, 1.0f); consumes.power(0.2f, 1.0f);
size = 2; size = 2;
consumes.item(Items.phasefabric).optional(true); consumes.item(Items.phasefabric).optional(true);
}}; }};
overdriveProjector = new OverdriveProjector("overdrive-projector"){{ overdriveProjector = new OverdriveProjector("overdrive-projector"){{
requirements(Category.effect, ItemStack.with(Items.lead, 200, Items.titanium, 150, Items.titanium, 150, Items.silicon, 250));
consumes.power(0.35f, 1.0f); consumes.power(0.35f, 1.0f);
size = 2; size = 2;
consumes.item(Items.phasefabric).optional(true); consumes.item(Items.phasefabric).optional(true);
}}; }};
forceProjector = new ForceProjector("force-projector"){{ forceProjector = new ForceProjector("force-projector"){{
requirements(Category.effect, ItemStack.with(Items.lead, 200, Items.titanium, 150, Items.titanium, 150, Items.silicon, 250));
size = 3; size = 3;
consumes.item(Items.phasefabric).optional(true); consumes.item(Items.phasefabric).optional(true);
}}; }};
shockMine = new ShockMine("shock-mine"){{ shockMine = new ShockMine("shock-mine"){{
requirements(Category.effect, ItemStack.with(Items.lead, 50, Items.silicon, 25));
health = 40; health = 40;
damage = 11; damage = 11;
tileDamage = 7f; tileDamage = 7f;
length = 10; length = 10;
tendrils = 5; tendrils = 5;
}}; }};
//endregion //endregion
//region distribution //region distribution
conveyor = new Conveyor("conveyor"){{ conveyor = new Conveyor("conveyor"){{
requirements(Category.distribution, ItemStack.with(Items.copper, 1), true);
health = 45; health = 45;
speed = 0.03f; speed = 0.03f;
}}; }};
titaniumConveyor = new Conveyor("titanium-conveyor"){{ titaniumConveyor = new Conveyor("titanium-conveyor"){{
requirements(Category.distribution, ItemStack.with(Items.copper, 2, Items.titanium, 1));
health = 65; health = 65;
speed = 0.07f; speed = 0.07f;
}}; }};
junction = new Junction("junction"){{ junction = new Junction("junction"){{
requirements(Category.distribution, ItemStack.with(Items.copper, 2));
speed = 26; speed = 26;
capacity = 32; capacity = 32;
}}; }};
itemBridge = new BufferedItemBridge("bridge-conveyor"){{ itemBridge = new BufferedItemBridge("bridge-conveyor"){{
requirements(Category.distribution, ItemStack.with(Items.titanium, 8, Items.copper, 8));
range = 4; range = 4;
speed = 60f; speed = 60f;
bufferCapacity = 15; bufferCapacity = 15;
}}; }};
phaseConveyor = new ItemBridge("phase-conveyor"){{ phaseConveyor = new ItemBridge("phase-conveyor"){{
requirements(Category.distribution, ItemStack.with(Items.phasefabric, 10, Items.silicon, 15, Items.lead, 20, Items.graphite, 20));
range = 12; range = 12;
hasPower = true; hasPower = true;
consumes.power(0.03f, 1.0f); consumes.power(0.03f, 1.0f);
}}; }};
sorter = new Sorter("sorter"); sorter = new Sorter("sorter"){{
requirements(Category.distribution, ItemStack.with(Items.titanium, 4, Items.copper, 4));
router = new Router("router"); }};
router = new Router("router"){{
requirements(Category.distribution, ItemStack.with(Items.copper, 6));
}};
distributor = new Router("distributor"){{ distributor = new Router("distributor"){{
requirements(Category.distribution, ItemStack.with(Items.titanium, 8, Items.copper, 8));
size = 2; size = 2;
}}; }};
overflowGate = new OverflowGate("overflow-gate"); overflowGate = new OverflowGate("overflow-gate"){{
requirements(Category.distribution, ItemStack.with(Items.titanium, 4, Items.copper, 8));
}};
massDriver = new MassDriver("mass-driver"){{ massDriver = new MassDriver("mass-driver"){{
requirements(Category.distribution, ItemStack.with(Items.titanium, 250, Items.silicon, 150, Items.lead, 250, Items.thorium, 100));
size = 3; size = 3;
itemCapacity = 60; itemCapacity = 60;
range = 440f; range = 440f;
}}; }};
//endregion //endregion
//region liquid //region liquid
mechanicalPump = new Pump("mechanical-pump"){{ mechanicalPump = new Pump("mechanical-pump"){{
requirements(Category.liquid, ItemStack.with(Items.copper, 30, Items.lead, 20));
pumpAmount = 0.1f; pumpAmount = 0.1f;
tier = 0; tier = 0;
}}; }};
rotaryPump = new Pump("rotary-pump"){{ rotaryPump = new Pump("rotary-pump"){{
requirements(Category.liquid, ItemStack.with(Items.copper, 140, Items.lead, 100, Items.silicon, 40, Items.titanium, 70));
pumpAmount = 0.2f; pumpAmount = 0.2f;
consumes.power(0.015f); consumes.power(0.015f);
liquidCapacity = 30f; liquidCapacity = 30f;
@@ -529,6 +582,7 @@ public class Blocks implements ContentList{
}}; }};
thermalPump = new Pump("thermal-pump"){{ thermalPump = new Pump("thermal-pump"){{
requirements(Category.liquid, ItemStack.with(Items.copper, 160, Items.lead, 130, Items.silicon, 60, Items.titanium, 80, Items.thorium, 70));
pumpAmount = 0.275f; pumpAmount = 0.275f;
consumes.power(0.03f); consumes.power(0.03f);
liquidCapacity = 40f; liquidCapacity = 40f;
@@ -538,47 +592,83 @@ public class Blocks implements ContentList{
}}; }};
conduit = new Conduit("conduit"){{ conduit = new Conduit("conduit"){{
requirements(Category.liquid, ItemStack.with(Items.lead, 1));
health = 45; health = 45;
}}; }};
pulseConduit = new Conduit("pulse-conduit"){{ pulseConduit = new Conduit("pulse-conduit"){{
requirements(Category.liquid, ItemStack.with(Items.titanium, 1, Items.lead, 1));
liquidCapacity = 16f; liquidCapacity = 16f;
liquidFlowFactor = 4.9f; liquidFlowFactor = 4.9f;
health = 90; health = 90;
}}; }};
liquidRouter = new LiquidRouter("liquid-router"){{ liquidRouter = new LiquidRouter("liquid-router"){{
requirements(Category.liquid, ItemStack.with(Items.titanium, 4, Items.lead, 4));
liquidCapacity = 20f; liquidCapacity = 20f;
}}; }};
liquidTank = new LiquidTank("liquid-tank"){{ liquidTank = new LiquidTank("liquid-tank"){{
requirements(Category.liquid, ItemStack.with(Items.titanium, 50, Items.lead, 50));
size = 3; size = 3;
liquidCapacity = 1500f; liquidCapacity = 1500f;
health = 500; health = 500;
}}; }};
liquidJunction = new LiquidJunction("liquid-junction"); liquidJunction = new LiquidJunction("liquid-junction"){{
requirements(Category.liquid, ItemStack.with(Items.titanium, 4, Items.lead, 4));
}};
bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{ bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{
requirements(Category.liquid, ItemStack.with(Items.titanium, 8, Items.lead, 8));
range = 4; range = 4;
hasPower = false; hasPower = false;
}}; }};
phaseConduit = new LiquidBridge("phase-conduit"){{ phaseConduit = new LiquidBridge("phase-conduit"){{
requirements(Category.liquid, ItemStack.with(Items.phasefabric, 10, Items.silicon, 15, Items.lead, 20, Items.titanium, 20));
range = 12; range = 12;
hasPower = true; hasPower = true;
consumes.power(0.03f, 1.0f); consumes.power(0.03f, 1.0f);
}}; }};
//endregion //endregion
//region power //region power
powerNode = new PowerNode("power-node"){{
requirements(Category.power, ItemStack.with(Items.copper, 2, Items.lead, 6));
maxNodes = 4;
laserRange = 6;
}};
powerNodeLarge = new PowerNode("power-node-large"){{
requirements(Category.power, ItemStack.with(Items.titanium, 10, Items.lead, 20, Items.silicon, 6));
requirements(Category.power, ItemStack.with(Items.copper, 2, Items.lead, 6));
size = 2;
maxNodes = 6;
laserRange = 9.5f;
}};
battery = new Battery("battery"){{
requirements(Category.power, ItemStack.with(Items.copper, 8, Items.lead, 30, Items.silicon, 4));
consumes.powerBuffered(320f, 1f);
}};
batteryLarge = new Battery("battery-large"){{
requirements(Category.power, ItemStack.with(Items.titanium, 40, Items.lead, 80, Items.silicon, 30));
requirements(Category.power, ItemStack.with(Items.copper, 8, Items.lead, 30, Items.silicon, 4));
size = 3;
consumes.powerBuffered(2000f, 1f);
}};
combustionGenerator = new BurnerGenerator("combustion-generator"){{ combustionGenerator = new BurnerGenerator("combustion-generator"){{
requirements(Category.power, ItemStack.with(Items.copper, 50, Items.lead, 30));
powerProduction = 0.09f; powerProduction = 0.09f;
itemDuration = 40f; itemDuration = 40f;
}}; }};
thermalGenerator = new LiquidHeatGenerator("thermal-generator"){{ thermalGenerator = new LiquidHeatGenerator("thermal-generator"){{
requirements(Category.power, ItemStack.with(Items.copper, 80, Items.graphite, 70, Items.lead, 100, Items.silicon, 70, Items.thorium, 70));
maxLiquidGenerate = 2f; maxLiquidGenerate = 2f;
powerProduction = 2f; powerProduction = 2f;
generateEffect = Fx.redgeneratespark; generateEffect = Fx.redgeneratespark;
@@ -586,6 +676,7 @@ public class Blocks implements ContentList{
}}; }};
turbineGenerator = new TurbineGenerator("turbine-generator"){{ turbineGenerator = new TurbineGenerator("turbine-generator"){{
requirements(Category.power, ItemStack.with(Items.copper, 70, Items.graphite, 50, Items.lead, 80, Items.silicon, 60));
powerProduction = 0.28f; powerProduction = 0.28f;
itemDuration = 30f; itemDuration = 30f;
consumes.liquid(Liquids.water, 0.05f); consumes.liquid(Liquids.water, 0.05f);
@@ -593,21 +684,25 @@ public class Blocks implements ContentList{
}}; }};
rtgGenerator = new DecayGenerator("rtg-generator"){{ rtgGenerator = new DecayGenerator("rtg-generator"){{
requirements(Category.power, ItemStack.with(Items.lead, 200, Items.silicon, 150, Items.phasefabric, 50, Items.plastanium, 150, Items.thorium, 100));
size = 2; size = 2;
powerProduction = 0.3f; powerProduction = 0.3f;
itemDuration = 220f; itemDuration = 220f;
}}; }};
solarPanel = new SolarGenerator("solar-panel"){{ solarPanel = new SolarGenerator("solar-panel"){{
requirements(Category.power, ItemStack.with(Items.lead, 20, Items.silicon, 30));
powerProduction = 0.0045f; powerProduction = 0.0045f;
}}; }};
largeSolarPanel = new SolarGenerator("solar-panel-large"){{ largeSolarPanel = new SolarGenerator("solar-panel-large"){{
requirements(Category.power, ItemStack.with(Items.lead, 200, Items.silicon, 290, Items.phasefabric, 30));
size = 3; size = 3;
powerProduction = 0.055f; powerProduction = 0.055f;
}}; }};
thoriumReactor = new NuclearReactor("thorium-reactor"){{ thoriumReactor = new NuclearReactor("thorium-reactor"){{
requirements(Category.power, ItemStack.with(Items.lead, 600, Items.silicon, 400, Items.graphite, 300, Items.thorium, 300));
size = 3; size = 3;
health = 700; health = 700;
powerProduction = 1.1f; powerProduction = 1.1f;
@@ -618,45 +713,28 @@ public class Blocks implements ContentList{
health = 600; health = 600;
}}; }};
battery = new Battery("battery"){{
consumes.powerBuffered(320f, 1f);
}};
batteryLarge = new Battery("battery-large"){{
size = 3;
consumes.powerBuffered(2000f, 1f);
}};
powerNode = new PowerNode("power-node"){{
maxNodes = 4;
laserRange = 6;
}};
powerNodeLarge = new PowerNode("power-node-large"){{
size = 2;
maxNodes = 6;
laserRange = 9.5f;
}};
//endregion power //endregion power
//region production //region production
mechanicalDrill = new Drill("mechanical-drill"){{ mechanicalDrill = new Drill("mechanical-drill"){{
requirements(Category.production, ItemStack.with(Items.copper, 20), true);
tier = 2; tier = 2;
drillTime = 300; drillTime = 600;
size = 2; size = 2;
drawMineItem = true; drawMineItem = true;
}}; }};
pneumaticDrill = new Drill("pneumatic-drill"){{ pneumaticDrill = new Drill("pneumatic-drill"){{
requirements(Category.production, ItemStack.with(Items.copper, 60, Items.graphite, 50));
tier = 3; tier = 3;
drillTime = 240; drillTime = 480;
size = 2; size = 2;
drawMineItem = true; drawMineItem = true;
}}; }};
laserDrill = new Drill("laser-drill"){{ laserDrill = new Drill("laser-drill"){{
drillTime = 140; requirements(Category.production, ItemStack.with(Items.copper, 70, Items.graphite, 90, Items.silicon, 60, Items.titanium, 50));
drillTime = 280;
size = 2; size = 2;
hasPower = true; hasPower = true;
tier = 4; tier = 4;
@@ -667,7 +745,8 @@ public class Blocks implements ContentList{
}}; }};
blastDrill = new Drill("blast-drill"){{ blastDrill = new Drill("blast-drill"){{
drillTime = 60; requirements(Category.production, ItemStack.with(Items.copper, 130, Items.silicon, 120, Items.titanium, 100, Items.thorium, 60));
drillTime = 120;
size = 3; size = 3;
drawRim = true; drawRim = true;
hasPower = true; hasPower = true;
@@ -683,7 +762,7 @@ public class Blocks implements ContentList{
plasmaDrill = new Drill("plasma-drill"){{ plasmaDrill = new Drill("plasma-drill"){{
heatColor = Color.valueOf("ff461b"); heatColor = Color.valueOf("ff461b");
drillTime = 50; drillTime = 100;
size = 4; size = 4;
hasLiquids = true; hasLiquids = true;
hasPower = true; hasPower = true;
@@ -699,6 +778,7 @@ public class Blocks implements ContentList{
}}; }};
waterExtractor = new SolidPump("water-extractor"){{ waterExtractor = new SolidPump("water-extractor"){{
requirements(Category.production, ItemStack.with(Items.copper, 50, Items.graphite, 50, Items.lead, 40));
result = Liquids.water; result = Liquids.water;
pumpAmount = 0.065f; pumpAmount = 0.065f;
size = 2; size = 2;
@@ -709,6 +789,7 @@ public class Blocks implements ContentList{
}}; }};
oilExtractor = new Fracker("oil-extractor"){{ oilExtractor = new Fracker("oil-extractor"){{
requirements(Category.production, ItemStack.with(Items.copper, 300, Items.graphite, 350, Items.lead, 230, Items.thorium, 230, Items.silicon, 150));
result = Liquids.oil; result = Liquids.oil;
updateEffect = Fx.pulverize; updateEffect = Fx.pulverize;
liquidCapacity = 50f; liquidCapacity = 50f;
@@ -723,6 +804,7 @@ public class Blocks implements ContentList{
}}; }};
cultivator = new Cultivator("cultivator"){{ cultivator = new Cultivator("cultivator"){{
requirements(Category.production, ItemStack.with(Items.copper, 20, Items.lead, 50, Items.silicon, 20));
result = Items.biomatter; result = Items.biomatter;
drillTime = 200; drillTime = 200;
size = 2; size = 2;
@@ -732,61 +814,74 @@ public class Blocks implements ContentList{
consumes.power(0.08f); consumes.power(0.08f);
consumes.liquid(Liquids.water, 0.15f); consumes.liquid(Liquids.water, 0.15f);
}}; }};
//endregion //endregion
//region storage //region storage
core = new CoreBlock("core"){{ core = new CoreBlock("core"){{
requirements(Category.effect, () -> false, ItemStack.with(Items.titanium, 2000));
alwaysUnlocked = true;
health = 1100; health = 1100;
itemCapacity = 2000; itemCapacity = 1000;
launchThreshold = 500;
launchTime = 60f * 10;
launchChunkSize = 100;
}}; }};
vault = new Vault("vault"){{ vault = new Vault("vault"){{
requirements(Category.effect, ItemStack.with(Items.titanium, 500, Items.thorium, 250));
size = 3; size = 3;
itemCapacity = 1000; itemCapacity = 1000;
}}; }};
container = new Vault("container"){{ container = new Vault("container"){{
requirements(Category.effect, ItemStack.with(Items.titanium, 200));
size = 2; size = 2;
itemCapacity = 300; itemCapacity = 300;
}}; }};
unloader = new SortedUnloader("unloader"){{ unloader = new SortedUnloader("unloader"){{
requirements(Category.distribution, ItemStack.with(Items.titanium, 50, Items.silicon, 60));
speed = 7f; speed = 7f;
}}; }};
launchPad = new LaunchPad("launch-pad"){{ launchPad = new LaunchPad("launch-pad"){{
requirements(Category.effect, ItemStack.with(Items.copper, 500));
size = 3; size = 3;
itemCapacity = 100; itemCapacity = 100;
launchTime = 60f * 6; launchTime = 60f * 6;
hasPower = true;
consumes.power(0.1f); consumes.power(0.1f);
}}; }};
//endregion //endregion
//region turrets //region turrets
duo = new DoubleTurret("duo"){{ duo = new DoubleTurret("duo"){{
requirements(Category.turret, ItemStack.with(Items.copper, 60), true);
ammo( ammo(
Items.copper, Bullets.standardCopper, Items.copper, Bullets.standardCopper,
Items.graphite, Bullets.standardDense, Items.graphite, Bullets.standardDense,
Items.pyratite, Bullets.standardIncendiary, Items.pyratite, Bullets.standardIncendiary,
Items.silicon, Bullets.standardHoming Items.silicon, Bullets.standardHoming
); );
reload = 25f; reload = 20f;
restitution = 0.03f; restitution = 0.03f;
range = 90f; range = 90f;
shootCone = 15f; shootCone = 15f;
ammoUseEffect = Fx.shellEjectSmall; ammoUseEffect = Fx.shellEjectSmall;
health = 80; health = 110;
inaccuracy = 2f; inaccuracy = 2f;
rotatespeed = 10f; rotatespeed = 10f;
}}; }};
hail = new ArtilleryTurret("hail"){{ hail = new ArtilleryTurret("hail"){{
requirements(Category.turret, ItemStack.with(Items.copper, 60, Items.graphite, 35));
ammo( ammo(
Items.graphite, Bullets.artilleryDense, Items.graphite, Bullets.artilleryDense,
Items.silicon, Bullets.artilleryHoming, Items.silicon, Bullets.artilleryHoming,
Items.pyratite, Bullets.artlleryIncendiary Items.pyratite, Bullets.artlleryIncendiary
); );
reload = 60f; reload = 60f;
recoil = 2f; recoil = 2f;
@@ -796,21 +891,13 @@ public class Blocks implements ContentList{
health = 120; health = 120;
}}; }};
scorch = new LiquidTurret("scorch"){{
ammo(Liquids.oil, Bullets.basicFlame);
recoil = 0f;
reload = 4f;
shootCone = 50f;
ammoUseEffect = Fx.shellEjectSmall;
health = 160;
}};
wave = new LiquidTurret("wave"){{ wave = new LiquidTurret("wave"){{
requirements(Category.turret, ItemStack.with(Items.titanium, 70, Items.lead, 150));
ammo( ammo(
Liquids.water, Bullets.waterShot, Liquids.water, Bullets.waterShot,
Liquids.slag, Bullets.slagShot, Liquids.slag, Bullets.slagShot,
Liquids.cryofluid, Bullets.cryoShot, Liquids.cryofluid, Bullets.cryoShot,
Liquids.oil, Bullets.oilShot Liquids.oil, Bullets.oilShot
); );
size = 2; size = 2;
recoil = 0f; recoil = 0f;
@@ -832,6 +919,7 @@ public class Blocks implements ContentList{
}}; }};
lancer = new ChargeTurret("lancer"){{ lancer = new ChargeTurret("lancer"){{
requirements(Category.turret, ItemStack.with(Items.copper, 50, Items.lead, 100, Items.silicon, 90));
range = 90f; range = 90f;
chargeTime = 60f; chargeTime = 60f;
chargeMaxDelay = 30f; chargeMaxDelay = 30f;
@@ -854,6 +942,7 @@ public class Blocks implements ContentList{
}}; }};
arc = new PowerTurret("arc"){{ arc = new PowerTurret("arc"){{
requirements(Category.turret, ItemStack.with(Items.copper, 70, Items.lead, 60));
shootType = Bullets.arc; shootType = Bullets.arc;
reload = 85f; reload = 85f;
shootShake = 1f; shootShake = 1f;
@@ -869,10 +958,11 @@ public class Blocks implements ContentList{
}}; }};
swarmer = new BurstTurret("swarmer"){{ swarmer = new BurstTurret("swarmer"){{
requirements(Category.turret, ItemStack.with(Items.graphite, 70, Items.titanium, 70, Items.plastanium, 90, Items.silicon, 60));
ammo( ammo(
Items.blastCompound, Bullets.missileExplosive, Items.blastCompound, Bullets.missileExplosive,
Items.pyratite, Bullets.missileIncendiary, Items.pyratite, Bullets.missileIncendiary,
Items.surgealloy, Bullets.missileSurge Items.surgealloy, Bullets.missileSurge
); );
reload = 50f; reload = 50f;
shots = 4; shots = 4;
@@ -885,12 +975,13 @@ public class Blocks implements ContentList{
}}; }};
salvo = new BurstTurret("salvo"){{ salvo = new BurstTurret("salvo"){{
requirements(Category.turret, ItemStack.with(Items.copper, 210, Items.graphite, 190, Items.thorium, 130));
ammo( ammo(
Items.copper, Bullets.standardCopper, Items.copper, Bullets.standardCopper,
Items.graphite, Bullets.standardDense, Items.graphite, Bullets.standardDense,
Items.pyratite, Bullets.standardIncendiary, Items.pyratite, Bullets.standardIncendiary,
Items.silicon, Bullets.standardHoming, Items.silicon, Bullets.standardHoming,
Items.thorium, Bullets.standardThorium Items.thorium, Bullets.standardThorium
); );
size = 2; size = 2;
@@ -908,12 +999,13 @@ public class Blocks implements ContentList{
}}; }};
ripple = new ArtilleryTurret("ripple"){{ ripple = new ArtilleryTurret("ripple"){{
requirements(Category.turret, ItemStack.with(Items.copper, 300, Items.graphite, 220, Items.thorium, 120));
ammo( ammo(
Items.graphite, Bullets.artilleryDense, Items.graphite, Bullets.artilleryDense,
Items.silicon, Bullets.artilleryHoming, Items.silicon, Bullets.artilleryHoming,
Items.pyratite, Bullets.artlleryIncendiary, Items.pyratite, Bullets.artlleryIncendiary,
Items.blastCompound, Bullets.artilleryExplosive, Items.blastCompound, Bullets.artilleryExplosive,
Items.plastanium, Bullets.arilleryPlastic Items.plastanium, Bullets.arilleryPlastic
); );
size = 3; size = 3;
shots = 4; shots = 4;
@@ -932,10 +1024,11 @@ public class Blocks implements ContentList{
}}; }};
cyclone = new ItemTurret("cyclone"){{ cyclone = new ItemTurret("cyclone"){{
requirements(Category.turret, ItemStack.with(Items.copper, 400, Items.surgealloy, 200, Items.plastanium, 150));
ammo( ammo(
Items.blastCompound, Bullets.flakExplosive, Items.blastCompound, Bullets.flakExplosive,
Items.plastanium, Bullets.flakPlastic, Items.plastanium, Bullets.flakPlastic,
Items.surgealloy, Bullets.flakSurge Items.surgealloy, Bullets.flakSurge
); );
xRand = 4f; xRand = 4f;
reload = 8f; reload = 8f;
@@ -950,6 +1043,7 @@ public class Blocks implements ContentList{
}}; }};
fuse = new ItemTurret("fuse"){{ fuse = new ItemTurret("fuse"){{
requirements(Category.turret, ItemStack.with(Items.copper, 450, Items.graphite, 450, Items.surgealloy, 250));
ammo(Items.graphite, Bullets.fuseShot); ammo(Items.graphite, Bullets.fuseShot);
reload = 50f; reload = 50f;
shootShake = 4f; shootShake = 4f;
@@ -962,10 +1056,11 @@ public class Blocks implements ContentList{
}}; }};
spectre = new DoubleTurret("spectre"){{ spectre = new DoubleTurret("spectre"){{
requirements(Category.turret, ItemStack.with(Items.copper, 700, Items.graphite, 600, Items.surgealloy, 500, Items.plastanium, 350, Items.thorium, 500));
ammo( ammo(
Items.graphite, Bullets.standardDenseBig, Items.graphite, Bullets.standardDenseBig,
Items.pyratite, Bullets.standardIncendiaryBig, Items.pyratite, Bullets.standardIncendiaryBig,
Items.thorium, Bullets.standardThoriumBig Items.thorium, Bullets.standardThoriumBig
); );
reload = 6f; reload = 6f;
coolantMultiplier = 0.5f; coolantMultiplier = 0.5f;
@@ -986,6 +1081,7 @@ public class Blocks implements ContentList{
}}; }};
meltdown = new LaserTurret("meltdown"){{ meltdown = new LaserTurret("meltdown"){{
requirements(Category.turret, ItemStack.with(Items.copper, 500, Items.lead, 700, Items.graphite, 600, Items.surgealloy, 650, Items.silicon, 650));
shootType = Bullets.meltdownLaser; shootType = Bullets.meltdownLaser;
shootEffect = Fx.shootBigSmoke2; shootEffect = Fx.shootBigSmoke2;
shootCone = 40f; shootCone = 40f;
@@ -1001,11 +1097,12 @@ public class Blocks implements ContentList{
health = 165 * size * size; health = 165 * size * size;
}}; }};
//endregion //endregion
//region units //region units
spiritFactory = new UnitFactory("spirit-factory"){{ spiritFactory = new UnitFactory("spirit-factory"){{
requirements(Category.units, ItemStack.with(Items.copper, 70, Items.lead, 110, Items.silicon, 130));
type = UnitTypes.spirit; type = UnitTypes.spirit;
produceTime = 5700; produceTime = 5700;
size = 2; size = 2;
@@ -1014,6 +1111,7 @@ public class Blocks implements ContentList{
}}; }};
phantomFactory = new UnitFactory("phantom-factory"){{ phantomFactory = new UnitFactory("phantom-factory"){{
requirements(Category.units, ItemStack.with(Items.titanium, 90, Items.thorium, 80, Items.lead, 110, Items.silicon, 210));
type = UnitTypes.phantom; type = UnitTypes.phantom;
produceTime = 7300; produceTime = 7300;
size = 2; size = 2;
@@ -1022,6 +1120,7 @@ public class Blocks implements ContentList{
}}; }};
wraithFactory = new UnitFactory("wraith-factory"){{ wraithFactory = new UnitFactory("wraith-factory"){{
requirements(Category.units, ItemStack.with(Items.titanium, 60, Items.lead, 80, Items.silicon, 90));
type = UnitTypes.wraith; type = UnitTypes.wraith;
produceTime = 1800; produceTime = 1800;
size = 2; size = 2;
@@ -1030,6 +1129,7 @@ public class Blocks implements ContentList{
}}; }};
ghoulFactory = new UnitFactory("ghoul-factory"){{ ghoulFactory = new UnitFactory("ghoul-factory"){{
requirements(Category.units, ItemStack.with(Items.plastanium, 80, Items.titanium, 100, Items.lead, 130, Items.silicon, 220));
type = UnitTypes.ghoul; type = UnitTypes.ghoul;
produceTime = 3600; produceTime = 3600;
size = 3; size = 3;
@@ -1038,6 +1138,7 @@ public class Blocks implements ContentList{
}}; }};
revenantFactory = new UnitFactory("revenant-factory"){{ revenantFactory = new UnitFactory("revenant-factory"){{
requirements(Category.units, ItemStack.with(Items.plastanium, 300, Items.titanium, 400, Items.lead, 300, Items.silicon, 400, Items.surgealloy, 100));
type = UnitTypes.revenant; type = UnitTypes.revenant;
produceTime = 8000; produceTime = 8000;
size = 4; size = 4;
@@ -1046,6 +1147,7 @@ public class Blocks implements ContentList{
}}; }};
daggerFactory = new UnitFactory("dagger-factory"){{ daggerFactory = new UnitFactory("dagger-factory"){{
requirements(Category.units, ItemStack.with(Items.lead, 90, Items.silicon, 70));
type = UnitTypes.dagger; type = UnitTypes.dagger;
produceTime = 1700; produceTime = 1700;
size = 2; size = 2;
@@ -1054,6 +1156,7 @@ public class Blocks implements ContentList{
}}; }};
titanFactory = new UnitFactory("titan-factory"){{ titanFactory = new UnitFactory("titan-factory"){{
requirements(Category.units, ItemStack.with(Items.thorium, 90, Items.lead, 140, Items.silicon, 90));
type = UnitTypes.titan; type = UnitTypes.titan;
produceTime = 3400; produceTime = 3400;
size = 3; size = 3;
@@ -1062,6 +1165,7 @@ public class Blocks implements ContentList{
}}; }};
fortressFactory = new UnitFactory("fortress-factory"){{ fortressFactory = new UnitFactory("fortress-factory"){{
requirements(Category.units, ItemStack.with(Items.thorium, 200, Items.lead, 220, Items.silicon, 150, Items.surgealloy, 100, Items.phasefabric, 50));
type = UnitTypes.fortress; type = UnitTypes.fortress;
produceTime = 5000; produceTime = 5000;
size = 3; size = 3;
@@ -1070,64 +1174,73 @@ public class Blocks implements ContentList{
}}; }};
repairPoint = new RepairPoint("repair-point"){{ repairPoint = new RepairPoint("repair-point"){{
requirements(Category.units, ItemStack.with(Items.lead, 30, Items.copper, 30, Items.silicon, 30));
repairSpeed = 0.1f; repairSpeed = 0.1f;
}}; }};
reconstructor = new Reconstructor("reconstructor"){{ reconstructor = new Reconstructor("reconstructor"){{
size = 2; size = 2;
}}; }};
//endregion //endregion
//region upgrades //region upgrades
alphaPad = new MechPad("alpha-mech-pad"){{ alphaPad = new MechPad("alpha-mech-pad"){{
requirements(Category.upgrade, ItemStack.with(Items.lead, 200, Items.graphite, 100, Items.copper, 150));
mech = Mechs.alpha; mech = Mechs.alpha;
size = 2; size = 2;
consumes.powerBuffered(50f); consumes.powerBuffered(50f);
}}; }};
deltaPad = new MechPad("delta-mech-pad"){{ deltaPad = new MechPad("delta-mech-pad"){{
requirements(Category.upgrade, ItemStack.with(Items.lead, 350, Items.titanium, 350, Items.copper, 400, Items.silicon, 450, Items.thorium, 300));
mech = Mechs.delta; mech = Mechs.delta;
size = 2; size = 2;
consumes.powerBuffered(70f); consumes.powerBuffered(70f);
}}; }};
tauPad = new MechPad("tau-mech-pad"){{ tauPad = new MechPad("tau-mech-pad"){{
requirements(Category.upgrade, ItemStack.with(Items.lead, 250, Items.titanium, 250, Items.copper, 250, Items.silicon, 250));
mech = Mechs.tau; mech = Mechs.tau;
size = 2; size = 2;
consumes.powerBuffered(100f); consumes.powerBuffered(100f);
}}; }};
omegaPad = new MechPad("omega-mech-pad"){{ omegaPad = new MechPad("omega-mech-pad"){{
requirements(Category.upgrade, ItemStack.with(Items.lead, 450, Items.graphite, 550, Items.silicon, 650, Items.thorium, 600, Items.surgealloy, 240));
mech = Mechs.omega; mech = Mechs.omega;
size = 3; size = 3;
consumes.powerBuffered(120f); consumes.powerBuffered(120f);
}}; }};
dartPad = new MechPad("dart-ship-pad"){{ dartPad = new MechPad("dart-ship-pad"){{
requirements(Category.upgrade, ItemStack.with(Items.lead, 150, Items.copper, 150, Items.silicon, 200, Items.titanium, 240));
mech = Mechs.dart; mech = Mechs.dart;
size = 2; size = 2;
consumes.powerBuffered(50f); consumes.powerBuffered(50f);
}}; }};
javelinPad = new MechPad("javelin-ship-pad"){{ javelinPad = new MechPad("javelin-ship-pad"){{
requirements(Category.upgrade, ItemStack.with(Items.lead, 350, Items.silicon, 450, Items.titanium, 500, Items.plastanium, 400, Items.phasefabric, 200));
mech = Mechs.javelin; mech = Mechs.javelin;
size = 2; size = 2;
consumes.powerBuffered(80f); consumes.powerBuffered(80f);
}}; }};
tridentPad = new MechPad("trident-ship-pad"){{ tridentPad = new MechPad("trident-ship-pad"){{
requirements(Category.upgrade, ItemStack.with(Items.lead, 250, Items.copper, 250, Items.silicon, 250, Items.titanium, 300, Items.plastanium, 200));
mech = Mechs.trident; mech = Mechs.trident;
size = 2; size = 2;
consumes.powerBuffered(100f); consumes.powerBuffered(100f);
}}; }};
glaivePad = new MechPad("glaive-ship-pad"){{ glaivePad = new MechPad("glaive-ship-pad"){{
requirements(Category.upgrade, ItemStack.with(Items.lead, 450, Items.silicon, 650, Items.titanium, 700, Items.plastanium, 600, Items.surgealloy, 200));
mech = Mechs.glaive; mech = Mechs.glaive;
size = 3; size = 3;
consumes.powerBuffered(120f); consumes.powerBuffered(120f);
}}; }};
//endregion //endregion
//region ores //region ores

View File

@@ -267,7 +267,7 @@ public class Bullets implements ContentList{
bulletHeight = 9f; bulletHeight = 9f;
homingPower = 5f; homingPower = 5f;
reloadMultiplier = 1.4f; reloadMultiplier = 1.4f;
ammoMultiplier = 5; ammoMultiplier = 3;
}}; }};
standardIncendiary = new BasicBulletType(3.2f, 11, "bullet"){{ standardIncendiary = new BasicBulletType(3.2f, 11, "bullet"){{

View File

@@ -24,14 +24,15 @@ public class Fx implements ContentList{
vtolHover, unitDrop, unitPickup, unitLand, pickup, healWave, heal, landShock, reactorsmoke, nuclearsmoke, nuclearcloud, vtolHover, unitDrop, unitPickup, unitLand, pickup, healWave, heal, landShock, reactorsmoke, nuclearsmoke, nuclearcloud,
redgeneratespark, generatespark, fuelburn, plasticburn, pulverize, pulverizeRed, pulverizeRedder, pulverizeSmall, pulverizeMedium, redgeneratespark, generatespark, fuelburn, plasticburn, pulverize, pulverizeRed, pulverizeRedder, pulverizeSmall, pulverizeMedium,
producesmoke, smeltsmoke, formsmoke, blastsmoke, lava, doorclose, dooropen, dooropenlarge, doorcloselarge, purify, purifyoil, purifystone, generate, producesmoke, smeltsmoke, formsmoke, blastsmoke, lava, doorclose, dooropen, dooropenlarge, doorcloselarge, purify, purifyoil, purifystone, generate,
mine, mineBig, mineHuge, smelt, teleportActivate, teleport, teleportOut, ripple, bubble, commandSend, mine, mineBig, mineHuge, smelt, teleportActivate, teleport, teleportOut, ripple, bubble, launch,
healBlock, healBlockFull, healWaveMend, overdriveWave, overdriveBlockFull, shieldBreak, hitBulletSmall, hitFuse, healBlock, healBlockFull, healWaveMend, overdriveWave, overdriveBlockFull, shieldBreak, hitBulletSmall, hitFuse,
hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, hitMeltdown, despawn, flakExplosion, blastExplosion, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, hitMeltdown, despawn, flakExplosion, blastExplosion,
plasticExplosion, artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig, plasticExplosionFlak, burning, fire, plasticExplosion, artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig, plasticExplosionFlak, burning, fire,
fireSmoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily, overdriven, dropItem, shockwave, fireSmoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily, overdriven, dropItem, shockwave,
bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke, shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke, bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke, shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke,
shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium, shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium,
shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot; shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot,
launchFull;
@Override @Override
public void load(){ public void load(){
@@ -1060,7 +1061,7 @@ public class Fx implements ContentList{
Draw.reset(); Draw.reset();
}); });
commandSend = new Effect(28, e -> { launch = new Effect(28, e -> {
Draw.color(Palette.command); Draw.color(Palette.command);
Lines.stroke(e.fout() * 2f); Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f); Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f);
@@ -1108,5 +1109,12 @@ public class Fx implements ContentList{
Lines.poly(e.x, e.y, 6, e.rotation + e.fin(), 90); Lines.poly(e.x, e.y, 6, e.rotation + e.fin(), 90);
Draw.reset(); Draw.reset();
}); });
launchFull = new Effect(60, 9999999999f, e -> {
Draw.color();
Draw.alpha(e.fslope());
Fill.rect(Core.camera.position.x, Core.camera.position.y, Core.camera.width + 10, Core.camera.height + 10);
Draw.reset();
});
} }
} }

View File

@@ -7,7 +7,7 @@ import io.anuke.mindustry.type.ItemType;
public class Items implements ContentList{ public class Items implements ContentList{
public static Item scrap, copper, lead, graphite, coal, titanium, thorium, silicon, plastanium, phasefabric, surgealloy, public static Item scrap, copper, lead, graphite, coal, titanium, thorium, silicon, plastanium, phasefabric, surgealloy,
biomatter, sand, blastCompound, pyratite, bioglass; biomatter, sand, blastCompound, pyratite, metaglass;
@Override @Override
public void load(){ public void load(){
@@ -26,6 +26,11 @@ public class Items implements ContentList{
genOre = true; genOre = true;
}}; }};
metaglass = new Item("metaglass", Color.valueOf("648b55")){{
type = ItemType.material;
cost = 2f;
}};
graphite = new Item("graphite", Color.valueOf("b2c6d2")){{ graphite = new Item("graphite", Color.valueOf("b2c6d2")){{
type = ItemType.material; type = ItemType.material;
cost = 1.3f; cost = 1.3f;
@@ -55,7 +60,7 @@ public class Items implements ContentList{
}}; }};
scrap = new Item("scrap", Color.valueOf("777777")){{ scrap = new Item("scrap", Color.valueOf("777777")){{
genOre = true;
}}; }};
silicon = new Item("silicon", Color.valueOf("53565c")){{ silicon = new Item("silicon", Color.valueOf("53565c")){{
@@ -99,10 +104,5 @@ public class Items implements ContentList{
flammability = 0.7f; flammability = 0.7f;
explosiveness = 0.2f; explosiveness = 0.2f;
}}; }};
bioglass = new Item("bioglass", Color.valueOf("648b55")){{
type = ItemType.material;
cost = 2f;
}};
} }
} }

View File

@@ -5,7 +5,7 @@ import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.Liquid; import io.anuke.mindustry.type.Liquid;
public class Liquids implements ContentList{ public class Liquids implements ContentList{
public static Liquid water, slag, oil, cryofluid, acid; public static Liquid water, slag, oil, cryofluid;
@Override @Override
public void load(){ public void load(){
@@ -16,7 +16,7 @@ public class Liquids implements ContentList{
effect = StatusEffects.wet; effect = StatusEffects.wet;
}}; }};
slag = new Liquid("slag", Color.valueOf("e37341")){{ slag = new Liquid("slag", Color.valueOf("ffcd66")){{
temperature = 1f; temperature = 1f;
viscosity = 0.8f; viscosity = 0.8f;
tier = 2; tier = 2;
@@ -38,10 +38,5 @@ public class Liquids implements ContentList{
tier = 1; tier = 1;
effect = StatusEffects.freezing; effect = StatusEffects.freezing;
}}; }};
acid = new Liquid("acid", Color.valueOf("e9f9b3")){{
heatCapacity = 0.1f; //don't use acid as coolant, it's bad
effect = StatusEffects.corroded;
}};
} }
} }

View File

@@ -40,8 +40,8 @@ public class Mechs implements ContentList{
} }
@Override @Override
public void updateAlt(Player player){ public boolean alwaysUnlocked(){
return true;
} }
}; };
@@ -182,18 +182,25 @@ public class Mechs implements ContentList{
} }
}; };
dart = new Mech("dart-ship", true){{ dart = new Mech("dart-ship", true){
drillPower = 1; {
mineSpeed = 0.9f; drillPower = 1;
speed = 0.4f; mineSpeed = 0.9f;
drag = 0.1f; speed = 0.4f;
armor = 10f; drag = 0.1f;
weapon = Weapons.blasterSmall; armor = 10f;
weaponOffsetX = -1; weapon = Weapons.blasterSmall;
weaponOffsetY = -1; weaponOffsetX = -1;
trailColor = Palette.lightTrail; weaponOffsetY = -1;
cellTrnsY = 1f; trailColor = Palette.lightTrail;
}}; cellTrnsY = 1f;
}
@Override
public boolean alwaysUnlocked(){
return true;
}
};
javelin = new Mech("javelin-ship", true){ javelin = new Mech("javelin-ship", true){
float minV = 3.6f; float minV = 3.6f;

View File

@@ -1,180 +0,0 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.type.Recipe.RecipeVisibility;
import static io.anuke.mindustry.type.Category.*;
public class Recipes implements ContentList{
@Override
public void load(){
//DEBUG
new Recipe(distribution, Blocks.itemSource).setVisible(RecipeVisibility.sandboxOnly).setHidden(true).setAlwaysUnlocked(true);
new Recipe(distribution, Blocks.itemVoid).setVisible(RecipeVisibility.sandboxOnly).setHidden(true).setAlwaysUnlocked(true);
new Recipe(liquid, Blocks.liquidSource).setVisible(RecipeVisibility.sandboxOnly).setHidden(true).setAlwaysUnlocked(true);
new Recipe(power, Blocks.powerVoid).setVisible(RecipeVisibility.sandboxOnly).setHidden(true).setAlwaysUnlocked(true);
new Recipe(power, Blocks.powerSource).setVisible(RecipeVisibility.sandboxOnly).setHidden(true).setAlwaysUnlocked(true);
//DEFENSE
//walls
new Recipe(defense, Blocks.copperWall, new ItemStack(Items.copper, 12)).setAlwaysUnlocked(true);
new Recipe(defense, Blocks.copperWallLarge, new ItemStack(Items.copper, 12 * 4)).setAlwaysUnlocked(true);
new Recipe(defense, Blocks.titaniumWall, new ItemStack(Items.titanium, 12));
new Recipe(defense, Blocks.titaniumWallLarge, new ItemStack(Items.titanium, 12 * 4));
new Recipe(defense, Blocks.door, new ItemStack(Items.titanium, 12), new ItemStack(Items.silicon, 8));
new Recipe(defense, Blocks.doorLarge, new ItemStack(Items.titanium, 12 * 4), new ItemStack(Items.silicon, 8 * 4));
new Recipe(defense, Blocks.thoriumWall, new ItemStack(Items.thorium, 12));
new Recipe(defense, Blocks.thoriumWallLarge, new ItemStack(Items.thorium, 12 * 4));
new Recipe(defense, Blocks.phaseWall, new ItemStack(Items.phasefabric, 12));
new Recipe(defense, Blocks.phaseWallLarge, new ItemStack(Items.phasefabric, 12 * 4));
new Recipe(defense, Blocks.surgeWall, new ItemStack(Items.surgealloy, 12));
new Recipe(defense, Blocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4));
new Recipe(effect, Blocks.container, new ItemStack(Items.titanium, 200));
new Recipe(effect, Blocks.vault, new ItemStack(Items.titanium, 500), new ItemStack(Items.thorium, 250));
new Recipe(effect, Blocks.launchPad, new ItemStack(Items.copper, 500));
//projectors
new Recipe(effect, Blocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 180));
new Recipe(effect, Blocks.overdriveProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
new Recipe(effect, Blocks.forceProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
new Recipe(effect, Blocks.shockMine, new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 25));
//TURRETS
new Recipe(turret, Blocks.duo, new ItemStack(Items.copper, 40)).setAlwaysUnlocked(true);
new Recipe(turret, Blocks.arc, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 40));
new Recipe(turret, Blocks.hail, new ItemStack(Items.copper, 60), new ItemStack(Items.graphite, 35));
new Recipe(turret, Blocks.lancer, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 90));
new Recipe(turret, Blocks.wave, new ItemStack(Items.titanium, 70), new ItemStack(Items.lead, 150));
new Recipe(turret, Blocks.salvo, new ItemStack(Items.copper, 210), new ItemStack(Items.graphite, 190), new ItemStack(Items.thorium, 130));
new Recipe(turret, Blocks.swarmer, new ItemStack(Items.graphite, 70), new ItemStack(Items.titanium, 70), new ItemStack(Items.plastanium, 90), new ItemStack(Items.silicon, 60));
new Recipe(turret, Blocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.graphite, 220), new ItemStack(Items.thorium, 120));
new Recipe(turret, Blocks.cyclone, new ItemStack(Items.copper, 400), new ItemStack(Items.surgealloy, 200), new ItemStack(Items.plastanium, 150));
new Recipe(turret, Blocks.fuse, new ItemStack(Items.copper, 450), new ItemStack(Items.graphite, 450), new ItemStack(Items.surgealloy, 250));
new Recipe(turret, Blocks.spectre, new ItemStack(Items.copper, 700), new ItemStack(Items.graphite, 600), new ItemStack(Items.surgealloy, 500), new ItemStack(Items.plastanium, 350), new ItemStack(Items.thorium, 500));
new Recipe(turret, Blocks.meltdown, new ItemStack(Items.copper, 500), new ItemStack(Items.lead, 700), new ItemStack(Items.graphite, 600), new ItemStack(Items.surgealloy, 650), new ItemStack(Items.silicon, 650));
//DISTRIBUTION
new Recipe(distribution, Blocks.conveyor, new ItemStack(Items.copper, 1)).setAlwaysUnlocked(true);
new Recipe(distribution, Blocks.titaniumConveyor, new ItemStack(Items.copper, 2), new ItemStack(Items.titanium, 1));
new Recipe(distribution, Blocks.phaseConveyor, new ItemStack(Items.phasefabric, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.graphite, 20));
//starter transport
new Recipe(distribution, Blocks.junction, new ItemStack(Items.copper, 2)).setAlwaysUnlocked(true);
new Recipe(distribution, Blocks.router, new ItemStack(Items.copper, 6)).setAlwaysUnlocked(true);
//more advanced transport
new Recipe(distribution, Blocks.distributor, new ItemStack(Items.titanium, 8), new ItemStack(Items.copper, 8));
new Recipe(distribution, Blocks.sorter, new ItemStack(Items.titanium, 4), new ItemStack(Items.copper, 4));
new Recipe(distribution, Blocks.overflowGate, new ItemStack(Items.titanium, 4), new ItemStack(Items.copper, 8));
new Recipe(distribution, Blocks.itemBridge, new ItemStack(Items.titanium, 8), new ItemStack(Items.copper, 8));
new Recipe(distribution, Blocks.unloader, new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 60));
new Recipe(distribution, Blocks.massDriver, new ItemStack(Items.titanium, 250), new ItemStack(Items.silicon, 150), new ItemStack(Items.lead, 250), new ItemStack(Items.thorium, 100));
//CRAFTING
//smelting
new Recipe(crafting, Blocks.siliconSmelter, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 50));
//advanced fabrication
new Recipe(crafting, Blocks.plastaniumCompressor, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 230), new ItemStack(Items.graphite, 120), new ItemStack(Items.titanium, 160));
new Recipe(crafting, Blocks.phaseWeaver, new ItemStack(Items.silicon, 260), new ItemStack(Items.lead, 240), new ItemStack(Items.thorium, 150));
new Recipe(crafting, Blocks.surgeSmelter, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 160), new ItemStack(Items.thorium, 140));
//misc
new Recipe(crafting, Blocks.pulverizer, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, Blocks.pyratiteMixer, new ItemStack(Items.copper, 100), new ItemStack(Items.lead, 50));
new Recipe(crafting, Blocks.blastMixer, new ItemStack(Items.lead, 60), new ItemStack(Items.titanium, 40));
new Recipe(crafting, Blocks.cryofluidMixer, new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 80), new ItemStack(Items.thorium, 90));
new Recipe(crafting, Blocks.melter, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 70), new ItemStack(Items.graphite, 90));
new Recipe(crafting, Blocks.incinerator, new ItemStack(Items.graphite, 10), new ItemStack(Items.lead, 30));
//processing
new Recipe(crafting, Blocks.biomatterCompressor, new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 60));
new Recipe(crafting, Blocks.separator, new ItemStack(Items.copper, 60), new ItemStack(Items.titanium, 50));
//POWER
new Recipe(power, Blocks.powerNode, new ItemStack(Items.copper, 2), new ItemStack(Items.lead, 6));
new Recipe(power, Blocks.powerNodeLarge, new ItemStack(Items.titanium, 10), new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 6));
new Recipe(power, Blocks.battery, new ItemStack(Items.copper, 8), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 4));
new Recipe(power, Blocks.batteryLarge, new ItemStack(Items.titanium, 40), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 30));
//generators - combustion
new Recipe(power, Blocks.combustionGenerator, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 30));
new Recipe(power, Blocks.turbineGenerator, new ItemStack(Items.copper, 70), new ItemStack(Items.graphite, 50), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 60));
new Recipe(power, Blocks.thermalGenerator, new ItemStack(Items.copper, 80), new ItemStack(Items.graphite, 70), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 70), new ItemStack(Items.thorium, 70));
//generators - solar
new Recipe(power, Blocks.solarPanel, new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 30));
new Recipe(power, Blocks.largeSolarPanel, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 290), new ItemStack(Items.phasefabric, 30));
//generators - nuclear
new Recipe(power, Blocks.thoriumReactor, new ItemStack(Items.lead, 600), new ItemStack(Items.silicon, 400), new ItemStack(Items.graphite, 300), new ItemStack(Items.thorium, 300));
new Recipe(power, Blocks.rtgGenerator, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 150), new ItemStack(Items.phasefabric, 50), new ItemStack(Items.plastanium, 150), new ItemStack(Items.thorium, 100));
//DRILLS, PRODUCERS
new Recipe(production, Blocks.mechanicalDrill, new ItemStack(Items.copper, 20)).setAlwaysUnlocked(true);
new Recipe(production, Blocks.pneumaticDrill, new ItemStack(Items.copper, 60), new ItemStack(Items.graphite, 50));
new Recipe(production, Blocks.laserDrill, new ItemStack(Items.copper, 70), new ItemStack(Items.graphite, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50));
new Recipe(production, Blocks.blastDrill, new ItemStack(Items.copper, 130), new ItemStack(Items.silicon, 120), new ItemStack(Items.titanium, 100), new ItemStack(Items.thorium, 60));
new Recipe(production, Blocks.waterExtractor, new ItemStack(Items.copper, 50), new ItemStack(Items.graphite, 50), new ItemStack(Items.lead, 40));
new Recipe(production, Blocks.cultivator, new ItemStack(Items.copper, 20), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 20));
new Recipe(production, Blocks.oilExtractor, new ItemStack(Items.copper, 300), new ItemStack(Items.graphite, 350), new ItemStack(Items.lead, 230), new ItemStack(Items.thorium, 230), new ItemStack(Items.silicon, 150));
//UNITS
//upgrades
new Recipe(upgrade, Blocks.dartPad, new ItemStack(Items.lead, 150), new ItemStack(Items.copper, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240)).setVisible(RecipeVisibility.desktopOnly);
new Recipe(upgrade, Blocks.tridentPad, new ItemStack(Items.lead, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
new Recipe(upgrade, Blocks.javelinPad, new ItemStack(Items.lead, 350), new ItemStack(Items.silicon, 450), new ItemStack(Items.titanium, 500), new ItemStack(Items.plastanium, 400), new ItemStack(Items.phasefabric, 200));
new Recipe(upgrade, Blocks.glaivePad, new ItemStack(Items.lead, 450), new ItemStack(Items.silicon, 650), new ItemStack(Items.titanium, 700), new ItemStack(Items.plastanium, 600), new ItemStack(Items.surgealloy, 200));
new Recipe(upgrade, Blocks.alphaPad, new ItemStack(Items.lead, 200), new ItemStack(Items.graphite, 100), new ItemStack(Items.copper, 150)).setVisible(RecipeVisibility.mobileOnly);
new Recipe(upgrade, Blocks.tauPad, new ItemStack(Items.lead, 250), new ItemStack(Items.titanium, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250));
new Recipe(upgrade, Blocks.deltaPad, new ItemStack(Items.lead, 350), new ItemStack(Items.titanium, 350), new ItemStack(Items.copper, 400), new ItemStack(Items.silicon, 450), new ItemStack(Items.thorium, 300));
new Recipe(upgrade, Blocks.omegaPad, new ItemStack(Items.lead, 450), new ItemStack(Items.graphite, 550), new ItemStack(Items.silicon, 650), new ItemStack(Items.thorium, 600), new ItemStack(Items.surgealloy, 240));
//unit factories
new Recipe(units, Blocks.spiritFactory, new ItemStack(Items.copper, 70), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 130));
new Recipe(units, Blocks.phantomFactory, new ItemStack(Items.titanium, 90), new ItemStack(Items.thorium, 80), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 210));
new Recipe(units, Blocks.daggerFactory, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70));
new Recipe(units, Blocks.titanFactory, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90));
new Recipe(units, Blocks.fortressFactory, new ItemStack(Items.thorium, 200), new ItemStack(Items.lead, 220), new ItemStack(Items.silicon, 150), new ItemStack(Items.surgealloy, 100), new ItemStack(Items.phasefabric, 50));
new Recipe(units, Blocks.wraithFactory, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90));
new Recipe(units, Blocks.ghoulFactory, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));
new Recipe(units, Blocks.revenantFactory, new ItemStack(Items.plastanium, 300), new ItemStack(Items.titanium, 400), new ItemStack(Items.lead, 300), new ItemStack(Items.silicon, 400), new ItemStack(Items.surgealloy, 100));
new Recipe(units, Blocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.copper, 30), new ItemStack(Items.silicon, 30));
//removed for testing MOBA-style unit production
//new Recipe(units, Blocks.commandCenter, new ItemStack(Items.lead, 100), new ItemStack(Items.densealloy, 100), new ItemStack(Items.silicon, 200));
//LIQUIDS
new Recipe(liquid, Blocks.conduit, new ItemStack(Items.lead, 1));
new Recipe(liquid, Blocks.pulseConduit, new ItemStack(Items.titanium, 1), new ItemStack(Items.lead, 1));
new Recipe(liquid, Blocks.phaseConduit, new ItemStack(Items.phasefabric, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.titanium, 20));
new Recipe(liquid, Blocks.liquidRouter, new ItemStack(Items.titanium, 4), new ItemStack(Items.lead, 4));
new Recipe(liquid, Blocks.liquidTank, new ItemStack(Items.titanium, 50), new ItemStack(Items.lead, 50));
new Recipe(liquid, Blocks.liquidJunction, new ItemStack(Items.titanium, 4), new ItemStack(Items.lead, 4));
new Recipe(liquid, Blocks.bridgeConduit, new ItemStack(Items.titanium, 8), new ItemStack(Items.lead, 8));
new Recipe(liquid, Blocks.mechanicalPump, new ItemStack(Items.copper, 30), new ItemStack(Items.lead, 20));
new Recipe(liquid, Blocks.rotaryPump, new ItemStack(Items.copper, 140), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 40), new ItemStack(Items.titanium, 70));
new Recipe(liquid, Blocks.thermalPump, new ItemStack(Items.copper, 160), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 80), new ItemStack(Items.thorium, 70));
}
}

View File

@@ -0,0 +1,285 @@
package io.anuke.mindustry.content;
import io.anuke.arc.collection.Array;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.Block;
import static io.anuke.mindustry.content.Blocks.*;
public class TechTree implements ContentList{
public static TechNode root;
@Override
public void load(){
root = node(core, () -> {
node(conveyor, () -> {
node(launchPad, () -> {
});
node(junction, () -> {
node(itemBridge);
node(router, () -> {
node(distributor);
node(overflowGate);
node(sorter);
node(container, () -> {
node(unloader);
node(vault, () -> {
});
});
});
node(titaniumConveyor, () -> {
node(phaseConveyor, () -> {
node(massDriver, () -> {
});
});
});
});
});
node(duo, () -> {
node(hail, () -> {
node(salvo, () -> {
node(swarmer, () -> {
node(cyclone, () -> {
node(spectre, () -> {
});
});
});
node(ripple, () -> {
node(fuse, () -> {
});
});
});
});
node(arc, () -> {
node(wave, () -> {
});
node(lancer, () -> {
node(meltdown, () -> {
});
node(shockMine, () -> {
});
});
});
node(copperWall, () -> {
node(copperWallLarge);
node(titaniumWall, () -> {
node(door, () -> {
node(doorLarge);
});
node(titaniumWallLarge);
node(thoriumWall, () -> {
node(thoriumWallLarge);
node(surgeWall, () -> {
node(surgeWallLarge);
node(phaseWall, () -> {
node(phaseWallLarge);
});
});
});
});
});
});
node(mechanicalDrill, () -> {
node(pneumaticDrill, () -> {
node(cultivator, () -> {
});
node(laserDrill, () -> {
node(blastDrill, () -> {
});
node(waterExtractor, () -> {
node(oilExtractor, () -> {
});
});
});
});
node(siliconSmelter, () -> {
node(pyratiteMixer, () -> {
node(blastMixer, () -> {
});
});
node(biomatterCompressor, () -> {
node(plastaniumCompressor, () -> {
node(phaseWeaver, () -> {
});
});
});
node(incinerator, () -> {
node(melter, () -> {
node(surgeSmelter, () -> {
});
node(separator, () -> {
node(pulverizer, () -> {
});
});
node(cryofluidMixer, () -> {
});
});
});
});
node(mechanicalPump, () -> {
node(conduit, () -> {
node(liquidJunction, () -> {
node(liquidRouter, () -> {
node(liquidTank);
node(pulseConduit, () -> {
node(phaseConduit, () -> {
});
});
node(rotaryPump, () -> {
node(thermalPump, () -> {
});
});
});
node(bridgeConduit);
});
});
});
});
node(powerNode, () -> {
node(combustionGenerator, () -> {
node(powerNodeLarge, () -> {
node(battery, () -> {
node(batteryLarge, () -> {
});
});
node(mendProjector, () -> {
node(forceProjector, () -> {
node(overdriveProjector, () -> {
});
});
node(repairPoint, () -> {
});
});
});
node(turbineGenerator, () -> {
node(thermalGenerator, () -> {
node(rtgGenerator, () -> {
node(thoriumReactor, () -> {
});
});
});
});
node(solarPanel, () -> {
node(largeSolarPanel, () -> {
});
});
});
node(alphaPad, () -> {
node(dartPad);
node(deltaPad, () -> {
node(javelinPad);
node(tauPad, () -> {
node(tridentPad);
node(omegaPad, () -> {
node(glaivePad);
});
});
});
node(spiritFactory, () -> {
node(daggerFactory, () -> {
node(daggerFactory, () -> {
node(titanFactory, () -> {
node(fortressFactory);
});
node(wraithFactory, () -> {
node(phantomFactory);
node(ghoulFactory, () -> {
node(revenantFactory);
});
});
});
});
});
});
});
});
}
private TechNode node(Block block, Runnable children){
ItemStack[] requirements = new ItemStack[block.buildRequirements.length];
for(int i = 0; i < requirements.length; i++){
requirements[i] = new ItemStack(block.buildRequirements[i].item, block.buildRequirements[i].amount * 50);
}
return new TechNode(block, requirements, children);
}
private TechNode node(Block block){
return node(block, () -> {});
}
public static class TechNode{
static TechNode context;
public final Block block;
public final ItemStack[] requirements;
public final Array<TechNode> children = new Array<>();
TechNode(Block block, ItemStack[] requirements, Runnable children){
if(context != null){
context.children.add(this);
}
//TODO remove requirements... for now
this.block = block;
this.requirements = requirements;
TechNode last = context;
context = this;
children.run();
context = last;
}
}
}

View File

@@ -20,7 +20,7 @@ public class Weapons implements ContentList{
blasterSmall = new Weapon("blaster"){{ blasterSmall = new Weapon("blaster"){{
length = 1.5f; length = 1.5f;
reload = 15f; reload = 20f;
roundrobin = true; roundrobin = true;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardCopper; ammo = Bullets.standardCopper;
@@ -28,7 +28,7 @@ public class Weapons implements ContentList{
glaiveBlaster = new Weapon("bomber"){{ glaiveBlaster = new Weapon("bomber"){{
length = 1.5f; length = 1.5f;
reload = 10f; reload = 13f;
roundrobin = true; roundrobin = true;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardGlaive; ammo = Bullets.standardGlaive;
@@ -54,7 +54,7 @@ public class Weapons implements ContentList{
missiles = new Weapon("missiles"){{ missiles = new Weapon("missiles"){{
length = 1.5f; length = 1.5f;
reload = 60f; reload = 70f;
shots = 4; shots = 4;
inaccuracy = 2f; inaccuracy = 2f;
roundrobin = true; roundrobin = true;

View File

@@ -1,25 +1,207 @@
package io.anuke.mindustry.content; package io.anuke.mindustry.content;
import io.anuke.arc.collection.Array;
import io.anuke.mindustry.game.ContentList; import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.game.Rules; import io.anuke.mindustry.game.Rules;
import io.anuke.mindustry.maps.generators.BasicGenerator; import io.anuke.mindustry.game.SpawnGroup;
import io.anuke.mindustry.maps.generators.MapGenerator;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Zone; import io.anuke.mindustry.type.Zone;
import io.anuke.mindustry.world.Block;
public class Zones implements ContentList{ public class Zones implements ContentList{
public Zone wasteland; public static Zone groundZero, craters, frozenForest, ruinousShores, crags, stainedMountains,
impact, desolateRift, arcticDesert, dryWastes, nuclearComplex, moltenFault;
@Override @Override
public void load(){ public void load(){
wasteland = new Zone("wasteland", new BasicGenerator(256, 256, Items.lead, Items.copper)){{ groundZero = new Zone("groundZero", new MapGenerator("groundZero", 1)){{
deployCost = ItemStack.with(Items.copper, 100); deployCost = ItemStack.with(Items.copper, 60);
startingItems = ItemStack.with(Items.copper, 50); startingItems = ItemStack.with(Items.copper, 50);
alwaysUnlocked = true;
conditionWave = 10;
rules = () -> new Rules(){{ rules = () -> new Rules(){{
waves = true; waves = true;
waveTimer = true; waveTimer = true;
waveSpacing = 60 * 60; waveSpacing = 60 * 60 * 2; //2 mins
spawns = Array.with(
new SpawnGroup(UnitTypes.dagger){{
unitScaling = 2;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 10;
unitScaling = 2;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 15;
unitScaling = 1;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 20;
unitScaling = 1;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 25;
unitScaling = 1;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 30;
unitScaling = 1;
}}
);
}}; }};
}}; }};
craters = new Zone("craters", new MapGenerator("craters", 1){{ distortion = 1.44f; }}){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
itemRequirements = ItemStack.with(Items.copper, 2000);
zoneRequirements = new Zone[]{groundZero};
blockRequirements = new Block[]{Blocks.router};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
frozenForest = new Zone("frozenForest", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
ruinousShores = new Zone("ruinousShores", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
crags = new Zone("crags", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
stainedMountains = new Zone("stainedMountains", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
impact = new Zone("impact", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
desolateRift = new Zone("desolateRift", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
arcticDesert = new Zone("arcticDesert", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
dryWastes = new Zone("dryWastes", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
nuclearComplex = new Zone("nuclearComplex", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
moltenFault = new Zone("moltenFault", new MapGenerator("groundZero", 1)){{ //TODO implement
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
frozenForest.zoneRequirements = new Zone[]{frozenForest};
} }
} }

View File

@@ -44,7 +44,7 @@ public class ContentLoader{
new Mechs(), new Mechs(),
new UnitTypes(), new UnitTypes(),
new Blocks(), new Blocks(),
new Recipes(), new TechTree(),
new Zones(), new Zones(),
//these are not really content classes, but this makes initialization easier //these are not really content classes, but this makes initialization easier
@@ -165,7 +165,7 @@ public class ContentLoader{
} }
if(id >= contentMap[type.ordinal()].size || id < 0){ if(id >= contentMap[type.ordinal()].size || id < 0){
throw new RuntimeException("No " + type.name() + " with ID '" + id + "' found!"); return null;
} }
return (T)contentMap[type.ordinal()].get(id); return (T)contentMap[type.ordinal()].get(id);
} }
@@ -184,14 +184,6 @@ public class ContentLoader{
return (Block) getByID(ContentType.block, id); return (Block) getByID(ContentType.block, id);
} }
public Array<Recipe> recipes(){
return getBy(ContentType.recipe);
}
public Recipe recipe(int id){
return (Recipe) getByID(ContentType.recipe, id);
}
public Array<Item> items(){ public Array<Item> items(){
return getBy(ContentType.item); return getBy(ContentType.item);
} }

View File

@@ -116,9 +116,16 @@ public class Control implements ApplicationListener{
//todo high scores for custom maps, as well as other statistics //todo high scores for custom maps, as well as other statistics
Events.on(GameOverEvent.class, event -> { Events.on(GameOverEvent.class, event -> {
state.stats.wavesLasted = state.wave;
Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y); Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y);
//the restart dialog can show info for any number of scenarios //the restart dialog can show info for any number of scenarios
Call.onGameOver(event.winner); Call.onGameOver(event.winner);
if(state.rules.zone != -1){
//remove zone save on game over
if(saves.getZoneSlot() != null){
saves.getZoneSlot().delete();
}
}
}); });
//autohost for pvp sectors //autohost for pvp sectors
@@ -133,6 +140,30 @@ public class Control implements ApplicationListener{
} }
} }
}); });
Events.on(UnlockEvent.class, e -> ui.hudfrag.showUnlock(e.content));
Events.on(BlockBuildEndEvent.class, e -> {
if(e.team == players[0].getTeam()){
if(e.breaking){
state.stats.buildingsDeconstructed++;
}else{
state.stats.buildingsBuilt ++;
}
}
});
Events.on(BlockDestroyEvent.class, e -> {
if(e.tile.getTeam() == players[0].getTeam()){
state.stats.buildingsDestroyed ++;
}
});
Events.on(UnitDestroyEvent.class, e -> {
if(e.unit.getTeam() != players[0].getTeam()){
state.stats.enemyUnitsDestroyed ++;
}
});
} }
public void addPlayer(int index){ public void addPlayer(int index){

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.core;
import io.anuke.arc.Events; import io.anuke.arc.Events;
import io.anuke.mindustry.game.EventType.StateChangeEvent; import io.anuke.mindustry.game.EventType.StateChangeEvent;
import io.anuke.mindustry.game.Rules; import io.anuke.mindustry.game.Rules;
import io.anuke.mindustry.game.Stats;
import io.anuke.mindustry.game.Teams; import io.anuke.mindustry.game.Teams;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
@@ -15,9 +16,11 @@ public class GameState{
/**Wave countdown in ticks.*/ /**Wave countdown in ticks.*/
public float wavetime; public float wavetime;
/**Whether the game is in game over state.*/ /**Whether the game is in game over state.*/
public boolean gameOver = false; public boolean gameOver = false, launched = false;
/**The current game rules.*/ /**The current game rules.*/
public Rules rules = new Rules(); public Rules rules = new Rules();
/**Statistics for this save/game. Displayed after game over.*/
public Stats stats = new Stats();
/**Team data. Gets reset every new game.*/ /**Team data. Gets reset every new game.*/
public Teams teams = new Teams(); public Teams teams = new Teams();
/**Number of enemies in the game; only used clientside in servers.*/ /**Number of enemies in the game; only used clientside in servers.*/

View File

@@ -11,12 +11,8 @@ import io.anuke.arc.util.Time;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.game.Rules; import io.anuke.mindustry.game.*;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Teams;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
@@ -33,8 +29,14 @@ public class Logic implements ApplicationListener{
public Logic(){ public Logic(){
Events.on(TileChangeEvent.class, event -> { Events.on(TileChangeEvent.class, event -> {
if(event.tile.getTeam() == defaultTeam && Recipe.getByResult(event.tile.block()) != null){ if(event.tile.getTeam() == defaultTeam && event.tile.block().isVisible()){
handleContent(Recipe.getByResult(event.tile.block())); handleContent(event.tile.block());
}
});
Events.on(WaveEvent.class, event -> {
if(world.isZone()){
data.updateWaveScore(world.getZone(), state.wave);
} }
}); });
} }
@@ -65,9 +67,11 @@ public class Logic implements ApplicationListener{
public void reset(){ public void reset(){
state.wave = 1; state.wave = 1;
state.wavetime = state.rules.waveSpacing; state.wavetime = state.rules.waveSpacing;
state.gameOver = false; state.gameOver = state.launched = false;
state.teams = new Teams(); state.teams = new Teams();
state.rules = new Rules(); state.rules = new Rules();
state.rules.spawns = Waves.getDefaultSpawns();
state.stats = new Stats();
Time.clear(); Time.clear();
Entities.clear(); Entities.clear();

View File

@@ -296,7 +296,7 @@ public class NetServer implements ApplicationListener{
//auto-skip done requests //auto-skip done requests
if(req.breaking && world.tile(req.x, req.y).block() == Blocks.air){ if(req.breaking && world.tile(req.x, req.y).block() == Blocks.air){
continue; continue;
}else if(!req.breaking && world.tile(req.x, req.y).block() == req.recipe.result && (!req.recipe.result.rotate || world.tile(req.x, req.y).getRotation() == req.rotation)){ }else if(!req.breaking && world.tile(req.x, req.y).block() == req.block && (!req.block.rotate || world.tile(req.x, req.y).getRotation() == req.rotation)){
continue; continue;
} }
player.getPlaceQueue().addLast(req); player.getPlaceQueue().addLast(req);

View File

@@ -47,7 +47,7 @@ public class UI implements ApplicationListener{
public LoadingFragment loadfrag; public LoadingFragment loadfrag;
public AboutDialog about; public AboutDialog about;
public RestartDialog restart; public GameOverDialog restart;
public CustomGameDialog levels; public CustomGameDialog levels;
public MapsDialog maps; public MapsDialog maps;
public LoadDialog load; public LoadDialog load;
@@ -64,16 +64,17 @@ public class UI implements ApplicationListener{
public TraceDialog traces; public TraceDialog traces;
public ChangelogDialog changelog; public ChangelogDialog changelog;
public LocalPlayerDialog localplayers; public LocalPlayerDialog localplayers;
public UnlocksDialog unlocks; public DatabaseDialog database;
public ContentInfoDialog content; public ContentInfoDialog content;
public DeployDialog deploy; public DeployDialog deploy;
public TechTreeDialog tech;
public Cursor drillCursor, unloadCursor; public Cursor drillCursor, unloadCursor;
public UI(){ public UI(){
Skin skin = new Skin(Core.atlas); Skin skin = new Skin(Core.atlas);
generateFonts(skin); generateFonts(skin);
skin.load(Core.files.internal("ui/uiskin.json")); skin.load(Core.files.internal("sprites/uiskin.json"));
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){ for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
font.setUseIntegerPositions(true); font.setUseIntegerPositions(true);
@@ -158,13 +159,13 @@ public class UI implements ApplicationListener{
editor = new MapEditorDialog(); editor = new MapEditorDialog();
controls = new ControlsDialog(); controls = new ControlsDialog();
restart = new RestartDialog(); restart = new GameOverDialog();
join = new JoinDialog(); join = new JoinDialog();
discord = new DiscordDialog(); discord = new DiscordDialog();
load = new LoadDialog(); load = new LoadDialog();
levels = new CustomGameDialog(); levels = new CustomGameDialog();
language = new LanguageDialog(); language = new LanguageDialog();
unlocks = new UnlocksDialog(); database = new DatabaseDialog();
settings = new SettingsMenuDialog(); settings = new SettingsMenuDialog();
host = new HostDialog(); host = new HostDialog();
paused = new PausedDialog(); paused = new PausedDialog();
@@ -177,6 +178,7 @@ public class UI implements ApplicationListener{
localplayers = new LocalPlayerDialog(); localplayers = new LocalPlayerDialog();
content = new ContentInfoDialog(); content = new ContentInfoDialog();
deploy = new DeployDialog(); deploy = new DeployDialog();
tech = new TechTreeDialog();
Group group = Core.scene.root; Group group = Core.scene.root;
@@ -236,7 +238,7 @@ public class UI implements ApplicationListener{
Table table = new Table(); Table table = new Table();
table.setFillParent(true); table.setFillParent(true);
table.actions(Actions.fadeOut(7f, Interpolation.fade), Actions.removeActor()); table.actions(Actions.fadeOut(7f, Interpolation.fade), Actions.removeActor());
table.top().add(info).padTop(8); table.top().add(info).padTop(40);
Core.scene.add(table); Core.scene.add(table);
} }

View File

@@ -5,15 +5,21 @@ import io.anuke.arc.Core;
import io.anuke.arc.Events; import io.anuke.arc.Events;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.IntArray; import io.anuke.arc.collection.IntArray;
import io.anuke.arc.collection.ObjectSet.ObjectSetIterator;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.entities.EntityQuery; import io.anuke.arc.entities.EntityQuery;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Point2; import io.anuke.arc.math.geom.Point2;
import io.anuke.arc.util.Log; import io.anuke.arc.util.Log;
import io.anuke.arc.util.Structs; import io.anuke.arc.util.Structs;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.Tmp; import io.anuke.arc.util.Tmp;
import io.anuke.mindustry.ai.BlockIndexer; import io.anuke.mindustry.ai.BlockIndexer;
import io.anuke.mindustry.ai.Pathfinder; import io.anuke.mindustry.ai.Pathfinder;
import io.anuke.mindustry.ai.WaveSpawner; import io.anuke.mindustry.ai.WaveSpawner;
import io.anuke.mindustry.content.Blocks; import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.EventType.TileChangeEvent; import io.anuke.mindustry.game.EventType.TileChangeEvent;
import io.anuke.mindustry.game.EventType.WorldLoadEvent; import io.anuke.mindustry.game.EventType.WorldLoadEvent;
@@ -22,6 +28,8 @@ import io.anuke.mindustry.io.MapIO;
import io.anuke.mindustry.maps.Map; import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.maps.Maps; import io.anuke.mindustry.maps.Maps;
import io.anuke.mindustry.maps.generators.Generator; import io.anuke.mindustry.maps.generators.Generator;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Zone; import io.anuke.mindustry.type.Zone;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -178,6 +186,8 @@ public class World implements ApplicationListener{
} }
} }
addDarkness(tiles);
EntityQuery.resizeTree(0, 0, tiles.length * tilesize, tiles[0].length * tilesize); EntityQuery.resizeTree(0, 0, tiles.length * tilesize, tiles[0].length * tilesize);
generating = false; generating = false;
@@ -188,6 +198,32 @@ public class World implements ApplicationListener{
return generating; return generating;
} }
public void launchZone(){
Effects.effect(Fx.launchFull, 0, 0);
for(Tile tile : new ObjectSetIterator<>(state.teams.get(defaultTeam).cores)){
Effects.effect(Fx.launch, tile);
}
Time.runTask(30f, () -> {
for(Tile tile : new ObjectSetIterator<>(state.teams.get(defaultTeam).cores)){
for(Item item : content.items()){
data.addItem(item, tile.entity.items.get(item));
}
world.removeBlock(tile);
}
state.launched = true;
});
}
public boolean isZone(){
return getZone() != null;
}
public Zone getZone(){
return content.getByID(ContentType.zone, state.rules.zone);
}
public void playZone(Zone zone){ public void playZone(Zone zone){
ui.loadAnd(() -> { ui.loadAnd(() -> {
logic.reset(); logic.reset();
@@ -198,6 +234,8 @@ public class World implements ApplicationListener{
core.entity.items.add(stack.item, stack.amount); core.entity.items.add(stack.item, stack.amount);
} }
} }
state.rules.zone = zone.id;
control.saves.zoneSave();
logic.play(); logic.play();
}); });
} }
@@ -394,13 +432,60 @@ public class World implements ApplicationListener{
for(int x = 0; x < data.width(); x++){ for(int x = 0; x < data.width(); x++){
data.read(marker); data.read(marker);
tiles[x][y] = new Tile(x, y, marker.floor, marker.wall == Blocks.blockpart.id ? 0 : marker.wall, marker.rotation, marker.team); tiles[x][y] = new Tile(x, y, marker.floor, marker.wall == Blocks.part.id ? 0 : marker.wall, marker.rotation, marker.team);
} }
} }
prepareTiles(tiles); prepareTiles(tiles);
} }
public void addDarkness(Tile[][] tiles){
byte[][] dark = new byte[tiles.length][tiles[0].length];
byte[][] writeBuffer = new byte[tiles.length][tiles[0].length];
byte darkIterations = 4;
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
Tile tile = tiles[x][y];
if(tile.block().solid && !tile.block().update){
dark[x][y] = darkIterations;
}
}
}
for(int i = 0; i < darkIterations; i++){
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
boolean min = false;
for(Point2 point : Geometry.d4){
int newX = x + point.x, newY = y + point.y;
if(Structs.inBounds(newX, newY, tiles) && dark[newX][newY] < dark[x][y]){
min = true;
break;
}
}
writeBuffer[x][y] = (byte)Math.max(0, dark[x][y] - Mathf.num(min));
}
}
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
dark[x][y] = writeBuffer[x][y];
}
}
}
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
Tile tile = tiles[x][y];
if(tile.block().solid && !tile.block().update){
tiles[x][y].setRotation(dark[x][y]);
}
}
}
}
/**'Prepares' a tile array by:<br> /**'Prepares' a tile array by:<br>
* - setting up multiblocks<br> * - setting up multiblocks<br>
* - updating occlusion<br> * - updating occlusion<br>

View File

@@ -1,70 +1,28 @@
package io.anuke.mindustry.editor; package io.anuke.mindustry.editor;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.LongArray;
import io.anuke.arc.collection.IntSet;
import io.anuke.arc.util.Pack; import io.anuke.arc.util.Pack;
public class DrawOperation{ public class DrawOperation{
/** private LongArray array = new LongArray();
* Data to apply operation to.
*/
private MapTileData data;
/**
* List of per-tile operations that occurred.
*/
private Array<TileOperation> operations = new Array<>();
/**
* Checks for duplicate operations, useful for brushes.
*/
private IntSet checks = new IntSet();
public DrawOperation(MapTileData data){
this.data = data;
}
public boolean isEmpty(){ public boolean isEmpty(){
return operations.size == 0; return array.isEmpty();
} }
public boolean checkDuplicate(short x, short y){ public void addOperation(int xy, byte type, byte from, byte to){
int i = Pack.shortInt(x, y); array.add(Pack.longInt(xy, Pack.intBytes(type, from, to, (byte)0)));
if(checks.contains(i)) return true;
checks.add(i);
return false;
}
public void addOperation(TileOperation op){
operations.add(op);
} }
public void undo(MapEditor editor){ public void undo(MapEditor editor){
for(int i = operations.size - 1; i >= 0; i--){ for(int i = 0; i < array.size; i++){
TileOperation op = operations.get(i); long l = array.get(i);
data.position(op.x, op.y);
data.write(op.from);
editor.renderer().updatePoint(op.x, op.y);
} }
} }
public void redo(MapEditor editor){ public void redo(MapEditor editor){
for(TileOperation op : operations){ for(int i = 0; i < array.size; i++){
data.position(op.x, op.y); long l = array.get(i);
data.write(op.to);
editor.renderer().updatePoint(op.x, op.y);
}
}
public static class TileOperation{
public short x, y;
public TileDataMarker from;
public TileDataMarker to;
public TileOperation(short x, short y, TileDataMarker from, TileDataMarker to){
this.x = x;
this.y = y;
this.from = from;
this.to = to;
} }
} }
} }

View File

@@ -14,7 +14,7 @@ import static io.anuke.mindustry.Vars.ui;
public enum EditorTool{ public enum EditorTool{
pick{ pick{
public void touched(MapEditor editor, int x, int y){ public void touched(MapEditor editor, int x, int y){
if(!Structs.inBounds(x, y, editor.getMap().width(), editor.getMap().height())) return; if(!Structs.inBounds(x, y, world.width(), world.height())) return;
byte bf = editor.getMap().read(x, y, DataPosition.floor); byte bf = editor.getMap().read(x, y, DataPosition.floor);
byte bw = editor.getMap().read(x, y, DataPosition.wall); byte bw = editor.getMap().read(x, y, DataPosition.wall);
@@ -54,7 +54,7 @@ public enum EditorTool{
editor.draw(x, y, Blocks.air); editor.draw(x, y, Blocks.air);
} }
}, },
elevation{ spray{
{ {
edit = true; edit = true;
draggable = true; draggable = true;
@@ -62,7 +62,7 @@ public enum EditorTool{
@Override @Override
public void touched(MapEditor editor, int x, int y){ public void touched(MapEditor editor, int x, int y){
editor.elevate(x, y); editor.draw(x, y, editor.getDrawBlock(), 0.012);
} }
}, },
line{ line{
@@ -82,7 +82,7 @@ public enum EditorTool{
MapTileData data; MapTileData data;
public void touched(MapEditor editor, int x, int y){ public void touched(MapEditor editor, int x, int y){
if(!Structs.inBounds(x, y, editor.getMap().width(), editor.getMap().height())) return; if(!Structs.inBounds(x, y, world.width(), world.height())) return;
if(editor.getDrawBlock().isMultiblock()){ if(editor.getDrawBlock().isMultiblock()){
//don't fill multiblocks, thanks //don't fill multiblocks, thanks
@@ -96,7 +96,6 @@ public enum EditorTool{
byte bf = data.read(x, y, DataPosition.floor); byte bf = data.read(x, y, DataPosition.floor);
byte bw = data.read(x, y, DataPosition.wall); byte bw = data.read(x, y, DataPosition.wall);
be = data.read(x, y, DataPosition.elevation);
boolean synth = editor.getDrawBlock().synthetic(); boolean synth = editor.getDrawBlock().synthetic();
byte brt = Pack.byteByte((byte) editor.getDrawRotation(), (byte) editor.getDrawTeam().ordinal()); byte brt = Pack.byteByte((byte) editor.getDrawRotation(), (byte) editor.getDrawTeam().ordinal());
@@ -107,8 +106,8 @@ public enum EditorTool{
return; return;
} }
width = editor.getMap().width(); width = world.width();
int height = editor.getMap().height(); int height = world.height();
int x1; int x1;
boolean spanAbove, spanBelow; boolean spanAbove, spanBelow;

View File

@@ -9,54 +9,42 @@ import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.editor.DrawOperation.TileOperation; import io.anuke.mindustry.editor.DrawOperation.TileOperation;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Floor; import io.anuke.mindustry.world.blocks.Floor;
import static io.anuke.mindustry.Vars.content; import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.world;
public class MapEditor{ public class MapEditor{
public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15}; public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15, 20};
private MapTileData map;
private ObjectMap<String, String> tags = new ObjectMap<>(); private ObjectMap<String, String> tags = new ObjectMap<>();
private MapRenderer renderer = new MapRenderer(this); private MapRenderer renderer = new MapRenderer(this);
private int brushSize = 1; private int brushSize = 1;
private byte elevation;
private int rotation; private int rotation;
private Block drawBlock = Blocks.stone; private Block drawBlock = Blocks.stone;
private Team drawTeam = Team.blue; private Team drawTeam = Team.blue;
public MapTileData getMap(){
return map;
}
public ObjectMap<String, String> getTags(){ public ObjectMap<String, String> getTags(){
return tags; return tags;
} }
public void beginEdit(MapTileData map, ObjectMap<String, String> tags, boolean clear){ public void beginEdit(Tile[][] map, ObjectMap<String, String> tags, boolean clear){
this.map = map;
this.brushSize = 1; this.brushSize = 1;
this.tags = tags; this.tags = tags;
if(clear){ if(clear){
for(int x = 0; x < map.width(); x++){ for(int x = 0; x < map.length; x++){
for(int y = 0; y < map.height(); y++){ for(int y = 0; y < map[0].length; y++){
map.write(x, y, DataPosition.floor, Blocks.stone.id); map[x][y].setFloor((Floor)Blocks.stone);
} }
} }
} }
drawBlock = Blocks.stone; drawBlock = Blocks.stone;
renderer.resize(map.width(), map.height()); renderer.resize(map.length, map[0].length);
}
public byte getDrawElevation(){
return elevation;
}
public void setDrawElevation(int elevation){
this.elevation = (byte) elevation;
} }
public int getDrawRotation(){ public int getDrawRotation(){
@@ -96,19 +84,19 @@ public class MapEditor{
} }
public void draw(int x, int y, Block drawBlock){ public void draw(int x, int y, Block drawBlock){
if(x < 0 || y < 0 || x >= map.width() || y >= map.height()){ draw(x, y, drawBlock, 1.0);
return; }
}
public void draw(int x, int y, Block drawBlock, double chance){
byte writeID = drawBlock.id; byte writeID = drawBlock.id;
byte partID = Blocks.blockpart.id; byte partID = Blocks.part.id;
byte rotationTeam = Pack.byteByte(drawBlock.rotate ? (byte)rotation : 0, drawBlock.synthetic() ? (byte)drawTeam.ordinal() : 0); byte rotationTeam = Pack.byteByte(drawBlock.rotate ? (byte)rotation : 0, drawBlock.synthetic() ? (byte)drawTeam.ordinal() : 0);
boolean isfloor = drawBlock instanceof Floor && drawBlock != Blocks.air; boolean isfloor = drawBlock instanceof Floor && drawBlock != Blocks.air;
if(drawBlock.isMultiblock()){ if(drawBlock.isMultiblock()){
x = Mathf.clamp(x, (drawBlock.size-1)/2, map.width() - drawBlock.size/2 - 1); x = Mathf.clamp(x, (drawBlock.size-1)/2, world.width() - drawBlock.size/2 - 1);
y = Mathf.clamp(y, (drawBlock.size-1)/2, map.height() - drawBlock.size/2 - 1); y = Mathf.clamp(y, (drawBlock.size-1)/2, world.height() - drawBlock.size/2 - 1);
int offsetx = -(drawBlock.size - 1) / 2; int offsetx = -(drawBlock.size - 1) / 2;
int offsety = -(drawBlock.size - 1) / 2; int offsety = -(drawBlock.size - 1) / 2;
@@ -119,7 +107,7 @@ public class MapEditor{
int worldx = dx + offsetx + x; int worldx = dx + offsetx + x;
int worldy = dy + offsety + y; int worldy = dy + offsety + y;
if(Structs.inBounds(worldx, worldy, map.width(), map.height())){ if(Structs.inBounds(worldx, worldy, world.width(), world.height())){
TileDataMarker prev = getPrev(worldx, worldy, false); TileDataMarker prev = getPrev(worldx, worldy, false);
if(i == 1){ if(i == 1){
@@ -151,10 +139,9 @@ public class MapEditor{
onWrite(x, y, prev); onWrite(x, y, prev);
}else{ }else{
for(int rx = -brushSize; rx <= brushSize; rx++){ for(int rx = -brushSize; rx <= brushSize; rx++){
for(int ry = -brushSize; ry <= brushSize; ry++){ for(int ry = -brushSize; ry <= brushSize; ry++){
if(Mathf.dst(rx, ry) <= brushSize - 0.5f){ if(Mathf.dst(rx, ry) <= brushSize - 0.5f && (chance >= 0.999 || Mathf.chance(chance))){
int wx = x + rx, wy = y + ry; int wx = x + rx, wy = y + ry;
if(wx < 0 || wy < 0 || wx >= map.width() || wy >= map.height()){ if(wx < 0 || wy < 0 || wx >= map.width() || wy >= map.height()){
@@ -175,7 +162,6 @@ public class MapEditor{
if(isfloor){ if(isfloor){
map.write(wx, wy, DataPosition.floor, writeID); map.write(wx, wy, DataPosition.floor, writeID);
map.write(wx, wy, DataPosition.elevation, elevation);
}else{ }else{
map.write(wx, wy, DataPosition.wall, writeID); map.write(wx, wy, DataPosition.wall, writeID);
map.write(wx, wy, DataPosition.link, (byte) 0); map.write(wx, wy, DataPosition.link, (byte) 0);
@@ -189,30 +175,6 @@ public class MapEditor{
} }
} }
public void elevate(int x, int y){
if(x < 0 || y < 0 || x >= map.width() || y >= map.height()){
return;
}
for(int rx = -brushSize; rx <= brushSize; rx++){
for(int ry = -brushSize; ry <= brushSize; ry++){
if(Mathf.dst(rx, ry) <= brushSize - 0.5f){
int wx = x + rx, wy = y + ry;
if(wx < 0 || wy < 0 || wx >= map.width() || wy >= map.height()){
continue;
}
TileDataMarker prev = getPrev(wx, wy, true);
map.write(wx, wy, DataPosition.elevation, elevation);
onWrite(x + rx, y + ry, prev);
}
}
}
}
private void removeLinked(int x, int y){ private void removeLinked(int x, int y){
Block block = content.block(map.read(x, y, DataPosition.wall)); Block block = content.block(map.read(x, y, DataPosition.wall));

View File

@@ -1,6 +1,7 @@
package io.anuke.mindustry.editor; package io.anuke.mindustry.editor;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectMap; import io.anuke.arc.collection.ObjectMap;
import io.anuke.arc.files.FileHandle; import io.anuke.arc.files.FileHandle;
import io.anuke.arc.function.Consumer; import io.anuke.arc.function.Consumer;
@@ -11,21 +12,21 @@ import io.anuke.arc.input.KeyCode;
import io.anuke.arc.math.Mathf; import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Vector2; import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.scene.actions.Actions; import io.anuke.arc.scene.actions.Actions;
import io.anuke.arc.scene.style.TextureRegionDrawable;
import io.anuke.arc.scene.ui.*; import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.Stack;
import io.anuke.arc.scene.ui.layout.Table; import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.Unit; import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.utils.UIUtils; import io.anuke.arc.scene.utils.UIUtils;
import io.anuke.arc.util.*; import io.anuke.arc.util.*;
import io.anuke.mindustry.Vars; import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.io.MapIO; import io.anuke.mindustry.io.MapIO;
import io.anuke.mindustry.maps.Map; import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.ui.dialogs.FloatingDialog; import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Block.Icon;
import io.anuke.mindustry.world.blocks.OreBlock;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.InputStream; import java.io.InputStream;
@@ -42,6 +43,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
private FloatingDialog menu; private FloatingDialog menu;
private boolean saved = false; private boolean saved = false;
private boolean shownWithMap = false; private boolean shownWithMap = false;
private Array<Block> blocksOut = new Array<>();
private ButtonGroup<ImageButton> blockgroup; private ButtonGroup<ImageButton> blockgroup;
@@ -146,7 +148,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
}).padTop(-5).size(swidth * 2f + 10, 60f); }).padTop(-5).size(swidth * 2f + 10, 60f);
resizeDialog = new MapResizeDialog(editor, (x, y) -> { resizeDialog = new MapResizeDialog(editor, (x, y) -> {
if(!(editor.getMap().width() == x && editor.getMap().height() == y)){ if(!(world.width() == x && world.height() == y)){
ui.loadAnd(() -> { ui.loadAnd(() -> {
editor.resize(x, y); editor.resize(x, y);
view.clearStack(); view.clearStack();
@@ -386,7 +388,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
tools.row(); tools.row();
addTool.accept(EditorTool.fill); addTool.accept(EditorTool.fill);
addTool.accept(EditorTool.elevation); addTool.accept(EditorTool.spray);
ImageButton rotate = tools.addImageButton("icon-arrow-16", "clear", 16 * 2f, () -> editor.setDrawRotation((editor.getDrawRotation() + 1) % 4)).get(); ImageButton rotate = tools.addImageButton("icon-arrow-16", "clear", 16 * 2f, () -> editor.setDrawRotation((editor.getDrawRotation() + 1) % 4)).get();
rotate.getImage().update(() -> { rotate.getImage().update(() -> {
@@ -497,29 +499,21 @@ public class MapEditorDialog extends Dialog implements Disposable{
int i = 0; int i = 0;
for(Block block : Vars.content.blocks()){ blocksOut.clear();
TextureRegion[] regions = block.getCompactIcon(); blocksOut.addAll(Vars.content.blocks());
if((block.synthetic() && (Recipe.getByResult(block) == null || !data.isUnlocked(Recipe.getByResult(block)))) blocksOut.sort((b1, b2) -> b1.synthetic() && !b2.synthetic() ? 1 : b2.synthetic() && !b1.synthetic() ? -1 :
&& block != Blocks.core){ b1 instanceof OreBlock && !(b2 instanceof OreBlock) ? 1 : !(b1 instanceof OreBlock) && b2 instanceof OreBlock ? -1 :
continue; Integer.compare(b1.id, b2.id));
}
if(Recipe.getByResult(block) != null && !Recipe.getByResult(block).visibility.shown()){ for(Block block : blocksOut){
continue; TextureRegion region = block.icon(Icon.medium);
}
if(regions.length == 0 || regions[0] == Core.atlas.find("jjfgj")) continue; if(region == Core.atlas.find("jjfgj")) continue;
Stack stack = new Stack();
for(TextureRegion region : regions){
stack.add(new Image(region));
}
ImageButton button = new ImageButton("white", "clear-toggle"); ImageButton button = new ImageButton("white", "clear-toggle");
button.getStyle().imageUp = new TextureRegionDrawable(region);
button.clicked(() -> editor.setDrawBlock(block)); button.clicked(() -> editor.setDrawBlock(block));
button.resizeImage(8 * 4f); button.resizeImage(8 * 4f);
button.replaceImage(stack);
button.update(() -> button.setChecked(editor.getDrawBlock() == block)); button.update(() -> button.setChecked(editor.getDrawBlock() == block));
group.add(button); group.add(button);
content.add(button).size(50f); content.add(button).size(50f);

View File

@@ -8,9 +8,11 @@ import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.util.Disposable; import io.anuke.arc.util.Disposable;
import io.anuke.arc.util.Pack; import io.anuke.arc.util.Pack;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.graphics.IndexedRenderer; import io.anuke.mindustry.graphics.IndexedRenderer;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Block.Icon;
import static io.anuke.mindustry.Vars.content; import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.tilesize; import static io.anuke.mindustry.Vars.tilesize;
@@ -22,7 +24,6 @@ public class MapRenderer implements Disposable{
private IntSet delayedUpdates = new IntSet(); private IntSet delayedUpdates = new IntSet();
private MapEditor editor; private MapEditor editor;
private int width, height; private int width, height;
private Color tmpColor = Color.WHITE.cpy();
public MapRenderer(MapEditor editor){ public MapRenderer(MapEditor editor){
this.editor = editor; this.editor = editor;
@@ -109,33 +110,38 @@ public class MapRenderer implements Disposable{
TextureRegion region; TextureRegion region;
if(bw != 0){ int idxWall = (wx % chunksize) + (wy % chunksize) * chunksize;
region = wall.getEditorIcon(); int idxDecal = (wx % chunksize) + (wy % chunksize) * chunksize + chunksize * chunksize;
if(bw != 0 && (wall.synthetic() || wall == Blocks.part)){
region = wall.icon(Icon.full) == Core.atlas.find("____") ? Core.atlas.find("clear") : wall.icon(Icon.full);
if(wall.rotate){ if(wall.rotate){
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region, mesh.draw(idxWall, region,
wx * tilesize + wall.offset(), wy * tilesize + wall.offset(), wx * tilesize + wall.offset(), wy * tilesize + wall.offset(),
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl, rotation * 90 - 90); region.getWidth() * Draw.scl, region.getHeight() * Draw.scl, rotation * 90 - 90);
}else{ }else{
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region, mesh.draw(idxWall, region,
wx * tilesize + wall.offset() + (tilesize - region.getWidth() * Draw.scl)/2f, wx * tilesize + wall.offset() + (tilesize - region.getWidth() * Draw.scl)/2f,
wy * tilesize + wall.offset() + (tilesize - region.getHeight() * Draw.scl)/2f, wy * tilesize + wall.offset() + (tilesize - region.getHeight() * Draw.scl)/2f,
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl); region.getWidth() * Draw.scl, region.getHeight() * Draw.scl);
} }
}else{ }else{
region = floor.getEditorIcon(); region = floor.icon(Icon.full);
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region, wx * tilesize, wy * tilesize, 8, 8); mesh.draw(idxWall, region, wx * tilesize, wy * tilesize, 8, 8);
} }
if(wall.update || wall.destructible){ if(wall.update || wall.destructible){
mesh.setColor(team.color); mesh.setColor(team.color);
region = Core.atlas.find("block-border"); region = Core.atlas.find("block-border");
}else if(!wall.synthetic() && bw != 0){
region = wall.icon(Icon.full) == Core.atlas.find("____") ? Core.atlas.find("clear") : wall.icon(Icon.full);
}else{ }else{
region = Core.atlas.find("clear"); region = Core.atlas.find("clear");
} }
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize + chunksize * chunksize, region, mesh.draw(idxDecal, region,
wx * tilesize - (wall.size/3) * tilesize, wy * tilesize - (wall.size/3) * tilesize, wx * tilesize - (wall.size/3) * tilesize, wy * tilesize - (wall.size/3) * tilesize,
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl); region.getWidth() * Draw.scl, region.getHeight() * Draw.scl);
mesh.setColor(Color.WHITE); mesh.setColor(Color.WHITE);

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.editor;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.GridBits;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines; import io.anuke.arc.graphics.g2d.Lines;
@@ -18,19 +19,19 @@ import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.ui.TextField; import io.anuke.arc.scene.ui.TextField;
import io.anuke.arc.scene.ui.layout.Unit; import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.util.Tmp; import io.anuke.arc.util.Tmp;
import io.anuke.mindustry.editor.DrawOperation.TileOperation;
import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.input.Binding; import io.anuke.mindustry.input.Binding;
import io.anuke.mindustry.ui.GridImage; import io.anuke.mindustry.ui.GridImage;
import io.anuke.mindustry.world.Pos;
import static io.anuke.mindustry.Vars.mobile; import static io.anuke.mindustry.Vars.*;
import static io.anuke.mindustry.Vars.ui;
public class MapView extends Element implements GestureListener{ public class MapView extends Element implements GestureListener{
private MapEditor editor; private MapEditor editor;
private EditorTool tool = EditorTool.pencil; private EditorTool tool = EditorTool.pencil;
private OperationStack stack = new OperationStack(); private OperationStack stack = new OperationStack();
private DrawOperation op; private DrawOperation op;
private GridBits used;
private Bresenham2 br = new Bresenham2(); private Bresenham2 br = new Bresenham2();
private boolean updated = false; private boolean updated = false;
private float offsetx, offsety; private float offsetx, offsety;
@@ -86,7 +87,12 @@ public class MapView extends Element implements GestureListener{
mousex = x; mousex = x;
mousey = y; mousey = y;
op = new DrawOperation(editor.getMap()); op = new DrawOperation();
if(used == null || used.width() != world.width() || used.height() != world.height()){
used = new GridBits(world.width(), world.height());
}else{
used.clear();
}
updated = false; updated = false;
@@ -146,7 +152,7 @@ public class MapView extends Element implements GestureListener{
Point2 p = project(x, y); Point2 p = project(x, y);
if(drawing && tool.draggable){ if(drawing && tool.draggable && !(p.x == lastx && p.y == lasty)){
ui.editor.resetSaved(); ui.editor.resetSaved();
Array<Point2> points = br.line(lastx, lasty, p.x, p.y); Array<Point2> points = br.line(lastx, lasty, p.x, p.y);
for(Point2 point : points){ for(Point2 point : points){
@@ -196,12 +202,13 @@ public class MapView extends Element implements GestureListener{
} }
} }
public void addTileOp(TileOperation t){ public void addTileOp(int xy, byte type, byte from, byte to){
op.addOperation(t); used.set(Pos.x(xy), Pos.y(xy));
op.addOperation(xy, type, from, to);
} }
public boolean checkForDuplicates(short x, short y){ public boolean checkForDuplicates(short x, short y){
return op.checkDuplicate(x, y); return used.get(x, y);
} }
@Override @Override
@@ -227,12 +234,12 @@ public class MapView extends Element implements GestureListener{
} }
private Point2 project(float x, float y){ private Point2 project(float x, float y){
float ratio = 1f / ((float) editor.getMap().width() / editor.getMap().height()); float ratio = 1f / ((float) world.width() / world.height());
float size = Math.min(width, height); float size = Math.min(width, height);
float sclwidth = size * zoom; float sclwidth = size * zoom;
float sclheight = size * zoom * ratio; float sclheight = size * zoom * ratio;
x = (x - getWidth() / 2 + sclwidth / 2 - offsetx * zoom) / sclwidth * editor.getMap().width(); x = (x - getWidth() / 2 + sclwidth / 2 - offsetx * zoom) / sclwidth * world.width();
y = (y - getHeight() / 2 + sclheight / 2 - offsety * zoom) / sclheight * editor.getMap().height(); y = (y - getHeight() / 2 + sclheight / 2 - offsety * zoom) / sclheight * world.height();
if(editor.getDrawBlock().size % 2 == 0 && tool != EditorTool.eraser){ if(editor.getDrawBlock().size % 2 == 0 && tool != EditorTool.eraser){
return Tmp.g1.set((int) (x - 0.5f), (int) (y - 0.5f)); return Tmp.g1.set((int) (x - 0.5f), (int) (y - 0.5f));
@@ -242,26 +249,26 @@ public class MapView extends Element implements GestureListener{
} }
private Vector2 unproject(int x, int y){ private Vector2 unproject(int x, int y){
float ratio = 1f / ((float) editor.getMap().width() / editor.getMap().height()); float ratio = 1f / ((float) world.width() / world.height());
float size = Math.min(width, height); float size = Math.min(width, height);
float sclwidth = size * zoom; float sclwidth = size * zoom;
float sclheight = size * zoom * ratio; float sclheight = size * zoom * ratio;
float px = ((float) x / editor.getMap().width()) * sclwidth + offsetx * zoom - sclwidth / 2 + getWidth() / 2; float px = ((float) x / world.width()) * sclwidth + offsetx * zoom - sclwidth / 2 + getWidth() / 2;
float py = ((float) (y) / editor.getMap().height()) * sclheight float py = ((float) (y) / world.height()) * sclheight
+ offsety * zoom - sclheight / 2 + getHeight() / 2; + offsety * zoom - sclheight / 2 + getHeight() / 2;
return vec.set(px, py); return vec.set(px, py);
} }
@Override @Override
public void draw(){ public void draw(){
float ratio = 1f / ((float) editor.getMap().width() / editor.getMap().height()); float ratio = 1f / ((float) world.width() / world.height());
float size = Math.min(width, height); float size = Math.min(width, height);
float sclwidth = size * zoom; float sclwidth = size * zoom;
float sclheight = size * zoom * ratio; float sclheight = size * zoom * ratio;
float centerx = x + width / 2 + offsetx * zoom; float centerx = x + width / 2 + offsetx * zoom;
float centery = y + height / 2 + offsety * zoom; float centery = y + height / 2 + offsety * zoom;
image.setImageSize(editor.getMap().width(), editor.getMap().height()); image.setImageSize(world.width(), world.height());
if(!ScissorStack.pushScissors(rect.set(x, y, width, height))){ if(!ScissorStack.pushScissors(rect.set(x, y, width, height))){
return; return;
@@ -292,7 +299,7 @@ public class MapView extends Element implements GestureListener{
} }
} }
float scaling = zoom * Math.min(width, height) / editor.getMap().width(); float scaling = zoom * Math.min(width, height) / world.width();
Draw.color(Palette.accent); Draw.color(Palette.accent);
Lines.stroke(Unit.dp.scl(1f * zoom)); Lines.stroke(Unit.dp.scl(1f * zoom));

View File

@@ -26,12 +26,14 @@ import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.input.Binding; import io.anuke.mindustry.input.Binding;
import io.anuke.mindustry.io.TypeIO; import io.anuke.mindustry.io.TypeIO;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.NetConnection; import io.anuke.mindustry.net.NetConnection;
import io.anuke.mindustry.type.*; import io.anuke.mindustry.type.*;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Block.Icon;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Floor; import io.anuke.mindustry.world.blocks.Floor;
import io.anuke.mindustry.world.blocks.storage.CoreBlock.CoreEntity; import io.anuke.mindustry.world.blocks.storage.CoreBlock.CoreEntity;
@@ -109,6 +111,31 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
rectangle.setSize(mech.hitsize * 2f / 3f).setCenter(x, y); rectangle.setSize(mech.hitsize * 2f / 3f).setCenter(x, y);
} }
@Override
public void onRespawn(Tile tile){
boostHeat = 1f;
achievedFlight = true;
}
@Override
public void move(float x, float y){
if(!mech.flying){
EntityQuery.collisions().move(this, x, y);
}else{
moveBy(x, y);
}
}
@Override
public boolean collidesGrid(int x, int y){
Tile tile = world.tile(x, y);
if(!isFlying()) return true;
if(!mech.flying && tile != null && !tile.block().synthetic() && tile.block().solid){
return true;
}
return false;
}
@Override @Override
public float drag(){ public float drag(){
return mech.drag; return mech.drag;
@@ -304,7 +331,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
Floor floor = getFloorOn(); Floor floor = getFloorOn();
Draw.color(); Draw.color();
Draw.alpha(hitTime / hitDuration); Draw.alpha(Draw.getShader() != Shaders.mix ? 1f : hitTime / hitDuration);
if(!mech.flying){ if(!mech.flying){
if(floor.isLiquid){ if(floor.isLiquid){
@@ -422,7 +449,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
Lines.stroke(2f, Palette.removeBack); Lines.stroke(2f, Palette.removeBack);
float rad = Mathf.absin(Time.time(), 7f, 1f) + block.size * tilesize / 2f - 1; float rad = Mathf.absin(Time.time(), 7f, 1f) + block.size * tilesize / 2f - 1;
Lines.square( Lines.square(
request.x * tilesize + block.offset(), request.x * tilesize + block.offset(),
request.y * tilesize + block.offset() - 1, request.y * tilesize + block.offset() - 1,
@@ -435,21 +461,28 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
request.y * tilesize + block.offset(), request.y * tilesize + block.offset(),
rad); rad);
}else{ }else{
//draw place request float rad = Mathf.absin(Time.time(), 7f, 1f) - 1.5f + request.block.size * tilesize / 2f;
Lines.stroke(2f, Palette.accentBack);
float rad = Mathf.absin(Time.time(), 7f, 1f) - 2f + request.recipe.result.size * tilesize / 2f; //draw place request
Lines.stroke(1f, Palette.accentBack);
Lines.square( Lines.square(
request.x * tilesize + request.recipe.result.offset(), request.x * tilesize + request.block.offset(),
request.y * tilesize + request.recipe.result.offset() - 1, request.y * tilesize + request.block.offset() - 1,
rad); rad);
Draw.color();
Draw.rect(request.block.icon(Icon.full),
request.x * tilesize + request.block.offset(),
request.y * tilesize + request.block.offset(), rad*2, rad*2, request.rotation * 90);
Draw.color(Palette.accent); Draw.color(Palette.accent);
Lines.square( Lines.square(
request.x * tilesize + request.recipe.result.offset(), request.x * tilesize + request.block.offset(),
request.y * tilesize + request.recipe.result.offset(), request.y * tilesize + request.block.offset(),
rad); rad);
} }
} }

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.entities;
import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote; import io.anuke.annotations.Annotations.Remote;
import io.anuke.arc.Events;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectSet; import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.entities.Effects; import io.anuke.arc.entities.Effects;
@@ -16,6 +17,7 @@ import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.Fx; import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.traits.TargetTrait; import io.anuke.mindustry.entities.traits.TargetTrait;
import io.anuke.mindustry.game.EventType.BlockDestroyEvent;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -244,6 +246,7 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
dead = true; dead = true;
Block block = tile.block(); Block block = tile.block();
Events.fire(new BlockDestroyEvent(tile));
block.onDestroyed(tile); block.onDestroyed(tile);
world.removeBlock(tile); world.removeBlock(tile);
block.afterDestroyed(tile, this); block.afterDestroyed(tile, this);

View File

@@ -1,6 +1,7 @@
package io.anuke.mindustry.entities; package io.anuke.mindustry.entities;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.Events;
import io.anuke.arc.entities.Effects; import io.anuke.arc.entities.Effects;
import io.anuke.arc.entities.impl.DestructibleEntity; import io.anuke.arc.entities.impl.DestructibleEntity;
import io.anuke.arc.entities.trait.DamageTrait; import io.anuke.arc.entities.trait.DamageTrait;
@@ -17,6 +18,7 @@ import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Time; import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.Blocks; import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.traits.*; import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.game.EventType.UnitDestroyEvent;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Teams.TeamData; import io.anuke.mindustry.game.Teams.TeamData;
import io.anuke.mindustry.net.Interpolator; import io.anuke.mindustry.net.Interpolator;
@@ -72,6 +74,11 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
return carrier; return carrier;
} }
@Override
public boolean collidesGrid(int x, int y){
return !isFlying();
}
@Override @Override
public void setCarrier(CarryTrait carrier){ public void setCarrier(CarryTrait carrier){
this.carrier = carrier; this.carrier = carrier;
@@ -121,6 +128,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
inventory.clear(); inventory.clear();
drownTime = 0f; drownTime = 0f;
status.clear(); status.clear();
Events.fire(new UnitDestroyEvent(this));
} }
@Override @Override
@@ -217,6 +225,8 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
return tile == null ? (Floor) Blocks.air : tile.floor(); return tile == null ? (Floor) Blocks.air : tile.floor();
} }
public void onRespawn(Tile tile){}
@Override @Override
public boolean isValid(){ public boolean isValid(){
return !isDead() && isAdded(); return !isDead() && isAdded();
@@ -239,8 +249,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
velocity.limit(maxVelocity()).scl(1f + (status.getSpeedMultiplier()-1f) * Time.delta()); velocity.limit(maxVelocity()).scl(1f + (status.getSpeedMultiplier()-1f) * Time.delta());
if(isFlying()){ if(isFlying()){
x += velocity.x * Time.delta(); move(velocity.x * Time.delta(), velocity.y * Time.delta());
y += velocity.y * Time.delta();
}else{ }else{
boolean onLiquid = floor.isLiquid; boolean onLiquid = floor.isLiquid;

View File

@@ -14,7 +14,7 @@ import static io.anuke.mindustry.Vars.groundEffectGroup;
* Class for creating block rubble on the ground. * Class for creating block rubble on the ground.
*/ */
public abstract class Decal extends TimedEntity implements BelowLiquidTrait, DrawTrait{ public abstract class Decal extends TimedEntity implements BelowLiquidTrait, DrawTrait{
private static final Color color = Color.valueOf("52504e"); private static final Color color = Color.valueOf("3a3635");
@Override @Override
public float lifetime(){ public float lifetime(){

Some files were not shown because too many files have changed in this diff Show More