c l e a n u p

This commit is contained in:
Anuken
2020-02-05 18:28:19 -05:00
75 changed files with 2583 additions and 2600 deletions

View File

@@ -22,12 +22,14 @@ First, make sure you have [JDK 8](https://adoptopenjdk.net/) installed. Open a t
#### Windows #### Windows
_Running:_ `gradlew desktop:run` _Running:_ `gradlew desktop:run`
_Building:_ `gradlew desktop:dist` _Building:_ `gradlew desktop:dist`
_Sprite Packing:_ `gradlew tools:pack`
#### Linux/Mac OS #### Linux/Mac OS
_Running:_ `./gradlew desktop:run` _Running:_ `./gradlew desktop:run`
_Building:_ `./gradlew desktop:dist` _Building:_ `./gradlew desktop:dist`
_Sprite Packing:_ `./gradlew tools:pack`
#### Server #### Server

View File

@@ -164,6 +164,7 @@ public class EntityProcess extends BaseProcessor{
fbuilder.initializer(tree.getInitializer().toString()); fbuilder.initializer(tree.getInitializer().toString());
} }
if(!isFinal) fbuilder.addModifiers(Modifier.PROTECTED);
fbuilder.addAnnotations(f.annotations().map(AnnotationSpec::get)); fbuilder.addAnnotations(f.annotations().map(AnnotationSpec::get));
builder.addField(fbuilder.build()); builder.addField(fbuilder.build());
} }

View File

@@ -3,5 +3,6 @@
mindustry.entities.def.EntityDefs.DecalDef=1 mindustry.entities.def.EntityDefs.DecalDef=1
mindustry.entities.def.EntityDefs.EffectDef=2 mindustry.entities.def.EntityDefs.EffectDef=2
mindustry.entities.def.EntityDefs.TileDef=3 mindustry.entities.def.EntityDefs.TileDef=3
mindustry.entities.def.EntityDefs.GenericUnitDef=5
mindustry.entities.def.EntityDefs.BulletDef=0 mindustry.entities.def.EntityDefs.BulletDef=0
mindustry.entities.def.EntityDefs.PlayerDef=4 mindustry.entities.def.EntityDefs.PlayerDef=4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -45,7 +45,7 @@ schematic.exportfile = Esporta File
schematic.importfile = Importa File schematic.importfile = Importa File
schematic.browseworkshop = Naviga nel Workshop schematic.browseworkshop = Naviga nel Workshop
schematic.copy = Copia negli Appunti schematic.copy = Copia negli Appunti
schematic.copy.import = Incolla dagli Appunti schematic.copy.import = Importa dagli Appunti
schematic.shareworkshop = Condividi nel Workshop schematic.shareworkshop = Condividi nel Workshop
schematic.flip = [accent][[{0}][]/[accent][[{1}][]: Ruota Schematica schematic.flip = [accent][[{0}][]/[accent][[{1}][]: Ruota Schematica
schematic.saved = Schematica salvata. schematic.saved = Schematica salvata.
@@ -59,6 +59,7 @@ stat.built = Costruzioni Erette:[accent] {0}
stat.destroyed = Costruzioni Distrutte:[accent] {0} stat.destroyed = Costruzioni Distrutte:[accent] {0}
stat.deconstructed = Costruzioni Smantellate:[accent] {0} stat.deconstructed = Costruzioni Smantellate:[accent] {0}
stat.delivered = Risorse Lanciate: stat.delivered = Risorse Lanciate:
stat.playtime = Tempo Di Gioco:[accent] {0}
stat.rank = Livello Finale: [accent]{0} stat.rank = Livello Finale: [accent]{0}
launcheditems = [accent]Oggetti Lanciati launcheditems = [accent]Oggetti Lanciati
@@ -69,7 +70,7 @@ level.select = Selezione del Livello
level.mode = Modalità di Gioco: level.mode = Modalità di Gioco:
showagain = Non mostrare più showagain = Non mostrare più
coreattack = < Il Nucleo è sotto attacco! > coreattack = < Il Nucleo è sotto attacco! >
nearpoint = [[ [scarlet]LASCIA LA ZONA NEMICA IMMEDIATAMENTE[] ]\autodistruzione imminente nearpoint = [[ [scarlet]LASCIA LA ZONA NEMICA IMMEDIATAMENTE[] ]\nautodistruzione imminente
database = Database Nucleo database = Database Nucleo
savegame = Salva savegame = Salva
loadgame = Carica loadgame = Carica
@@ -104,6 +105,7 @@ mods.none = [lightgray]Nessuna mod trovata!
mods.guide = Guida per il modding mods.guide = Guida per il modding
mods.report = Segnala un Bug mods.report = Segnala un Bug
mods.openfolder = Apri Cartella Mods mods.openfolder = Apri Cartella Mods
mod.display = [gray]Mod:[orange] {0}
mod.enabled = [lightgray]Abilitato mod.enabled = [lightgray]Abilitato
mod.disabled = [scarlet]Disabilitato mod.disabled = [scarlet]Disabilitato
mod.disable = Disabilita mod.disable = Disabilita
@@ -143,7 +145,7 @@ server.closing = [accent]Chiusura server...
server.kicked.kick = Sei stato espulso dal server! server.kicked.kick = Sei stato espulso dal server!
server.kicked.whitelist = Non sei presente nella whitelist. server.kicked.whitelist = Non sei presente nella whitelist.
server.kicked.serverClose = Server chiuso. server.kicked.serverClose = Server chiuso.
server.kicked.vote = Sei stato esplso su richiesta dei giocatori. Tanti saluti. server.kicked.vote = Sei stato espulso su richiesta dei giocatori. Tanti saluti.
server.kicked.clientOutdated = Versione del client obsoleta! Aggiorna il gioco! server.kicked.clientOutdated = Versione del client obsoleta! Aggiorna il gioco!
server.kicked.serverOutdated = Server obsoleto! Chiedi all'host di aggiornare la versione del server! server.kicked.serverOutdated = Server obsoleto! Chiedi all'host di aggiornare la versione del server!
server.kicked.banned = Sei stato bandito da questo server. server.kicked.banned = Sei stato bandito da questo server.
@@ -668,6 +670,7 @@ setting.mutesound.name = Silenzia Suoni
setting.crashreport.name = Invia rapporti anonimi sugli arresti anomali setting.crashreport.name = Invia rapporti anonimi sugli arresti anomali
setting.savecreate.name = Salvataggio Automatico setting.savecreate.name = Salvataggio Automatico
setting.publichost.name = Gioco Visibile Pubblicamente setting.publichost.name = Gioco Visibile Pubblicamente
setting.playerlimit.name = Limite Giocatori
setting.chatopacity.name = Opacità Chat setting.chatopacity.name = Opacità Chat
setting.lasersopacity.name = Opacità Raggi Energetici setting.lasersopacity.name = Opacità Raggi Energetici
setting.bridgeopacity.name = Opacità Nastri e Condotti Sopraelevati setting.bridgeopacity.name = Opacità Nastri e Condotti Sopraelevati

View File

@@ -40,7 +40,7 @@ schematic = Blauwdruk
schematic.add = Bewaar blauwdruk... schematic.add = Bewaar blauwdruk...
schematics = Blauwdrukken schematics = Blauwdrukken
schematic.replace = Er bestaat al een blauwdruk met die naam. Overschrijven? schematic.replace = Er bestaat al een blauwdruk met die naam. Overschrijven?
schematic.import = Importeer blauwdrul... schematic.import = Importeer blauwdruk...
schematic.exportfile = Exporteer bestand schematic.exportfile = Exporteer bestand
schematic.importfile = Importeer bestand schematic.importfile = Importeer bestand
schematic.browseworkshop = Blader Werkplaats schematic.browseworkshop = Blader Werkplaats
@@ -245,13 +245,13 @@ workshop.listing = Bewerk Workshop vermelding
ok = Oke ok = Oke
open = Open open = Open
customize = Aanpassen customize = Aanpassen
cancel = Anuleer cancel = Annuleer
openlink = Open Link openlink = Open Link
copylink = Customize Link copylink = Customize Link
back = Teru back = Terug
data.export = Exporteer Data data.export = Exporteer Data
data.import = Importeer Data data.import = Importeer Data
data.exported = Data Geexporteerd. data.exported = Data Geëxporteerd.
data.invalid = Dit is geen geldige game data. data.invalid = Dit is geen geldige game data.
data.import.confirm = Importeren van data verwijderd[scarlet] alle[] huidige data.\n[accent]Dit kan niet ongedaan worden gemaakt![]\n\nWanneer de data is geimport herstart deze game automatisch. data.import.confirm = Importeren van data verwijderd[scarlet] alle[] huidige data.\n[accent]Dit kan niet ongedaan worden gemaakt![]\n\nWanneer de data is geimport herstart deze game automatisch.
classic.export = Exporteer klassieke data classic.export = Exporteer klassieke data
@@ -450,7 +450,7 @@ launch.title = Lancering Sucessvol
launch.next = [LIGHT_GRAY]volgende lanceerkans in ronde {0} launch.next = [LIGHT_GRAY]volgende lanceerkans in ronde {0}
launch.unable2 = [scarlet]Lanceren niet mogelijk.[] launch.unable2 = [scarlet]Lanceren niet mogelijk.[]
launch.confirm = Dit lanceert alle items in je core.\nJe zal niet meer terug kunnen keren naar deze basis. launch.confirm = Dit lanceert alle items in je core.\nJe zal niet meer terug kunnen keren naar deze basis.
launch.skip.confirm = Als je nu niet lanceert, zul je moeten wachten tot het wel weer kan. launch.skip.confirm = Als je nu niet lanceert zul je moeten wachten tot de volgende mogelijkheid.
uncover = Ontdek uncover = Ontdek
configure = Configureer startinventaris configure = Configureer startinventaris
bannedblocks = Verboden Blokken bannedblocks = Verboden Blokken
@@ -532,21 +532,21 @@ blocks.input = Input
blocks.output = Output blocks.output = Output
blocks.booster = Booster blocks.booster = Booster
block.unknown = [LIGHT_GRAY]??? block.unknown = [LIGHT_GRAY]???
blocks.powercapacity = Stroom Capaciteit blocks.powercapacity = Stroomcapaciteit
blocks.powershot = Stroom/Shot blocks.powershot = Stroom/Schot
blocks.damage = Damage blocks.damage = Schade
blocks.targetsair = Luchtdoelwitten blocks.targetsair = Luchtdoelwitten
blocks.targetsground = Gronddoelwitten blocks.targetsground = Gronddoelwitten
blocks.itemsmoved = Beweegsnelheid blocks.itemsmoved = Beweegsnelheid
blocks.launchtime = Tijd tussen lanceringen blocks.launchtime = Tijd tussen lanceringen
blocks.shootrange = Bereik blocks.shootrange = Bereik
blocks.size = Formaat blocks.size = Formaat
blocks.liquidcapacity = Vloeistof Capaciteit blocks.liquidcapacity = Vloeistofcapaciteit
blocks.powerrange = Stroom Bereik blocks.powerrange = Stroombereik
blocks.powerconnections = Maximale Hoeveelheid Dradem blocks.powerconnections = Maximale Hoeveelheid Connecties
blocks.poweruse = Stroom verbruik blocks.poweruse = Stroomverbruik
blocks.powerdamage = Stroom/Damage blocks.powerdamage = Stroom/Schade
blocks.itemcapacity = Materiaal Capaciteit blocks.itemcapacity = Materiaalcapaciteit
blocks.basepowergeneration = Standaard Stroom Generatie blocks.basepowergeneration = Standaard Stroom Generatie
blocks.productiontime = Productie Tijd blocks.productiontime = Productie Tijd
blocks.repairtime = Volledige Blok Repareertijd blocks.repairtime = Volledige Blok Repareertijd
@@ -556,17 +556,17 @@ blocks.drilltier = Valt te delven
blocks.drillspeed = Standaard mine snelheid blocks.drillspeed = Standaard mine snelheid
blocks.boosteffect = Boost Effect blocks.boosteffect = Boost Effect
blocks.maxunits = Maximaal Actieve Units blocks.maxunits = Maximaal Actieve Units
blocks.health = Health blocks.health = Levenspunten
blocks.buildtime = Bouw tijd blocks.buildtime = Bouwtijd
blocks.buildcost = Bouw kosten blocks.buildcost = Bouwkosten
blocks.inaccuracy = Onnauwkeurigheid blocks.inaccuracy = Onnauwkeurigheid
blocks.shots = Shoten blocks.shots = Shoten
blocks.reload = Schoten/Seconde blocks.reload = Schoten/Seconde
blocks.ammo = Ammonutie blocks.ammo = Ammunitie
bar.drilltierreq = Betere miner nodig bar.drilltierreq = Betere miner nodig
bar.drillspeed = Mining Snelheid: {0}/s bar.drillspeed = Mining Snelheid: {0}/s
bar.pumpspeed = Pomp Snelheid: {0}/s bar.pumpspeed = Pompsnelheid: {0}/s
bar.efficiency = Rendement: {0}% bar.efficiency = Rendement: {0}%
bar.powerbalance = Stroom: {0} bar.powerbalance = Stroom: {0}
bar.powerstored = Opgeslagen: {0}/{1} bar.powerstored = Opgeslagen: {0}/{1}
@@ -591,15 +591,15 @@ bullet.frag = [stat]clusterbom
bullet.knockback = [stat]{0}[lightgray] terugslag bullet.knockback = [stat]{0}[lightgray] terugslag
bullet.freezing = [stat]bevriezend bullet.freezing = [stat]bevriezend
bullet.tarred = [stat]pek bullet.tarred = [stat]pek
bullet.multiplier = [stat]{0}[lightgray]x ammonutie verdubbelaar bullet.multiplier = [stat]{0}[lightgray]x ammunitieverdubbelaar
bullet.reload = [stat]{0}[lightgray]x herlaad bullet.reload = [stat]{0}[lightgray]x herlaad
unit.blocks = blokken unit.blocks = blokken
unit.powersecond = stroom eenheid/seconde unit.powersecond = stroomeenheid/seconde
unit.liquidsecond = vloeistof eenheid/seconde unit.liquidsecond = vloeistofeenheid/seconde
unit.itemssecond = items/seconde unit.itemssecond = items/seconde
unit.liquidunits = vloeistof eenheid unit.liquidunits = vloeistofeenheid
unit.powerunits = stroom eenheid unit.powerunits = stroomeenheid
unit.degrees = graden unit.degrees = graden
unit.seconds = secondes unit.seconds = secondes
unit.persecond = /sec unit.persecond = /sec
@@ -615,8 +615,8 @@ category.items = Items
category.crafting = Productie category.crafting = Productie
category.shooting = Wapens category.shooting = Wapens
category.optional = Optionele Verbeteringen category.optional = Optionele Verbeteringen
setting.landscape.name = Vergrendel Landscape setting.landscape.name = Vergrendel Landschap
setting.shadows.name = Schaduws setting.shadows.name = Schaduwen
setting.blockreplace.name = Automatische Blok Suggesties setting.blockreplace.name = Automatische Blok Suggesties
setting.linear.name = Linear Filtering setting.linear.name = Linear Filtering
setting.hints.name = Hints setting.hints.name = Hints
@@ -629,14 +629,14 @@ setting.autotarget.name = Auto-Target
setting.keyboard.name = Muis+Toetsenbord Controls setting.keyboard.name = Muis+Toetsenbord Controls
setting.touchscreen.name = Touchscreen Controls setting.touchscreen.name = Touchscreen Controls
setting.fpscap.name = Max FPS setting.fpscap.name = Max FPS
setting.fpscap.none = None setting.fpscap.none = Geen
setting.fpscap.text = {0} FPS setting.fpscap.text = {0} FPS
setting.uiscale.name = UI Schaal[lightgray] (herstart vereist)[] setting.uiscale.name = UI Schaal[lightgray] (herstart vereist)[]
setting.swapdiagonal.name = Altijd Diagonaal Plaatsen setting.swapdiagonal.name = Altijd Diagonaal Plaatsen
setting.difficulty.training = kalm setting.difficulty.training = oefening
setting.difficulty.easy = makkelijk setting.difficulty.easy = makkelijk
setting.difficulty.normal = normaal setting.difficulty.normal = normaal
setting.difficulty.hard = hard setting.difficulty.hard = moeilijk
setting.difficulty.insane = krankzinnig setting.difficulty.insane = krankzinnig
setting.difficulty.name = Moeilijkheidsgraad: setting.difficulty.name = Moeilijkheidsgraad:
setting.screenshake.name = Schuddend Scherm setting.screenshake.name = Schuddend Scherm
@@ -932,7 +932,7 @@ block.lancer.name = Lancer
block.conveyor.name = Lopende Band block.conveyor.name = Lopende Band
block.titanium-conveyor.name = Titanium Lopende Band block.titanium-conveyor.name = Titanium Lopende Band
block.armored-conveyor.name = Gepantserde Lopende Band block.armored-conveyor.name = Gepantserde Lopende Band
block.armored-conveyor.description = Verplaatst items met dezelfde snelheid als een van titanium, maar heeft meer levenspunten. accepteert alleen items van de zijkanten als het ook lopende banden zijn. block.armored-conveyor.description = Verplaatst items met dezelfde snelheid als een van titanium, maar heeft meer levenspunten. Accepteert alleen items van de zijkanten als het ook lopende banden zijn.
block.junction.name = Kruising block.junction.name = Kruising
block.router.name = Router block.router.name = Router
block.distributor.name = Distributor block.distributor.name = Distributor
@@ -1060,7 +1060,7 @@ unit.eradicator.name = Eradicator
unit.lich.name = Lich unit.lich.name = Lich
unit.reaper.name = Reaper unit.reaper.name = Reaper
tutorial.next = [lightgray]<Klik om verder te gaan> tutorial.next = [lightgray]<Klik om verder te gaan>
tutorial.intro = Welkom bij de[scarlet] Mindustry Tutorial.[]\nBegin met het[accent] delven van koper[]. Klik op een vakje die het heeft om het te delven.\n\n[accent]{0}/{1} koper tutorial.intro = Welkom bij de[scarlet] Mindustry Tutorial.[]\nBegin met het[accent] delven van koper[]. Klik op een vakje met koper om het te delven.\n\n[accent]{0}/{1} koper
tutorial.intro.mobile = Welkom bij de[scarlet] Mindustry Tutorial.[]\nVeeg over het scherm om te bewegen.\n[accent]Knijp met 2 vingers [] om in en uit te zoomen.\nBegin met het[accent] delven van koper[]. Beweeg dichterbij, en klik er dan op.\n\n[accent]{0}/{1} koper tutorial.intro.mobile = Welkom bij de[scarlet] Mindustry Tutorial.[]\nVeeg over het scherm om te bewegen.\n[accent]Knijp met 2 vingers [] om in en uit te zoomen.\nBegin met het[accent] delven van koper[]. Beweeg dichterbij, en klik er dan op.\n\n[accent]{0}/{1} koper
tutorial.drill = Met de hand delven is inefficient.\n[accent]Drills []kunnen automatisch voor je delven.\nPlaats er een op de koper. tutorial.drill = Met de hand delven is inefficient.\n[accent]Drills []kunnen automatisch voor je delven.\nPlaats er een op de koper.
tutorial.drill.mobile = Met de hand delven is inefficient.\n[accent]Drills []kunnen automatisch voor je delven.\nZoek de drill rechts onderin.\nSelecter de[accent] mechanische drill[].\nPlaats het op de koper door erop te klikken, druk dan op het[accent] vinkje[] om het bouwen te bevestigen.\nKlik op de[accent] X knop[] om het te anuleren. tutorial.drill.mobile = Met de hand delven is inefficient.\n[accent]Drills []kunnen automatisch voor je delven.\nZoek de drill rechts onderin.\nSelecter de[accent] mechanische drill[].\nPlaats het op de koper door erop te klikken, druk dan op het[accent] vinkje[] om het bouwen te bevestigen.\nKlik op de[accent] X knop[] om het te anuleren.
@@ -1068,8 +1068,8 @@ tutorial.blockinfo = Elk blok heeft andere statistieken. Elke drill kan enkel be
tutorial.conveyor = [accent]Lopende Banden[] worden gebruikt om je items naar je core te krijgen.\nLeg een line aan van je drills tot aan je core. tutorial.conveyor = [accent]Lopende Banden[] worden gebruikt om je items naar je core te krijgen.\nLeg een line aan van je drills tot aan je core.
tutorial.conveyor.mobile = [accent]Lopende Banden[] worden gebruikt om je items naar je core te krijgen.\nLeg een line aan van je drills tot aan je core.\n[accent] Doe dit door je vinger een paar seconden stil te houden[] en dan in een richting te slepen.\n\n[accent]{0}/{1} lopende banden in 1x geplaatst\n[accent]0/1 items afgeleverd tutorial.conveyor.mobile = [accent]Lopende Banden[] worden gebruikt om je items naar je core te krijgen.\nLeg een line aan van je drills tot aan je core.\n[accent] Doe dit door je vinger een paar seconden stil te houden[] en dan in een richting te slepen.\n\n[accent]{0}/{1} lopende banden in 1x geplaatst\n[accent]0/1 items afgeleverd
tutorial.turret = Defensieve gebouwen moeten worden gebouwd tegen de[LIGHT_GRAY] vijand[].\nBouw een duo kannon bij je basis. tutorial.turret = Defensieve gebouwen moeten worden gebouwd tegen de[LIGHT_GRAY] vijand[].\nBouw een duo kannon bij je basis.
tutorial.drillturret = Duo's hebben[accent] koperen ammonutie []nodig om te schieten.\nPlaatst een drill ernaast om het van koper te voorzien. tutorial.drillturret = Duo's hebben[accent] koperen ammunitie []nodig om te schieten.\nPlaats een drill ernaast om het van koper te voorzien.
tutorial.pause = Tijdens een gevecht is het mogelijk[accent] het spel te pauzeren.[]\nJe kan nog wel je gebouwen plannen dan.\n\n[accent]Pauzeer het spel (spatie) nu. tutorial.pause = Tijdens een gevecht is het mogelijk[accent] het spel te pauzeren.[]\nJe kan nog wel je gebouwen plannen.\n\n[accent]Pauzeer het spel (spatie) nu.
tutorial.pause.mobile = During battle, you are able to[accent] pause the game.[]\nYou may queue buildings while paused.\n\n[accent]Press this button in the top left to pause. tutorial.pause.mobile = During battle, you are able to[accent] pause the game.[]\nYou may queue buildings while paused.\n\n[accent]Press this button in the top left to pause.
tutorial.unpause = Doe het opnieuw om weer verder te gaan. tutorial.unpause = Doe het opnieuw om weer verder te gaan.
tutorial.unpause.mobile = Doe het opnieuw om weer verder te gaan. tutorial.unpause.mobile = Doe het opnieuw om weer verder te gaan.
@@ -1079,10 +1079,10 @@ tutorial.withdraw = In sommige situaties, is het nodig om items uit een blok te
tutorial.deposit = Je kan de items weer terugstoppen door van je schip het terug te slepen naar waar je het wilt.\n\n[accent]Stop het nu weer terug in de core.[] tutorial.deposit = Je kan de items weer terugstoppen door van je schip het terug te slepen naar waar je het wilt.\n\n[accent]Stop het nu weer terug in de core.[]
tutorial.waves = De[LIGHT_GRAY] vijand[] naderd.\n\nVerdedig je core voor 2 rondes. Bouw meer verdedigingen. tutorial.waves = De[LIGHT_GRAY] vijand[] naderd.\n\nVerdedig je core voor 2 rondes. Bouw meer verdedigingen.
tutorial.waves.mobile = De[LIGHT_GRAY] vijand[] naderd.\n\nVerdedig je core voor 2 rondes. Je schip schiet automatisch op vijanden.\nBouw meer verdedigingen, en mine meer koper. tutorial.waves.mobile = De[LIGHT_GRAY] vijand[] naderd.\n\nVerdedig je core voor 2 rondes. Je schip schiet automatisch op vijanden.\nBouw meer verdedigingen, en mine meer koper.
tutorial.launch = Tijdens sommige waves, kan je je core[accent] lanceren[], hiermee verlaat je de basis permanent[accent] maar je neemt wel alles dat in de core zit met je mee.[]\nVervolgens valt ermee te onderzoeken.\n\n[accent]Druk op de lanceer knop. tutorial.launch = Tijdens sommige waves, kan je je core[accent] lanceren[], hiermee verlaat je de basis permanent[accent] maar je neemt wel alles dat in de core zit met je mee.[]\nMet deze grondstoffen kan je nieuwe technologieën onderzoeken.\n\n[accent]Druk op de lanceerknop.
item.copper.description = A useful structure material. Used extensively in all types of blocks. item.copper.description = Een nuttig materiaal voor gebouwen. Wordt erg vaak in blokken gebruikt.
item.lead.description = A basic starter material. Used extensively in electronics and liquid transportation blocks. item.lead.description = Een basismateriaal. Wordt vaak gebruikt in elektronica en vloeistoftransport.
item.metaglass.description = A super-tough glass compound. Extensively used for liquid distribution and storage. item.metaglass.description = A super-tough glass compound. Extensively used for liquid distribution and storage.
item.graphite.description = Mineralized carbon, used for ammunition and electrical insulation. item.graphite.description = Mineralized carbon, used for ammunition and electrical insulation.
item.sand.description = A common material that is used extensively in smelting, both in alloying and as a flux. item.sand.description = A common material that is used extensively in smelting, both in alloying and as a flux.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 751 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 KiB

After

Width:  |  Height:  |  Size: 723 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 900 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 KiB

After

Width:  |  Height:  |  Size: 262 KiB

View File

@@ -19,46 +19,6 @@ import mindustry.world.Tile;
public class Call { public class Call {
private static final ByteBuffer TEMP_BUFFER = ByteBuffer.allocate(4096); private static final ByteBuffer TEMP_BUFFER = ByteBuffer.allocate(4096);
public static synchronized <T extends Posc & Itemsc> void transferItemEffect(Item item, float x,
float y, T to) {
if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) {
mindustry.input.InputHandler.transferItemEffect(item, x, y, to);
}
if(mindustry.Vars.net.server()) {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0;
packet.type = (byte)0;
TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item);
TEMP_BUFFER.putFloat(x);
TEMP_BUFFER.putFloat(y);
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, to);
packet.writeLength = TEMP_BUFFER.position();
mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp);
}
}
public static synchronized <T extends Posc & Itemsc> void transferItemToUnit(Item item, float x,
float y, T to) {
if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) {
mindustry.input.InputHandler.transferItemToUnit(item, x, y, to);
}
if(mindustry.Vars.net.server()) {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0;
packet.type = (byte)1;
TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item);
TEMP_BUFFER.putFloat(x);
TEMP_BUFFER.putFloat(y);
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, to);
packet.writeLength = TEMP_BUFFER.position();
mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp);
}
}
public static synchronized void beginBreak(Team team, int x, int y) { public static synchronized void beginBreak(Team team, int x, int y) {
if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) {
mindustry.world.Build.beginBreak(team, x, y); mindustry.world.Build.beginBreak(team, x, y);
@@ -67,7 +27,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)2; packet.type = (byte)0;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team);
TEMP_BUFFER.putInt(x); TEMP_BUFFER.putInt(x);
@@ -85,7 +45,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)3; packet.type = (byte)1;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team);
TEMP_BUFFER.putInt(x); TEMP_BUFFER.putInt(x);
@@ -102,7 +62,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)4; packet.type = (byte)2;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp);
@@ -118,7 +78,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)5; packet.type = (byte)3;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeBulletType(TEMP_BUFFER, type); mindustry.io.TypeIO.writeBulletType(TEMP_BUFFER, type);
mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team);
@@ -141,7 +101,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)6; packet.type = (byte)4;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putFloat(angle); TEMP_BUFFER.putFloat(angle);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -155,7 +115,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)7; packet.type = (byte)5;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp);
@@ -170,7 +130,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)8; packet.type = (byte)6;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, other); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, other);
mindustry.io.TypeIO.writeAction(TEMP_BUFFER, action); mindustry.io.TypeIO.writeAction(TEMP_BUFFER, action);
@@ -184,7 +144,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)2; packet.priority = (byte)2;
packet.type = (byte)9; packet.type = (byte)7;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putShort(amount); TEMP_BUFFER.putShort(amount);
TEMP_BUFFER.putShort(dataLen); TEMP_BUFFER.putShort(dataLen);
@@ -200,7 +160,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)2; packet.priority = (byte)2;
packet.type = (byte)9; packet.type = (byte)7;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putShort(amount); TEMP_BUFFER.putShort(amount);
TEMP_BUFFER.putShort(dataLen); TEMP_BUFFER.putShort(dataLen);
@@ -218,7 +178,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)10; packet.type = (byte)8;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putInt(snapshotID); TEMP_BUFFER.putInt(snapshotID);
TEMP_BUFFER.putFloat(x); TEMP_BUFFER.putFloat(x);
@@ -252,7 +212,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)11; packet.type = (byte)9;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, ip); mindustry.io.TypeIO.writeString(TEMP_BUFFER, ip);
TEMP_BUFFER.putInt(port); TEMP_BUFFER.putInt(port);
@@ -270,7 +230,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)12; packet.type = (byte)10;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block); mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block);
@@ -291,7 +251,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)13; packet.type = (byte)11;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block); mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block);
@@ -309,7 +269,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)14; packet.type = (byte)12;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
@@ -325,7 +285,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)2; packet.priority = (byte)2;
packet.type = (byte)15; packet.type = (byte)13;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putShort(amount); TEMP_BUFFER.putShort(amount);
TEMP_BUFFER.putShort(dataLen); TEMP_BUFFER.putShort(dataLen);
@@ -341,7 +301,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)16; packet.type = (byte)14;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, winner); mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, winner);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -354,7 +314,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)17; packet.type = (byte)15;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -367,7 +327,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)17; packet.type = (byte)15;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -381,7 +341,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)18; packet.type = (byte)16;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
TEMP_BUFFER.putFloat(duration); TEMP_BUFFER.putFloat(duration);
@@ -401,7 +361,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)18; packet.type = (byte)16;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
TEMP_BUFFER.putFloat(duration); TEMP_BUFFER.putFloat(duration);
@@ -420,7 +380,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)19; packet.type = (byte)17;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
TEMP_BUFFER.putFloat(duration); TEMP_BUFFER.putFloat(duration);
@@ -435,7 +395,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)19; packet.type = (byte)17;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
TEMP_BUFFER.putFloat(duration); TEMP_BUFFER.putFloat(duration);
@@ -449,7 +409,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)1; packet.priority = (byte)1;
packet.type = (byte)20; packet.type = (byte)18;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, reason); mindustry.io.TypeIO.writeString(TEMP_BUFFER, reason);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -463,7 +423,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)1; packet.priority = (byte)1;
packet.type = (byte)21; packet.type = (byte)19;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeKick(TEMP_BUFFER, reason); mindustry.io.TypeIO.writeKick(TEMP_BUFFER, reason);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -476,7 +436,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)22; packet.type = (byte)20;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, info); mindustry.io.TypeIO.writeString(TEMP_BUFFER, info);
TEMP_BUFFER.putFloat(duration); TEMP_BUFFER.putFloat(duration);
@@ -493,7 +453,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)22; packet.type = (byte)20;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, info); mindustry.io.TypeIO.writeString(TEMP_BUFFER, info);
TEMP_BUFFER.putFloat(duration); TEMP_BUFFER.putFloat(duration);
@@ -512,7 +472,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)23; packet.type = (byte)21;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -528,7 +488,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)24; packet.type = (byte)22;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -544,7 +504,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)25; packet.type = (byte)23;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putLong(time); TEMP_BUFFER.putLong(time);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -557,7 +517,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)26; packet.type = (byte)24;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putLong(time); TEMP_BUFFER.putLong(time);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -570,7 +530,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)27; packet.type = (byte)25;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putInt(playerid); TEMP_BUFFER.putInt(playerid);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -583,7 +543,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)28; packet.type = (byte)26;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putFloat(x); TEMP_BUFFER.putFloat(x);
TEMP_BUFFER.putFloat(y); TEMP_BUFFER.putFloat(y);
@@ -597,7 +557,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)29; packet.type = (byte)27;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeRules(TEMP_BUFFER, rules); mindustry.io.TypeIO.writeRules(TEMP_BUFFER, rules);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -610,7 +570,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)29; packet.type = (byte)27;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeRules(TEMP_BUFFER, rules); mindustry.io.TypeIO.writeRules(TEMP_BUFFER, rules);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -624,7 +584,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)2; packet.priority = (byte)2;
packet.type = (byte)30; packet.type = (byte)28;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putFloat(waveTime); TEMP_BUFFER.putFloat(waveTime);
TEMP_BUFFER.putInt(wave); TEMP_BUFFER.putInt(wave);
@@ -642,7 +602,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)31; packet.type = (byte)29;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -660,7 +620,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)31; packet.type = (byte)29;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -680,7 +640,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)32; packet.type = (byte)30;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
TEMP_BUFFER.putFloat(health); TEMP_BUFFER.putFloat(health);
@@ -697,7 +657,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)33; packet.type = (byte)31;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -713,7 +673,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)34; packet.type = (byte)32;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -730,7 +690,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)34; packet.type = (byte)32;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -747,7 +707,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)35; packet.type = (byte)33;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
mindustry.io.TypeIO.writeTraceInfo(TEMP_BUFFER, info); mindustry.io.TypeIO.writeTraceInfo(TEMP_BUFFER, info);
@@ -764,7 +724,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)36; packet.type = (byte)34;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
TEMP_BUFFER.putInt(spawns); TEMP_BUFFER.putInt(spawns);
@@ -781,7 +741,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)37; packet.type = (byte)35;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -795,7 +755,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)38; packet.type = (byte)36;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp);
@@ -807,7 +767,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)38; packet.type = (byte)36;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); playerConnection.send(packet, mindustry.net.Net.SendMode.tcp);
@@ -820,7 +780,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)39; packet.type = (byte)37;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
TEMP_BUFFER.putInt(x); TEMP_BUFFER.putInt(x);
TEMP_BUFFER.putInt(y); TEMP_BUFFER.putInt(y);
@@ -838,7 +798,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)40; packet.type = (byte)38;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -854,7 +814,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)41; packet.type = (byte)39;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -873,7 +833,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)41; packet.type = (byte)39;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -894,7 +854,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)42; packet.type = (byte)40;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -912,7 +872,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)42; packet.type = (byte)40;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -932,7 +892,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)43; packet.type = (byte)41;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -948,7 +908,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)44; packet.type = (byte)42;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
packet.writeLength = TEMP_BUFFER.position(); packet.writeLength = TEMP_BUFFER.position();
@@ -961,7 +921,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)45; packet.type = (byte)43;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, sender); mindustry.io.TypeIO.writeString(TEMP_BUFFER, sender);
@@ -977,7 +937,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)45; packet.type = (byte)43;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
mindustry.io.TypeIO.writeString(TEMP_BUFFER, sender); mindustry.io.TypeIO.writeString(TEMP_BUFFER, sender);
@@ -993,7 +953,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)46; packet.type = (byte)44;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -1011,7 +971,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)46; packet.type = (byte)44;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -1029,7 +989,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)47; packet.type = (byte)45;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -1046,7 +1006,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)47; packet.type = (byte)45;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -1065,7 +1025,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)48; packet.type = (byte)46;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block); mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block);
@@ -1084,7 +1044,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)49; packet.type = (byte)47;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -1101,7 +1061,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)49; packet.type = (byte)47;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
if(mindustry.Vars.net.server()) { if(mindustry.Vars.net.server()) {
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
@@ -1112,6 +1072,25 @@ public class Call {
} }
} }
public static synchronized void transferItemEffect(Item item, float x, float y, Itemsc to) {
if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) {
mindustry.input.InputHandler.transferItemEffect(item, x, y, to);
}
if(mindustry.Vars.net.server()) {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0;
packet.type = (byte)48;
TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item);
TEMP_BUFFER.putFloat(x);
TEMP_BUFFER.putFloat(y);
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, to);
packet.writeLength = TEMP_BUFFER.position();
mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp);
}
}
public static synchronized void transferItemTo(Item item, int amount, float x, float y, public static synchronized void transferItemTo(Item item, int amount, float x, float y,
Tile tile) { Tile tile) {
if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) {
@@ -1121,7 +1100,7 @@ public class Call {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER; packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0; packet.priority = (byte)0;
packet.type = (byte)50; packet.type = (byte)49;
TEMP_BUFFER.position(0); TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item); mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item);
TEMP_BUFFER.putInt(amount); TEMP_BUFFER.putInt(amount);
@@ -1132,4 +1111,23 @@ public class Call {
mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp);
} }
} }
public static synchronized void transferItemToUnit(Item item, float x, float y, Itemsc to) {
if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) {
mindustry.input.InputHandler.transferItemToUnit(item, x, y, to);
}
if(mindustry.Vars.net.server()) {
mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new);
packet.writeBuffer = TEMP_BUFFER;
packet.priority = (byte)0;
packet.type = (byte)50;
TEMP_BUFFER.position(0);
mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item);
TEMP_BUFFER.putFloat(x);
TEMP_BUFFER.putFloat(y);
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, to);
packet.writeLength = TEMP_BUFFER.position();
mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp);
}
}
} }

View File

@@ -383,7 +383,7 @@ public class Bullets implements ContentList{
}}; }};
damageLightning = new BulletType(0.0001f, 0f){{ damageLightning = new BulletType(0.0001f, 0f){{
lifetime = Lightning.lifetime; lifetime = Fx.lightning.lifetime;
hitEffect = Fx.hitLancer; hitEffect = Fx.hitLancer;
despawnEffect = Fx.none; despawnEffect = Fx.none;
status = StatusEffects.shocked; status = StatusEffects.shocked;
@@ -425,7 +425,8 @@ public class Bullets implements ContentList{
if(Mathf.chance(0.04 * Time.delta())){ if(Mathf.chance(0.04 * Time.delta())){
Tile tile = world.tileWorld(b.x(), b.y()); Tile tile = world.tileWorld(b.x(), b.y());
if(tile != null){ if(tile != null){
Fire.create(tile); //TODO implement
//Fire.create(tile);
} }
} }
@@ -520,7 +521,8 @@ public class Bullets implements ContentList{
public void hit(Bulletc b, float hitx, float hity){ public void hit(Bulletc b, float hitx, float hity){
hitEffect.at(hitx, hity, colors[2]); hitEffect.at(hitx, hity, colors[2]);
if(Mathf.chance(0.4)){ if(Mathf.chance(0.4)){
Fire.create(world.tileWorld(hitx + Mathf.range(5f), hity + Mathf.range(5f))); //TODO implement
// Fire.create(world.tileWorld(hitx + Mathf.range(5f), hity + Mathf.range(5f)));
} }
} }
@@ -639,7 +641,8 @@ public class Bullets implements ContentList{
for(int i = 0; i < 3; i++){ for(int i = 0; i < 3; i++){
Tile tile = world.tileWorld(x + Mathf.range(8f), y + Mathf.range(8f)); Tile tile = world.tileWorld(x + Mathf.range(8f), y + Mathf.range(8f));
Puddle.deposit(tile, Liquids.oil, 5f); //TODO implement
//Puddle.deposit(tile, Liquids.oil, 5f);
} }
} }
}; };

View File

@@ -34,7 +34,7 @@ public class Damage{
} }
for(int i = 0; i < Mathf.clamp(flammability / 4, 0, 30); i++){ for(int i = 0; i < Mathf.clamp(flammability / 4, 0, 30); i++){
Time.run(i / 2f, () -> Call.createBullet(Bullets.fireball, Team.derelict, x, y, Mathf.random(360f), 1, 1)); Time.run(i / 2f, () -> Call.createBullet(Bullets.fireball, Team.derelict, x, y, -1f, Mathf.random(360f), 1, 1));
} }
int waves = Mathf.clamp((int)(explosiveness / 4), 0, 30); int waves = Mathf.clamp((int)(explosiveness / 4), 0, 30);

View File

@@ -31,6 +31,10 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
} }
} }
public void sort(Comparator<? super T> comp){
array.sort(comp);
}
public void update(){ public void update(){
if(useTree()){ if(useTree()){

View File

@@ -51,6 +51,19 @@ public class Predict{
return sol; return sol;
} }
public static Vec2 intercept(Position src, Hitboxc dst, float v){
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), dst.deltaX(), dst.deltaY(), v);
}
public static Vec2 intercept(Position src, Position dst, float v){
float ddx = 0, ddy = 0;
if(dst instanceof Hitboxc){
ddx = ((Hitboxc)dst).deltaX();
ddy = ((Hitboxc)dst).deltaY();
}
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), ddx, ddy, v);
}
/** /**
* See {@link #intercept(float, float, float, float, float, float, float)}. * See {@link #intercept(float, float, float, float, float, float, float)}.
*/ */

View File

@@ -1,8 +0,0 @@
package mindustry.entities;
/**
* Marks an entity as serializable.
*/
public interface SaveTrait extends Saveable{
byte version();
}

View File

@@ -1,9 +0,0 @@
package mindustry.entities;
import java.io.*;
/** Marks something as saveable; not necessarily used for entities. */
public interface Saveable{
void writeSave(DataOutput stream) throws IOException;
void readSave(DataInput stream, byte version) throws IOException;
}

View File

@@ -30,7 +30,7 @@ public class Units{
* @return whether the target is invalid * @return whether the target is invalid
*/ */
public static boolean invalidateTarget(Teamc target, Team team, float x, float y, float range){ public static boolean invalidateTarget(Teamc target, Team team, float x, float y, float range){
return target == null || (range != Float.MAX_VALUE && !target.withinDst(x, y, range)) || target.team() == team || !target.isValid(); return target == null || (range != Float.MAX_VALUE && !target.withinDst(x, y, range)) || target.team() == team || (target instanceof Healthc && !((Healthc)target).isValid());
} }
/** See {@link #invalidateTarget(Teamc, Team, float, float, float)} */ /** See {@link #invalidateTarget(Teamc, Team, float, float, float)} */

View File

@@ -47,12 +47,13 @@ public class LiquidBulletType extends BulletType{
super.update(b); super.update(b);
if(liquid.canExtinguish()){ if(liquid.canExtinguish()){
//TODO implement
Tile tile = world.tileWorld(b.x(), b.y()); Tile tile = world.tileWorld(b.x(), b.y());
if(tile != null && Fire.has(tile.x, tile.y)){ //if(tile != null && Fire.has(tile.x, tile.y)){
Fire.extinguish(tile, 100f); //Fire.extinguish(tile, 100f);
b.remove(); // b.remove();
hit(b); // hit(b);
} //}
} }
} }
@@ -66,13 +67,14 @@ public class LiquidBulletType extends BulletType{
@Override @Override
public void hit(Bulletc b, float hitx, float hity){ public void hit(Bulletc b, float hitx, float hity){
hitEffect.at(hitx, hity, liquid.color); hitEffect.at(hitx, hity, liquid.color);
Puddle.deposit(world.tileWorld(hitx, hity), liquid, puddleSize); //TODO implement
// Puddle.deposit(world.tileWorld(hitx, hity), liquid, puddleSize);
if(liquid.temperature <= 0.5f && liquid.flammability < 0.3f){ if(liquid.temperature <= 0.5f && liquid.flammability < 0.3f){
float intensity = 400f; float intensity = 400f;
Fire.extinguish(world.tileWorld(hitx, hity), intensity); //Fire.extinguish(world.tileWorld(hitx, hity), intensity);
for(Point2 p : Geometry.d4){ for(Point2 p : Geometry.d4){
Fire.extinguish(world.tileWorld(hitx + p.x * tilesize, hity + p.y * tilesize), intensity); // Fire.extinguish(world.tileWorld(hitx + p.x * tilesize, hity + p.y * tilesize), intensity);
} }
} }
} }

View File

@@ -50,6 +50,11 @@ public class EntityComps{
private UnitController controller; private UnitController controller;
private UnitDef type; private UnitDef type;
@Override
public int itemCapacity(){
return type.itemCapacity;
}
@Override @Override
public float bounds(){ public float bounds(){
return hitSize() * 2f; return hitSize() * 2f;
@@ -288,7 +293,7 @@ public class EntityComps{
@Component @Component
abstract class TimerComp{ abstract class TimerComp{
@ReadOnly Interval timer = new Interval(6); Interval timer = new Interval(6);
public boolean timer(int index, float time){ public boolean timer(int index, float time){
return timer.get(index, time); return timer.get(index, time);
@@ -433,11 +438,11 @@ public class EntityComps{
} }
@Component @Component
class RotComp{ abstract class RotComp implements Entityc{
float rotation; float rotation;
void interpolate(){ void interpolate(){
Syncc sync = (Syncc)this; Syncc sync = as(Syncc.class);
if(sync.interpolator().values.length > 0){ if(sync.interpolator().values.length > 0){
rotation = sync.interpolator().values[0]; rotation = sync.interpolator().values[0];
@@ -446,7 +451,7 @@ public class EntityComps{
} }
@Component @Component
static abstract class TileComp implements Posc, Teamc, Healthc, Tilec{ static abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc{
static final float timeToSleep = 60f * 1; static final float timeToSleep = 60f * 1;
static final ObjectSet<Tile> tmpTiles = new ObjectSet<>(); static final ObjectSet<Tile> tmpTiles = new ObjectSet<>();
static int sleepingEntities = 0; static int sleepingEntities = 0;
@@ -460,7 +465,6 @@ public class EntityComps{
LiquidModule liquids; LiquidModule liquids;
ConsumeModule cons; ConsumeModule cons;
private Interval timer;
private float timeScale = 1f, timeScaleDuration; private float timeScale = 1f, timeScaleDuration;
private @Nullable SoundLoop sound; private @Nullable SoundLoop sound;
@@ -481,7 +485,7 @@ public class EntityComps{
health(block.health); health(block.health);
maxHealth(block.health); maxHealth(block.health);
timer = new Interval(block.timers); timer(new Interval(block.timers));
if(shouldAdd){ if(shouldAdd){
add(); add();
@@ -490,6 +494,12 @@ public class EntityComps{
return this; return this;
} }
@Override
public void applyBoost(float intensity, float duration){
timeScale = Math.max(timeScale, intensity);
timeScaleDuration = Math.max(timeScaleDuration, duration);
}
@Override @Override
public float timeScale(){ public float timeScale(){
return timeScale; return timeScale;
@@ -505,11 +515,6 @@ public class EntityComps{
cons.trigger(); cons.trigger();
} }
@Override
public boolean timer(int id, float time){
return timer.get(id, time);
}
/** Scaled delta. */ /** Scaled delta. */
@Override @Override
public float delta(){ public float delta(){
@@ -671,8 +676,10 @@ public class EntityComps{
} }
@Component @Component
abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{ abstract static class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
@Nullable Unitc unit; private static final Unitc noUnit = GenericUnitEntity.create();
@NonNull @ReadOnly Unitc unit = noUnit;
@ReadOnly Team team = Team.sharded; @ReadOnly Team team = Team.sharded;
String name = "noname"; String name = "noname";
@@ -698,7 +705,7 @@ public class EntityComps{
} }
public void update(){ public void update(){
if(unit != null){ if(!dead()){
x(unit.x()); x(unit.x());
y(unit.y()); y(unit.y());
unit.team(team); unit.team(team);
@@ -712,13 +719,29 @@ public class EntityComps{
} }
} }
public void clearUnit(){
unit(noUnit);
}
public Unitc unit(){
if(dead()){
//TODO remove
Log.err("WARNING: DEAD PLAYER UNIT ACCESSED");
new RuntimeException().printStackTrace();
}
return unit;
}
public void unit(Unitc unit){ public void unit(Unitc unit){
if(unit == null) throw new IllegalArgumentException("Unit cannot be null. Use clearUnit() instead.");
this.unit = unit; this.unit = unit;
unit.team(team); if(unit != noUnit){
unit.team(team);
}
} }
boolean dead(){ boolean dead(){
return unit == null; return unit == noUnit;
} }
String uuid(){ String uuid(){
@@ -1472,12 +1495,13 @@ public class EntityComps{
} }
@Component @Component
abstract class ItemsComp{ abstract class ItemsComp implements Posc{
@ReadOnly ItemStack stack = new ItemStack(); @ReadOnly ItemStack stack = new ItemStack();
abstract int itemCapacity(); abstract int itemCapacity();
void update(){ @Override
public void update(){
stack.amount = Mathf.clamp(stack.amount, 0, itemCapacity()); stack.amount = Mathf.clamp(stack.amount, 0, itemCapacity());
} }
@@ -1506,11 +1530,19 @@ public class EntityComps{
stack.item = item; stack.item = item;
stack.amount = Mathf.clamp(stack.amount, 0, itemCapacity()); stack.amount = Mathf.clamp(stack.amount, 0, itemCapacity());
} }
int maxAccepted(Item item){
return stack.item != item && stack.amount > 0 ? 0 : itemCapacity() - stack.amount;
}
} }
@Component @Component
abstract class MassComp implements Velc{ abstract class MassComp implements Velc{
float mass; float mass = 1f;
public void applyImpulse(float x, float y){
vel().add(x / mass, y / mass);
}
} }
@Component @Component

View File

@@ -19,4 +19,7 @@ class EntityDefs{
@EntityDef({PlayerComp.class}) @EntityDef({PlayerComp.class})
class PlayerDef{} class PlayerDef{}
@EntityDef({UnitComp.class})
class GenericUnitDef{}
} }

View File

@@ -6,4 +6,8 @@ import mindustry.gen.*;
public interface UnitController{ public interface UnitController{
void unit(Unitc unit); void unit(Unitc unit);
Unitc unit(); Unitc unit();
default void command(UnitCommand command){
}
} }

View File

@@ -67,13 +67,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
//methods to override //methods to override
@Remote(called = Loc.server, unreliable = true) @Remote(called = Loc.server, unreliable = true)
public static <T extends Posc & Itemsc> void transferItemEffect(Item item, float x, float y, T to){ public static void transferItemEffect(Item item, float x, float y, Itemsc to){
if(to == null) return; if(to == null) return;
createItemTransfer(item, x, y, to, null); createItemTransfer(item, x, y, to, null);
} }
@Remote(called = Loc.server, unreliable = true) @Remote(called = Loc.server, unreliable = true)
public static <T extends Posc & Itemsc> void transferItemToUnit(Item item, float x, float y, T to){ public static void transferItemToUnit(Item item, float x, float y, Itemsc to){
if(to == null) return; if(to == null) return;
createItemTransfer(item, x, y, to, () -> to.addItem(item)); createItemTransfer(item, x, y, to, () -> to.addItem(item));
} }

View File

@@ -97,7 +97,7 @@ public class Placement{
int nodeLimit = 1000; int nodeLimit = 1000;
int totalNodes = 0; int totalNodes = 0;
PriorityQueue<Tile> queue = new PriorityQueue<>(10, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + distanceHeuristic(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + distanceHeuristic(b.x(), b.y(), end.x, end.y))); PriorityQueue<Tile> queue = new PriorityQueue<>(10, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + distanceHeuristic(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + distanceHeuristic(b.x, b.y, end.x, end.y)));
queue.add(start); queue.add(start);
boolean found = false; boolean found = false;
while(!queue.isEmpty() && totalNodes++ < nodeLimit){ while(!queue.isEmpty() && totalNodes++ < nodeLimit){

View File

@@ -6,12 +6,10 @@ import arc.util.io.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.core.*; import mindustry.core.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.ctype.ContentType;
import mindustry.entities.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.game.Teams.*; import mindustry.game.Teams.*;
import mindustry.gen.*;
import mindustry.maps.*; import mindustry.maps.*;
import mindustry.type.*;
import mindustry.world.*; import mindustry.world.*;
import java.io.*; import java.io.*;
@@ -188,10 +186,7 @@ public abstract class SaveVersion extends SaveFileReader{
if(tile.entity != null){ if(tile.entity != null){
try{ try{
readChunk(stream, true, in -> { readChunk(stream, true, in -> tile.entity.read(in));
byte version = in.readByte();
tile.entity.read(in, version);
});
}catch(Exception e){ }catch(Exception e){
throw new IOException("Failed to read tile entity of block: " + block, e); throw new IOException("Failed to read tile entity of block: " + block, e);
} }
@@ -227,30 +222,12 @@ public abstract class SaveVersion extends SaveFileReader{
} }
} }
//write entity chunk stream.writeInt(Groups.sync.size());
int groups = 0; for(Syncc entity : Groups.sync){
writeChunk(stream, true, out -> {
for(EntityGroup<?> group : entities.all()){ out.writeByte(entity.classId());
if(!group.isEmpty() && group.all().get(0) instanceof SaveTrait){ entity.write(out);
groups++; });
}
}
stream.writeByte(groups);
for(EntityGroup<?> group : entities.all()){
if(!group.isEmpty() && group.all().get(0) instanceof SaveTrait){
stream.writeInt(group.size());
for(Entity entity : group.all()){
SaveTrait save = (SaveTrait)entity;
//each entity is a separate chunk.
writeChunk(stream, true, out -> {
out.writeByte(save.getTypeID().id);
out.writeByte(save.version());
save.writeSave(out);
});
}
}
} }
} }
@@ -265,19 +242,14 @@ public abstract class SaveVersion extends SaveFileReader{
} }
} }
byte groups = stream.readByte();
for(int i = 0; i < groups; i++){ int amount = stream.readInt();
int amount = stream.readInt(); for(int j = 0; j < amount; j++){
for(int j = 0; j < amount; j++){ readChunk(stream, true, in -> {
//TODO throw exception on read fail byte typeid = in.readByte();
readChunk(stream, true, in -> { Syncc sync = (Syncc)ClassMapping.map(typeid).get();
byte typeid = in.readByte(); sync.read(in);
byte version = in.readByte(); });
SaveTrait trait = (SaveTrait)content.<TypeID>getByID(ContentType.typeid, typeid).constructor.get();
trait.readSave(in, version);
});
}
} }
} }

View File

@@ -1,8 +1,5 @@
package mindustry.io.versions; package mindustry.io.versions;
import arc.func.*;
import mindustry.entities.*;
import java.io.*; import java.io.*;
public class Save1 extends Save2{ public class Save1 extends Save2{
@@ -13,7 +10,8 @@ public class Save1 extends Save2{
@Override @Override
public void readEntities(DataInput stream) throws IOException{ public void readEntities(DataInput stream) throws IOException{
Prov[] table = LegacyTypeTable.getTable(lastReadBuild); //TODO implement
//Prov[] table = LegacyTypeTable.getTable(lastReadBuild);
byte groups = stream.readByte(); byte groups = stream.readByte();
@@ -23,8 +21,8 @@ public class Save1 extends Save2{
readChunk(stream, true, in -> { readChunk(stream, true, in -> {
byte typeid = in.readByte(); byte typeid = in.readByte();
byte version = in.readByte(); byte version = in.readByte();
SaveTrait trait = (SaveTrait)table[typeid].get(); //SaveTrait trait = (SaveTrait)table[typeid].get();
trait.readSave(in, version); //trait.readSave(in, version);
}); });
} }
} }

View File

@@ -1,13 +1,9 @@
package mindustry.io.versions; package mindustry.io.versions;
import mindustry.ctype.ContentType;
import mindustry.entities.*;
import mindustry.io.*; import mindustry.io.*;
import java.io.*; import java.io.*;
import static mindustry.Vars.content;
public class Save2 extends SaveVersion{ public class Save2 extends SaveVersion{
public Save2(){ public Save2(){
@@ -16,6 +12,7 @@ public class Save2 extends SaveVersion{
@Override @Override
public void readEntities(DataInput stream) throws IOException{ public void readEntities(DataInput stream) throws IOException{
//TODO implement
byte groups = stream.readByte(); byte groups = stream.readByte();
for(int i = 0; i < groups; i++){ for(int i = 0; i < groups; i++){
@@ -25,8 +22,8 @@ public class Save2 extends SaveVersion{
readChunk(stream, true, in -> { readChunk(stream, true, in -> {
byte typeid = in.readByte(); byte typeid = in.readByte();
byte version = in.readByte(); byte version = in.readByte();
SaveTrait trait = (SaveTrait)content.<TypeID>getByID(ContentType.typeid, typeid).constructor.get(); //SaveTrait trait = (SaveTrait)content.<TypeID>getByID(ContentType.typeid, typeid).constructor.get();
trait.readSave(in, version); //trait.readSave(in, version);
}); });
} }
} }

View File

@@ -21,7 +21,7 @@ public class RandomItemFilter extends GenerateFilter{
if(tile.block() instanceof StorageBlock && !(tile.block() instanceof CoreBlock)){ if(tile.block() instanceof StorageBlock && !(tile.block() instanceof CoreBlock)){
for(ItemStack stack : drops){ for(ItemStack stack : drops){
if(Mathf.chance(chance)){ if(Mathf.chance(chance)){
tile.entity.items.add(stack.item, Math.min(Mathf.random(stack.amount), tile.block().itemCapacity)); tile.entity.items().add(stack.item, Math.min(Mathf.random(stack.amount), tile.block().itemCapacity));
} }
} }
} }

View File

@@ -182,7 +182,7 @@ public abstract class BasicGenerator extends RandomGenerator{
Tile end = tiles.getn(endX, endY); Tile end = tiles.getn(endX, endY);
GridBits closed = new GridBits(width, height); GridBits closed = new GridBits(width, height);
IntFloatMap costs = new IntFloatMap(); IntFloatMap costs = new IntFloatMap();
PriorityQueue<Tile> queue = new PriorityQueue<>(tiles.width() * tiles.height()/4, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + dh.cost(b.x(), b.y(), end.x, end.y))); PriorityQueue<Tile> queue = new PriorityQueue<>(tiles.width() * tiles.height()/4, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + dh.cost(b.x, b.y, end.x, end.y)));
queue.add(start); queue.add(start);
boolean found = false; boolean found = false;
while(!queue.isEmpty()){ while(!queue.isEmpty()){

View File

@@ -4,11 +4,11 @@ import arc.*;
import arc.assets.*; import arc.assets.*;
import arc.audio.*; import arc.audio.*;
import arc.audio.mock.*; import arc.audio.mock.*;
import arc.struct.Array;
import arc.struct.*;
import arc.files.*; import arc.files.*;
import arc.func.*; import arc.func.*;
import arc.graphics.*; import arc.graphics.*;
import arc.struct.Array;
import arc.struct.*;
import arc.util.ArcAnnotate.*; import arc.util.ArcAnnotate.*;
import arc.util.*; import arc.util.*;
import arc.util.serialization.*; import arc.util.serialization.*;
@@ -18,9 +18,8 @@ import mindustry.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.content.TechTree.*; import mindustry.content.TechTree.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.entities.Effects.*; import mindustry.entities.*;
import mindustry.entities.bullet.*; import mindustry.entities.bullet.*;
import mindustry.gen.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.game.Objectives.*; import mindustry.game.Objectives.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -275,13 +274,14 @@ public class ContentParser{
return block; return block;
}, },
ContentType.unit, (TypeParser<UnitType>)(mod, name, value) -> { ContentType.unit, (TypeParser<UnitDef>)(mod, name, value) -> {
readBundle(ContentType.unit, name, value); readBundle(ContentType.unit, name, value);
UnitType unit; //TODO fix
UnitDef unit;
if(locate(ContentType.unit, name) == null){ if(locate(ContentType.unit, name) == null){
Class<Unitc> type = resolve(legacyUnitMap.get(Strings.capitalize(getType(value)), getType(value)), "mindustry.entities.type.base"); Class<Unitc> type = resolve(legacyUnitMap.get(Strings.capitalize(getType(value)), getType(value)), "mindustry.entities.type.base");
unit = new UnitDef(mod + "-" + name, supply(type)); unit = new UnitDef(mod + "-" + name);
}else{ }else{
unit = locate(ContentType.unit, name); unit = locate(ContentType.unit, name);
} }
@@ -293,7 +293,6 @@ public class ContentParser{
}, },
ContentType.item, parser(ContentType.item, Item::new), ContentType.item, parser(ContentType.item, Item::new),
ContentType.liquid, parser(ContentType.liquid, Liquid::new), ContentType.liquid, parser(ContentType.liquid, Liquid::new),
ContentType.mech, parser(ContentType.mech, Mech::new),
ContentType.zone, parser(ContentType.zone, Zone::new) ContentType.zone, parser(ContentType.zone, Zone::new)
); );

View File

@@ -12,6 +12,7 @@ import arc.util.serialization.JsonValue.*;
import arc.util.serialization.JsonWriter.*; import arc.util.serialization.JsonWriter.*;
import mindustry.*; import mindustry.*;
import mindustry.core.*; import mindustry.core.*;
import mindustry.gen.*;
import java.io.*; import java.io.*;
import java.text.*; import java.text.*;

View File

@@ -25,7 +25,7 @@ public class NetworkIO{
stream.writeInt(state.wave); stream.writeInt(state.wave);
stream.writeFloat(state.wavetime); stream.writeFloat(state.wavetime);
stream.writeInt(player.id); stream.writeInt(player.id());
player.write(stream); player.write(stream);
SaveIO.getSaveWriter().writeContentHeader(stream); SaveIO.getSaveWriter().writeContentHeader(stream);
@@ -45,11 +45,11 @@ public class NetworkIO{
state.wave = stream.readInt(); state.wave = stream.readInt();
state.wavetime = stream.readFloat(); state.wavetime = stream.readFloat();
entities.clear(); Groups.all.clear();
int id = stream.readInt(); int id = stream.readInt();
player.resetNoAdd(); player.reset();
player.read(stream); player.read(stream);
player.resetID(id); player.id(id);
player.add(); player.add();
SaveIO.getSaveWriter().readContentHeader(stream); SaveIO.getSaveWriter().readContentHeader(stream);

View File

@@ -53,9 +53,9 @@ public class ItemsDisplay extends Table{
private String format(Item item){ private String format(Item item){
builder.setLength(0); builder.setLength(0);
builder.append(ui.formatAmount(data.items().get(item, 0))); builder.append(ui.formatAmount(data.items().get(item, 0)));
if(!state.is(State.menu) && player.team().data().hasCore() && player.team().core().items.get(item) > 0){ if(!state.is(State.menu) && player.team().data().hasCore() && player.team().core().items().get(item) > 0){
builder.append(" [unlaunched]+ "); builder.append(" [unlaunched]+ ");
builder.append(ui.formatAmount(state.teams.get(player.team()).core().items.get(item))); builder.append(ui.formatAmount(state.teams.get(player.team()).core().items().get(item)));
} }
return builder.toString(); return builder.toString();
} }

View File

@@ -41,9 +41,9 @@ public class AdminsDialog extends FloatingDialog{
res.addImageButton(Icon.cancel, () -> { res.addImageButton(Icon.cancel, () -> {
ui.showConfirm("$confirm", "$confirmunadmin", () -> { ui.showConfirm("$confirm", "$confirmunadmin", () -> {
netServer.admins.unAdminPlayer(info.id); netServer.admins.unAdminPlayer(info.id);
Groups.player.all().each(player -> { Groups.player.each(player -> {
if(player != null && player.uuid != null && player.uuid.equals(info.id)){ if(player != null && !player.isLocal() && player.uuid().equals(info.id)){
player.isAdmin = false; player.admin(false);
} }
}); });
setup(); setup();

View File

@@ -122,7 +122,7 @@ public class DeployDialog extends FloatingDialog{
setFilter(TextureFilter.Linear); setFilter(TextureFilter.Linear);
}}){{ }}){{
float[] time = {0}; float[] time = {0};
setColor(Color.gray(0.3f)); setColor(Color.grays(0.3f));
setScale(1.5f); setScale(1.5f);
update(() -> { update(() -> {
setOrigin(Align.center); setOrigin(Align.center);
@@ -140,7 +140,7 @@ public class DeployDialog extends FloatingDialog{
Stack sub = new Stack(); Stack sub = new Stack();
if(slot.getZone() != null){ if(slot.getZone() != null){
sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.gray(0.1f)).grow())); sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.grays(0.1f)).grow()));
//sub.add(new Table(f -> f.margin(4f).add(new Image(slot.getZone().preview).setScaling(Scaling.fit)).update(img -> { //sub.add(new Table(f -> f.margin(4f).add(new Image(slot.getZone().preview).setScaling(Scaling.fit)).update(img -> {
//TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable(); //TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable();

View File

@@ -24,7 +24,7 @@ public class HostDialog extends FloatingDialog{
cont.table(t -> { cont.table(t -> {
t.add("$name").padRight(10); t.add("$name").padRight(10);
t.addField(Core.settings.getString("name"), text -> { t.addField(Core.settings.getString("name"), text -> {
player.name = text; player.name(text);
Core.settings.put("name", text); Core.settings.put("name", text);
Core.settings.save(); Core.settings.save();
ui.listfrag.rebuild(); ui.listfrag.rebuild();
@@ -32,12 +32,12 @@ public class HostDialog extends FloatingDialog{
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> { ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
new PaletteDialog().show(color -> { new PaletteDialog().show(color -> {
player.color.set(color); player.color().set(color);
Core.settings.put("color-0", Color.rgba8888(color)); Core.settings.put("color-0", Color.rgba8888(color));
Core.settings.save(); Core.settings.save();
}); });
}).size(54f).get(); }).size(54f).get();
button.update(() -> button.getStyle().imageUpColor = player.color); button.update(() -> button.getStyle().imageUpColor = player.color());
}).width(w).height(70f).pad(4).colspan(3); }).width(w).height(70f).pad(4).colspan(3);
cont.row(); cont.row();
@@ -67,7 +67,7 @@ public class HostDialog extends FloatingDialog{
Time.runTask(5f, () -> { Time.runTask(5f, () -> {
try{ try{
net.host(Vars.port); net.host(Vars.port);
player.isAdmin = true; player.admin(true);
if(steam){ if(steam){
Core.app.post(() -> Core.settings.getBoolOnce("steampublic2", () -> { Core.app.post(() -> Core.settings.getBoolOnce("steampublic2", () -> {

View File

@@ -248,22 +248,22 @@ public class JoinDialog extends FloatingDialog{
t.add("$name").padRight(10); t.add("$name").padRight(10);
if(!steam){ if(!steam){
t.addField(Core.settings.getString("name"), text -> { t.addField(Core.settings.getString("name"), text -> {
player.name = text; player.name(text);
Core.settings.put("name", text); Core.settings.put("name", text);
Core.settings.save(); Core.settings.save();
}).grow().pad(8).get().setMaxLength(maxNameLength); }).grow().pad(8).get().setMaxLength(maxNameLength);
}else{ }else{
t.add(player.name()).update(l -> l.setColor(player.color)).grow().pad(8); t.add(player.name()).update(l -> l.setColor(player.color())).grow().pad(8);
} }
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> { ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
new PaletteDialog().show(color -> { new PaletteDialog().show(color -> {
player.color.set(color); player.color().set(color);
Core.settings.put("color-0", Color.rgba8888(color)); Core.settings.put("color-0", Color.rgba8888(color));
Core.settings.save(); Core.settings.save();
}); });
}).size(54f).get(); }).size(54f).get();
button.update(() -> button.getStyle().imageUpColor = player.color); button.update(() -> button.getStyle().imageUpColor = player.color());
}).width(w).height(70f).pad(4); }).width(w).height(70f).pad(4);
cont.row(); cont.row();
cont.add(pane).width(w + 38).pad(0); cont.add(pane).width(w + 38).pad(0);
@@ -335,7 +335,7 @@ public class JoinDialog extends FloatingDialog{
} }
public void connect(String ip, int port){ public void connect(String ip, int port){
if(player.name.trim().isEmpty()){ if(player.name().trim().isEmpty()){
ui.showInfo("$noname"); ui.showInfo("$noname");
return; return;
} }

View File

@@ -29,7 +29,7 @@ public class PaletteDialog extends Dialog{
cons.get(color); cons.get(color);
hide(); hide();
}).size(48).get(); }).size(48).get();
button.setChecked(player.color.equals(color)); button.setChecked(player.color().equals(color));
button.getStyle().imageUpColor = color; button.getStyle().imageUpColor = color;
if(i % 4 == 3){ if(i % 4 == 3){

View File

@@ -16,7 +16,6 @@ import arc.util.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.core.GameState.*; import mindustry.core.GameState.*;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.net.Administration.*; import mindustry.net.Administration.*;
@@ -39,7 +38,7 @@ public class BlockInventoryFragment extends Fragment{
@Remote(called = Loc.server, targets = Loc.both, forward = true) @Remote(called = Loc.server, targets = Loc.both, forward = true)
public static void requestItem(Playerc player, Tile tile, Item item, int amount){ public static void requestItem(Playerc player, Tile tile, Item item, int amount){
if(player == null || tile == null || !tile.interactable(player.team())) return; if(player == null || tile == null || !tile.interactable(player.team())) return;
amount = Mathf.clamp(amount, 0, player.ttemCapacity()); amount = Mathf.clamp(amount, 0, player.unit().itemCapacity());
int fa = amount; int fa = amount;
if(net.server() && (!Units.canInteract(player, tile) || if(net.server() && (!Units.canInteract(player, tile) ||
@@ -50,10 +49,10 @@ public class BlockInventoryFragment extends Fragment{
int removed = tile.block().removeStack(tile, item, amount); int removed = tile.block().removeStack(tile, item, amount);
player.addItem(item, removed); player.unit().addItem(item, removed);
Events.fire(new WithdrawEvent(tile, player, item, amount)); Events.fire(new WithdrawEvent(tile, player, item, amount));
for(int j = 0; j < Mathf.clamp(removed / 3, 1, 8); j++){ for(int j = 0; j < Mathf.clamp(removed / 3, 1, 8); j++){
Time.run(j * 3f, () -> Call.transferItemEffect(item, tile.drawx(), tile.drawy(), player)); Time.run(j * 3f, () -> Call.transferItemEffect(item, tile.drawx(), tile.drawy(), player.unit()));
} }
} }
@@ -105,7 +104,7 @@ public class BlockInventoryFragment extends Fragment{
holdTime += Time.delta(); holdTime += Time.delta();
if(holdTime >= holdWithdraw){ if(holdTime >= holdWithdraw){
int amount = Math.min(tile.entity.items().get(lastItem), player.maxAccepted(lastItem)); int amount = Math.min(tile.entity.items().get(lastItem), player.unit().maxAccepted(lastItem));
Call.requestItem(player, tile, lastItem, amount); Call.requestItem(player, tile, lastItem, amount);
holding = false; holding = false;
holdTime = 0f; holdTime = 0f;
@@ -140,7 +139,7 @@ public class BlockInventoryFragment extends Fragment{
container.add(i); container.add(i);
Boolp canPick = () -> player.acceptsItem(item) && !state.isPaused(); Boolp canPick = () -> player.unit().acceptsItem(item) && !state.isPaused();
HandCursorListener l = new HandCursorListener(); HandCursorListener l = new HandCursorListener();
l.setEnabled(canPick); l.setEnabled(canPick);
@@ -157,7 +156,7 @@ public class BlockInventoryFragment extends Fragment{
@Override @Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){ public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
if(!canPick.get() || tile == null || tile.entity == null || tile.entity.items() == null || !tile.entity.items().has(item)) return false; if(!canPick.get() || tile == null || tile.entity == null || tile.entity.items() == null || !tile.entity.items().has(item)) return false;
int amount = Math.min(1, player.maxAccepted(item)); int amount = Math.min(1, player.unit().maxAccepted(item));
if(amount > 0){ if(amount > 0){
Call.requestItem(player, tile, item, amount); Call.requestItem(player, tile, item, amount);
lastItem = item; lastItem = item;

View File

@@ -65,11 +65,11 @@ public class PlayerListFragment extends Fragment{
float h = 74f; float h = 74f;
Groups.player.all().sort(Structs.comparing(Unitc::team)); Groups.player.sort(Structs.comparing(Playerc::team));
Groups.player.all().each(user -> { Groups.player.each(user -> {
NetConnection connection = user.con; NetConnection connection = user.con();
if(connection == null && net.server() && !user.isLocal) return; if(connection == null && net.server() && !user.isLocal()) return;
Table button = new Table(); Table button = new Table();
button.left(); button.left();
@@ -87,15 +87,16 @@ public class PlayerListFragment extends Fragment{
} }
}; };
table.margin(8); table.margin(8);
table.add(new Image(user.getIconRegion()).setScaling(Scaling.none)).grow(); //TODO dead players should have no region
table.add(new Image(user.unit().type().region).setScaling(Scaling.none)).grow();
button.add(table).size(h); button.add(table).size(h);
button.labelWrap("[#" + user.color.toString().toUpperCase() + "]" + user.name).width(170f).pad(10); button.labelWrap("[#" + user.color().toString().toUpperCase() + "]" + user.name()).width(170f).pad(10);
button.add().grow(); button.add().grow();
button.addImage(Icon.admin).visible(() -> user.isAdmin && !(!user.isLocal && net.server())).padRight(5).get().updateVisibility(); button.addImage(Icon.admin).visible(() -> user.admin() && !(!user.isLocal() && net.server())).padRight(5).get().updateVisibility();
if((net.server() || player.isAdmin) && !user.isLocal && (!user.isAdmin || net.server())){ if((net.server() || player.admin()) && !user.isLocal() && (!user.admin() || net.server())){
button.add().growY(); button.add().growY();
float bs = (h) / 2f; float bs = (h) / 2f;
@@ -113,27 +114,27 @@ public class PlayerListFragment extends Fragment{
t.addImageButton(Icon.admin, Styles.clearTogglePartiali, () -> { t.addImageButton(Icon.admin, Styles.clearTogglePartiali, () -> {
if(net.client()) return; if(net.client()) return;
String id = user.uuid; String id = user.uuid();
if(netServer.admins.isAdmin(id, connection.address)){ if(netServer.admins.isAdmin(id, connection.address)){
ui.showConfirm("$confirm", "$confirmunadmin", () -> netServer.admins.unAdminPlayer(id)); ui.showConfirm("$confirm", "$confirmunadmin", () -> netServer.admins.unAdminPlayer(id));
}else{ }else{
ui.showConfirm("$confirm", "$confirmadmin", () -> netServer.admins.adminPlayer(id, user.usid)); ui.showConfirm("$confirm", "$confirmadmin", () -> netServer.admins.adminPlayer(id, user.usid()));
} }
}) })
.update(b -> b.setChecked(user.isAdmin)) .update(b -> b.setChecked(user.admin()))
.disabled(b -> net.client()) .disabled(b -> net.client())
.touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled) .touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled)
.checked(user.isAdmin); .checked(user.admin());
t.addImageButton(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace)); t.addImageButton(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace));
}).padRight(12).size(bs + 10f, bs); }).padRight(12).size(bs + 10f, bs);
}else if(!user.isLocal && !user.isAdmin && net.client() && Groups.player.size() >= 3 && player.team() == user.team()){ //votekick }else if(!user.isLocal() && !user.admin() && net.client() && Groups.player.size() >= 3 && player.team() == user.team()){ //votekick
button.add().growY(); button.add().growY();
button.addImageButton(Icon.hammer, Styles.clearPartiali, button.addImageButton(Icon.hammer, Styles.clearPartiali,
() -> ui.showConfirm("$confirm", "$confirmvotekick", () -> Call.sendChatMessage("/votekick " + user.name))).size(h); () -> ui.showConfirm("$confirm", "$confirmvotekick", () -> Call.sendChatMessage("/votekick " + user.name()))).size(h);
} }
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14); content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);

View File

@@ -38,7 +38,7 @@ public class Build{
tile.set(sub, team, rotation); tile.set(sub, team, rotation);
tile.<BuildEntity>ent().setDeconstruct(previous); tile.<BuildEntity>ent().setDeconstruct(previous);
tile.entity.health = tile.entity.maxHealth() * prevPercent; tile.entity.health(tile.entity.maxHealth() * prevPercent);
Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, true))); Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, true)));
} }
@@ -78,7 +78,7 @@ public class Build{
return false; return false;
} }
if(state.teams.eachEnemyCore(team, core -> Mathf.dst(x * tilesize + type.offset(), y * tilesize + type.offset(), core.x, core.y) < state.rules.enemyCoreBuildRadius + type.size * tilesize / 2f)){ if(state.teams.eachEnemyCore(team, core -> Mathf.dst(x * tilesize + type.offset(), y * tilesize + type.offset(), core.x(), core.y()) < state.rules.enemyCoreBuildRadius + type.size * tilesize / 2f)){
return false; return false;
} }

View File

@@ -33,12 +33,12 @@ public class CachedTile extends Tile{
if(block.hasEntity()){ if(block.hasEntity()){
Tilec n = block.newEntity(); Tilec n = block.newEntity();
n.cons = new ConsumeModule(entity); n.cons(new ConsumeModule(entity));
n.tile = this; n.tile(this);
n.block = block; n.block(block);
if(block.hasItems) n.items = new ItemModule(); if(block.hasItems) n.items(new ItemModule());
if(block.hasLiquids) n.liquids = new LiquidModule(); if(block.hasLiquids) n.liquids(new LiquidModule());
if(block.hasPower) n.power = new PowerModule(); if(block.hasPower) n.power(new PowerModule());
entity = n; entity = n;
} }
} }

View File

@@ -1,19 +1,17 @@
package mindustry.world.blocks; package mindustry.world.blocks;
import arc.*; import arc.*;
import mindustry.annotations.Annotations.*;
import arc.Graphics.*; import arc.Graphics.*;
import arc.Graphics.Cursor.*; import arc.Graphics.Cursor.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.util.ArcAnnotate.*; import arc.util.ArcAnnotate.*;
import arc.util.*; import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.gen.*;
import mindustry.gen.*;
import mindustry.entities.units.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
@@ -66,10 +64,10 @@ public class BuildBlock extends Block{
float healthf = tile.entity == null ? 1f : tile.entity.healthf(); float healthf = tile.entity == null ? 1f : tile.entity.healthf();
tile.set(block, team, rotation); tile.set(block, team, rotation);
if(tile.entity != null){ if(tile.entity != null){
tile.entity.health = block.health * healthf; tile.entity.health(block.health * healthf);
} }
//last builder was this local client player, call placed() //last builder was this local client player, call placed()
if(!headless && builderID == player.id){ if(!headless && builderID == player.id()){
if(!skipConfig){ if(!skipConfig){
tile.block().playerPlaced(tile); tile.block().playerPlaced(tile);
} }
@@ -141,6 +139,8 @@ public class BuildBlock extends Block{
public void tapped(Tile tile, Playerc player){ public void tapped(Tile tile, Playerc player){
BuildEntity entity = tile.ent(); BuildEntity entity = tile.ent();
//TODO building
/*
//if the target is constructible, begin constructing //if the target is constructible, begin constructing
if(entity.cblock != null){ if(entity.cblock != null){
if(player.buildWasAutoPaused && !player.isBuilding){ if(player.buildWasAutoPaused && !player.isBuilding){
@@ -148,7 +148,7 @@ public class BuildBlock extends Block{
} }
//player.clearBuilding(); //player.clearBuilding();
player.addBuildRequest(new BuildRequest(tile.x, tile.y, tile.rotation(), entity.cblock), false); player.addBuildRequest(new BuildRequest(tile.x, tile.y, tile.rotation(), entity.cblock), false);
} }*/
} }
@Override @Override
@@ -156,7 +156,8 @@ public class BuildBlock extends Block{
Fx.blockExplosionSmoke.at(tile); Fx.blockExplosionSmoke.at(tile);
if(!tile.floor().solid && !tile.floor().isLiquid){ if(!tile.floor().solid && !tile.floor().isLiquid){
RubbleDecal.create(tile.drawx(), tile.drawy(), size); //TODO implement
// RubbleDecal.create(tile.drawx(), tile.drawy(), size);
} }
} }
@@ -237,7 +238,7 @@ public class BuildBlock extends Block{
maxProgress = core == null ? maxProgress : checkRequired(core.items(), maxProgress, true); maxProgress = core == null ? maxProgress : checkRequired(core.items(), maxProgress, true);
progress = Mathf.clamp(progress + maxProgress); progress = Mathf.clamp(progress + maxProgress);
builderID = builder.getId(); builderID = builder.id();
if(progress >= 1f || state.rules.infiniteResources){ if(progress >= 1f || state.rules.infiniteResources){
constructed(tile, cblock, builderID, tile.rotation(), builder.team(), configured); constructed(tile, cblock, builderID, tile.rotation(), builder.team(), configured);
@@ -267,8 +268,8 @@ public class BuildBlock extends Block{
if(clampedAmount > 0 && accumulated > 0){ //if it's positive, add it to the core if(clampedAmount > 0 && accumulated > 0){ //if it's positive, add it to the core
if(core != null){ if(core != null){
int accepting = core.tile.block().acceptStack(requirements[i].item, accumulated, core.tile, builder); int accepting = core.tile().block().acceptStack(requirements[i].item, accumulated, core.tile(), builder);
core.tile.block().handleStack(requirements[i].item, accepting, core.tile, builder); core.tile().block().handleStack(requirements[i].item, accepting, core.tile(), builder);
accumulator[i] -= accepting; accumulator[i] -= accepting;
}else{ }else{
accumulator[i] -= accumulated; accumulator[i] -= accumulated;
@@ -280,7 +281,7 @@ public class BuildBlock extends Block{
progress = Mathf.clamp(progress - amount); progress = Mathf.clamp(progress - amount);
if(builder instanceof Playerc){ if(builder instanceof Playerc){
builderID = builder.getID(); builderID = builder.id();
} }
if(progress <= 0 || state.rules.infiniteResources){ if(progress <= 0 || state.rules.infiniteResources){

View File

@@ -89,7 +89,7 @@ public class OverdriveProjector extends Block{
float realBoost = (speedBoost + entity.phaseHeat * speedBoostPhase) * entity.efficiency(); float realBoost = (speedBoost + entity.phaseHeat * speedBoostPhase) * entity.efficiency();
entity.charge = 0f; entity.charge = 0f;
indexer.eachBlock(entity, realRange, other -> other.entity.timeScale <= realBoost, other -> other.entity.applyBoost(realBoost, reload + 1f)); indexer.eachBlock(entity, realRange, other -> other.entity.timeScale() <= realBoost, other -> other.entity.applyBoost(realBoost, reload + 1f));
} }
} }

View File

@@ -36,7 +36,7 @@ public class ArtilleryTurret extends ItemTurret{
float maxTraveled = type.lifetime * type.speed; float maxTraveled = type.lifetime * type.speed;
for(int i = 0; i < shots; i++){ for(int i = 0; i < shots; i++){
Bullet.create(ammo, tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y, ammo.create(tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y,
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), 1f + Mathf.range(velocityInaccuracy), (dst / maxTraveled)); entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), 1f + Mathf.range(velocityInaccuracy), (dst / maxTraveled));
} }

View File

@@ -86,7 +86,7 @@ public class ItemTurret extends CooledTurret{
} }
@Override @Override
public int acceptStack(Item item, int amount, Tile tile, Unitc source){ public int acceptStack(Item item, int amount, Tile tile, Teamc source){
TurretEntity entity = tile.ent(); TurretEntity entity = tile.ent();
BulletType type = ammo.get(item); BulletType type = ammo.get(item);
@@ -97,7 +97,7 @@ public class ItemTurret extends CooledTurret{
} }
@Override @Override
public void handleStack(Item item, int amount, Tile tile, Unitc source){ public void handleStack(Item item, int amount, Tile tile, Teamc source){
for(int i = 0; i < amount; i++){ for(int i = 0; i < amount; i++){
handleItem(item, tile, null); handleItem(item, tile, null);
} }

View File

@@ -44,7 +44,7 @@ public class LaserTurret extends PowerTurret{
if(entity.bulletLife > 0 && entity.bullet != null){ if(entity.bulletLife > 0 && entity.bullet != null){
tr.trns(entity.rotation, size * tilesize / 2f, 0f); tr.trns(entity.rotation, size * tilesize / 2f, 0f);
entity.bullet.rot(entity.rotation); entity.bullet.rotation(entity.rotation);
entity.bullet.set(tile.drawx() + tr.x, tile.drawy() + tr.y); entity.bullet.set(tile.drawx() + tr.x, tile.drawy() + tr.y);
entity.bullet.time(0f); entity.bullet.time(0f);
entity.heat = 1f; entity.heat = 1f;
@@ -95,7 +95,7 @@ public class LaserTurret extends PowerTurret{
protected void bullet(Tile tile, BulletType type, float angle){ protected void bullet(Tile tile, BulletType type, float angle){
LaserTurretEntity entity = tile.ent(); LaserTurretEntity entity = tile.ent();
entity.bullet = Bullet.create(type, tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle); entity.bullet = type.create(tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
entity.bulletLife = shootDuration; entity.bulletLife = shootDuration;
} }

View File

@@ -71,7 +71,8 @@ public class LiquidTurret extends Turret{
protected boolean validateTarget(Tile tile){ protected boolean validateTarget(Tile tile){
TurretEntity entity = tile.ent(); TurretEntity entity = tile.ent();
if(entity.liquids().current().canExtinguish() && entity.target instanceof Tile){ if(entity.liquids().current().canExtinguish() && entity.target instanceof Tile){
return Fire.has(((Tile)entity.target).x, ((Tile)entity.target).y); //TODO fix
//return Fire.has(((Tile)entity.target).x, ((Tile)entity.target).y);
} }
return super.validateTarget(tile); return super.validateTarget(tile);
} }
@@ -83,10 +84,10 @@ public class LiquidTurret extends Turret{
int tr = (int)(range / tilesize); int tr = (int)(range / tilesize);
for(int x = -tr; x <= tr; x++){ for(int x = -tr; x <= tr; x++){
for(int y = -tr; y <= tr; y++){ for(int y = -tr; y <= tr; y++){
if(Fire.has(x + tile.x, y + tile.y)){ //if(Fire.has(x + tile.x, y + tile.y)){
entity.target = world.tile(x + tile.x, y + tile.y); // entity.target = world.tile(x + tile.x, y + tile.y);
return; // return;
} //}
} }
} }
} }

View File

@@ -191,9 +191,9 @@ public abstract class Turret extends Block{
TurretEntity entity = tile.ent(); TurretEntity entity = tile.ent();
if(targetAir && !targetGround){ if(targetAir && !targetGround){
entity.target = Units.closestEnemy(tile.team(), tile.drawx(), tile.drawy(), range, e -> !e.dead() && e.isFlying()); entity.target = Units.closestEnemy(tile.team(), tile.drawx(), tile.drawy(), range, e -> !e.dead() && !e.isGrounded());
}else{ }else{
entity.target = Units.closestTarget(tile.team(), tile.drawx(), tile.drawy(), range, e -> !e.dead() && (!e.isFlying() || targetAir) && (e.isFlying() || targetGround)); entity.target = Units.closestTarget(tile.team(), tile.drawx(), tile.drawy(), range, e -> !e.dead() && (e.isGrounded() || targetAir) && (!e.isGrounded() || targetGround));
} }
} }
@@ -267,7 +267,7 @@ public abstract class Turret extends Block{
} }
protected void bullet(Tile tile, BulletType type, float angle){ protected void bullet(Tile tile, BulletType type, float angle){
Bullet.create(type, tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle); type.create(tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
} }
protected void effects(Tile tile){ protected void effects(Tile tile){
@@ -329,10 +329,8 @@ public abstract class Turret extends Block{
@Override @Override
public void read(DataInput stream) throws IOException{ public void read(DataInput stream) throws IOException{
super.read(stream); super.read(stream);
if(revision == 1){ reload = stream.readFloat();
reload = stream.readFloat(); rotation = stream.readFloat();
rotation = stream.readFloat();
}
} }
@Override @Override

View File

@@ -72,7 +72,7 @@ public class Conveyor extends Block implements Autotiler{
ConveyorEntity entity = tile.ent(); ConveyorEntity entity = tile.ent();
byte rotation = tile.rotation(); byte rotation = tile.rotation();
int frame = entity.clogHeat <= 0.5f ? (int)(((Time.time() * speed * 8f * entity.timeScale)) % 4) : 0; int frame = entity.clogHeat <= 0.5f ? (int)(((Time.time() * speed * 8f * entity.timeScale())) % 4) : 0;
Draw.rect(regions[Mathf.clamp(entity.blendbits, 0, regions.length - 1)][Mathf.clamp(frame, 0, regions[0].length - 1)], tile.drawx(), tile.drawy(), Draw.rect(regions[Mathf.clamp(entity.blendbits, 0, regions.length - 1)][Mathf.clamp(frame, 0, regions[0].length - 1)], tile.drawx(), tile.drawy(),
tilesize * entity.blendsclx, tilesize * entity.blendscly, rotation * 90); tilesize * entity.blendsclx, tilesize * entity.blendscly, rotation * 90);
} }
@@ -96,7 +96,7 @@ public class Conveyor extends Block implements Autotiler{
if(tile.front() != null && tile.front().entity != null){ if(tile.front() != null && tile.front().entity != null){
entity.next = tile.front().entity; entity.next = tile.front().entity;
entity.nextc = entity.next instanceof ConveyorEntity && entity.next.team() == tile.team() ? (ConveyorEntity)entity.next : null; entity.nextc = entity.next instanceof ConveyorEntity && entity.next.team() == tile.team() ? (ConveyorEntity)entity.next : null;
entity.aligned = entity.nextc != null && tile.rotation() == entity.next.tile.rotation(); entity.aligned = entity.nextc != null && tile.rotation() == entity.next.tile().rotation();
} }
} }
@@ -154,11 +154,11 @@ public class Conveyor extends Block implements Autotiler{
float centerx = 0f, centery = 0f; float centerx = 0f, centery = 0f;
if(Math.abs(tx) > Math.abs(ty)){ if(Math.abs(tx) > Math.abs(ty)){
centery = Mathf.clamp((tile.worldy() - unit.y) / centerDstScl, -centerSpeed, centerSpeed); centery = Mathf.clamp((tile.worldy() - unit.y()) / centerDstScl, -centerSpeed, centerSpeed);
if(Math.abs(tile.worldy() - unit.y) < 1f) centery = 0f; if(Math.abs(tile.worldy() - unit.y()) < 1f) centery = 0f;
}else{ }else{
centerx = Mathf.clamp((tile.worldx() - unit.x) / centerDstScl, -centerSpeed, centerSpeed); centerx = Mathf.clamp((tile.worldx() - unit.x()) / centerDstScl, -centerSpeed, centerSpeed);
if(Math.abs(tile.worldx() - unit.x) < 1f) centerx = 0f; if(Math.abs(tile.worldx() - unit.x()) < 1f) centerx = 0f;
} }
if(entity.len * itemSpace < 0.9f){ if(entity.len * itemSpace < 0.9f){
@@ -179,7 +179,7 @@ public class Conveyor extends Block implements Autotiler{
return; return;
} }
float nextMax = e.nextc != null && tile.rotation() == e.nextc.tile().rotation() ? 1f - Math.max(itemSpace - e.nextc.minitem, 0) : 1f; float nextMax = e.aligned ? 1f - Math.max(itemSpace - e.nextc.minitem, 0) : 1f;
for(int i = e.len - 1; i >= 0; i--){ for(int i = e.len - 1; i >= 0; i--){
float nextpos = (i == e.len - 1 ? 100f : e.ys[i + 1]) - itemSpace; float nextpos = (i == e.len - 1 ? 100f : e.ys[i + 1]) - itemSpace;

View File

@@ -30,7 +30,7 @@ public class Junction extends Block{
} }
@Override @Override
public int acceptStack(Item item, int amount, Tile tile, Unitc source){ public int acceptStack(Item item, int amount, Tile tile, Teamc source){
return 0; return 0;
} }

View File

@@ -1,13 +1,11 @@
package mindustry.world.blocks.distribution; package mindustry.world.blocks.distribution;
import arc.math.Mathf; import arc.math.*;
import arc.util.Time; import arc.util.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.type.Item; import mindustry.type.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.meta.BlockGroup; import mindustry.world.meta.*;
import java.io.*;
public class OverflowGate extends Block{ public class OverflowGate extends Block{
public float speed = 1f; public float speed = 1f;
@@ -117,23 +115,5 @@ public class OverflowGate extends Block{
Item lastItem; Item lastItem;
Tile lastInput; Tile lastInput;
float time; float time;
@Override
public byte version(){
return 2;
}
@Override
public void write(DataOutput stream) throws IOException{
super.write(stream);
}
@Override
public void read(DataInput stream) throws IOException{
super.read(stream);
if(revision == 1){
new DirectionalItemBuffer(25, 50f).read(stream);
}
}
} }
} }

View File

@@ -162,9 +162,6 @@ public class Sorter extends Block{
public void read(DataInput stream) throws IOException{ public void read(DataInput stream) throws IOException{
super.read(stream); super.read(stream);
sortItem = content.item(stream.readShort()); sortItem = content.item(stream.readShort());
if(revision == 1){
new DirectionalItemBuffer(20, 45f).read(stream);
}
} }
} }
} }

View File

@@ -107,7 +107,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
@Override @Override
public void update(Tile tile){ public void update(Tile tile){
ConduitEntity entity = tile.ent(); ConduitEntity entity = tile.ent();
entity.smoothLiquid = Mathf.lerpDelta(entity.smoothLiquid, entity.getLiquids().currentAmount() / liquidCapacity, 0.05f); entity.smoothLiquid = Mathf.lerpDelta(entity.smoothLiquid, entity.liquids().currentAmount() / liquidCapacity, 0.05f);
if(tile.entity.liquids().total() > 0.001f && tile.entity.timer(timerFlow, 1)){ if(tile.entity.liquids().total() > 0.001f && tile.entity.timer(timerFlow, 1)){
tryMoveLiquid(tile, tile.getNearby(tile.rotation()), leakResistance, tile.entity.liquids().current()); tryMoveLiquid(tile, tile.getNearby(tile.rotation()), leakResistance, tile.entity.liquids().current());

View File

@@ -28,7 +28,7 @@ public class LiquidBridge extends ItemBridge{
Tile other = world.tile(entity.link); Tile other = world.tile(entity.link);
if(!linkValid(tile, other)){ if(!linkValid(tile, other)){
tryDumpLiquid(tile, entity.getLiquids().current()); tryDumpLiquid(tile, entity.liquids().current());
}else{ }else{
((ItemBridgeEntity)world.tile(entity.link).entity).incoming.add(tile.pos()); ((ItemBridgeEntity)world.tile(entity.link).entity).incoming.add(tile.pos());
@@ -44,7 +44,7 @@ public class LiquidBridge extends ItemBridge{
if(entity.uptime >= 0.5f){ if(entity.uptime >= 0.5f){
if(tryMoveLiquid(tile, other, false, entity.getLiquids().current()) > 0.1f){ if(tryMoveLiquid(tile, other, false, entity.liquids().current()) > 0.1f){
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 4f, 0.05f); entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 4f, 0.05f);
}else{ }else{
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f); entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f);

View File

@@ -28,7 +28,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
Tile other = world.tile(entity.link); Tile other = world.tile(entity.link);
if(!linkValid(tile, other)){ if(!linkValid(tile, other)){
tryDumpLiquid(tile, entity.getLiquids().current()); tryDumpLiquid(tile, entity.liquids().current());
}else{ }else{
((ItemBridgeEntity)world.tile(entity.link).entity).incoming.add(tile.pos()); ((ItemBridgeEntity)world.tile(entity.link).entity).incoming.add(tile.pos());
@@ -40,7 +40,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
if(entity.uptime >= 0.5f){ if(entity.uptime >= 0.5f){
if(tryMoveLiquid(tile, other, false, entity.getLiquids().current()) > 0.1f){ if(tryMoveLiquid(tile, other, false, entity.liquids().current()) > 0.1f){
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 4f, 0.05f); entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 4f, 0.05f);
}else{ }else{
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f); entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f);

View File

@@ -53,7 +53,7 @@ public class ImpactReactor extends PowerGenerator{
bars.add("poweroutput", entity -> new Bar(() -> bars.add("poweroutput", entity -> new Bar(() ->
Core.bundle.format("bar.poweroutput", Core.bundle.format("bar.poweroutput",
Strings.fixed(Math.max(entity.block.getPowerProduction(entity.tile) - consumes.getPower().usage, 0) * 60 * entity.timeScale, 1)), Strings.fixed(Math.max(entity.block().getPowerProduction(entity.tile()) - consumes.getPower().usage, 0) * 60 * entity.timeScale(), 1)),
() -> Pal.powerBar, () -> Pal.powerBar,
() -> ((GeneratorEntity)entity).productionEfficiency)); () -> ((GeneratorEntity)entity).productionEfficiency));
} }
@@ -83,7 +83,7 @@ public class ImpactReactor extends PowerGenerator{
Events.fire(Trigger.impactPower); Events.fire(Trigger.impactPower);
} }
if(entity.timer(timerUse, itemDuration / entity.timeScale)){ if(entity.timer(timerUse, itemDuration / entity.timeScale())){
entity.consume(); entity.consume();
} }
}else{ }else{

View File

@@ -86,7 +86,7 @@ public class NuclearReactor extends PowerGenerator{
if(fuel > 0){ if(fuel > 0){
entity.heat += fullness * heating * Math.min(entity.delta(), 4f); entity.heat += fullness * heating * Math.min(entity.delta(), 4f);
if(entity.timer(timerFuel, itemDuration / entity.timeScale)){ if(entity.timer(timerFuel, itemDuration / entity.timeScale())){
entity.consume(); entity.consume();
} }
} }

View File

@@ -58,8 +58,8 @@ public class PowerDiode extends Block{
public void setBars(){ public void setBars(){
super.setBars(); super.setBars();
bars.add("back", entity -> new Bar("bar.input", Pal.powerBar, () -> bar(entity.tile.back()))); bars.add("back", entity -> new Bar("bar.input", Pal.powerBar, () -> bar(entity.tile().back())));
bars.add("front", entity -> new Bar("bar.output", Pal.powerBar, () -> bar(entity.tile.front()))); bars.add("front", entity -> new Bar("bar.output", Pal.powerBar, () -> bar(entity.tile().front())));
} }
@Override @Override

View File

@@ -37,7 +37,7 @@ public class PowerGenerator extends PowerDistributor{
if(hasPower && outputsPower && !consumes.hasPower()){ if(hasPower && outputsPower && !consumes.hasPower()){
bars.add("power", entity -> new Bar(() -> bars.add("power", entity -> new Bar(() ->
Core.bundle.format("bar.poweroutput", Core.bundle.format("bar.poweroutput",
Strings.fixed(entity.block.getPowerProduction(entity.tile) * 60 * entity.timeScale, 1)), Strings.fixed(entity.block().getPowerProduction(entity.tile()) * 60 * entity.timeScale(), 1)),
() -> Pal.powerBar, () -> Pal.powerBar,
() -> ((GeneratorEntity)entity).productionEfficiency)); () -> ((GeneratorEntity)entity).productionEfficiency));
} }

View File

@@ -41,11 +41,11 @@ public class PowerNode extends PowerBlock{
public void configured(Tile tile, Playerc player, int value){ public void configured(Tile tile, Playerc player, int value){
Tilec entity = tile.entity; Tilec entity = tile.entity;
Tile other = world.tile(value); Tile other = world.tile(value);
boolean contains = entity.getPower().links.contains(value), valid = other != null && other.entity != null && other.entity.power() != null; boolean contains = entity.power().links.contains(value), valid = other != null && other.entity != null && other.entity.power() != null;
if(contains){ if(contains){
//unlink //unlink
entity.getPower().links.removeValue(value); entity.power().links.removeValue(value);
if(valid) other.entity.power().links.removeValue(tile.pos()); if(valid) other.entity.power().links.removeValue(tile.pos());
PowerGraph newgraph = new PowerGraph(); PowerGraph newgraph = new PowerGraph();
@@ -59,10 +59,10 @@ public class PowerNode extends PowerBlock{
//reflow from other end //reflow from other end
og.reflow(other); og.reflow(other);
} }
}else if(linkValid(tile, other) && valid && entity.getPower().links.size < maxNodes){ }else if(linkValid(tile, other) && valid && entity.power().links.size < maxNodes){
if(!entity.getPower().links.contains(other.pos())){ if(!entity.power().links.contains(other.pos())){
entity.getPower().links.add(other.pos()); entity.power().links.add(other.pos());
} }
if(other.getTeamID() == tile.getTeamID()){ if(other.getTeamID() == tile.getTeamID()){
@@ -72,7 +72,7 @@ public class PowerNode extends PowerBlock{
} }
} }
entity.getPower().graph.add(other.entity.power().graph); entity.power().graph.add(other.entity.power().graph);
} }
} }
@@ -189,8 +189,8 @@ public class PowerNode extends PowerBlock{
} }
}); });
}else{ }else{
while(entity.getPower().links.size > 0){ while(entity.power().links.size > 0){
tile.configure(entity.getPower().links.get(0)); tile.configure(entity.power().links.get(0));
} }
} }
return false; return false;
@@ -267,8 +267,8 @@ public class PowerNode extends PowerBlock{
Tilec entity = tile.ent(); Tilec entity = tile.ent();
for(int i = 0; i < entity.getPower().links.size; i++){ for(int i = 0; i < entity.power().links.size; i++){
Tile link = world.tile(entity.getPower().links.get(i)); Tile link = world.tile(entity.power().links.get(i));
if(!linkValid(tile, link)) continue; if(!linkValid(tile, link)) continue;

View File

@@ -47,7 +47,8 @@ public class LaunchPad extends StorageBlock{
public void draw(Tile tile){ public void draw(Tile tile){
super.draw(tile); super.draw(tile);
float progress = Mathf.clamp(Mathf.clamp((tile.entity.items().total() / (float)itemCapacity)) * ((tile.entity.timerTime(timerLaunch) / (launchTime / tile.entity.timeScale)))); //TODO broken
float progress = Mathf.clamp(Mathf.clamp((tile.entity.items().total() / (float)itemCapacity)) * ((tile.entity.timer().getTime(timerLaunch) / (launchTime / tile.entity.timeScale()))));
float scale = size / 3f; float scale = size / 3f;
Lines.stroke(2f); Lines.stroke(2f);
@@ -72,7 +73,7 @@ public class LaunchPad extends StorageBlock{
public void update(Tile tile){ public void update(Tile tile){
Tilec entity = tile.entity; Tilec entity = tile.entity;
if(world.isZone() && entity.consValid() && entity.items().total() >= itemCapacity && entity.timer(timerLaunch, launchTime / entity.timeScale)){ if(world.isZone() && entity.consValid() && entity.items().total() >= itemCapacity && entity.timer(timerLaunch, launchTime / entity.timeScale())){
for(Item item : Vars.content.items()){ for(Item item : Vars.content.items()){
Events.fire(Trigger.itemLaunch); Events.fire(Trigger.itemLaunch);
Fx.padlaunch.at(tile); Fx.padlaunch.at(tile);

View File

@@ -63,7 +63,7 @@ public class Unloader extends Block{
public void update(Tile tile){ public void update(Tile tile){
UnloaderEntity entity = tile.ent(); UnloaderEntity entity = tile.ent();
if(tile.entity.timer(timerUnload, speed / entity.timeScale) && tile.entity.items().total() == 0){ if(tile.entity.timer(timerUnload, speed / entity.timeScale()) && tile.entity.items().total() == 0){
for(Tile other : tile.entity.proximity()){ for(Tile other : tile.entity.proximity()){
if(other.interactable(tile.team()) && other.block().unloadable && other.block().hasItems && entity.items().total() == 0 && if(other.interactable(tile.team()) && other.block().unloadable && other.block().hasItems && entity.items().total() == 0 &&
((entity.sortItem == null && other.entity.items().total() > 0) || hasItem(other, entity.sortItem))){ ((entity.sortItem == null && other.entity.items().total() > 0) || hasItem(other, entity.sortItem))){

View File

@@ -57,7 +57,7 @@ public class CommandCenter extends Block{
ObjectSet<Tile> set = indexer.getAllied(tile.team(), BlockFlag.comandCenter); ObjectSet<Tile> set = indexer.getAllied(tile.team(), BlockFlag.comandCenter);
if(set.size == 1){ if(set.size == 1){
Groups.unit.each(t -> t.team() == tile.team(), u -> u.onCommand(UnitCommand.all[0])); Groups.unit.each(t -> t.team() == tile.team(), u -> u.controller().command(UnitCommand.all[0]));
} }
} }
@@ -113,7 +113,7 @@ public class CommandCenter extends Block{
} }
} }
Groups.unit.each(t -> t.team() == tile.team(), u -> u.onCommand(command)); Groups.unit.each(t -> t.team() == tile.team(), u -> u.controller().command(command));
Events.fire(new CommandIssueEvent(tile, command)); Events.fire(new CommandIssueEvent(tile, command));
} }
@@ -132,8 +132,8 @@ public class CommandCenter extends Block{
} }
@Override @Override
public void read(DataInput stream, byte version) throws IOException{ public void read(DataInput stream) throws IOException{
super.read(stream, version); super.read(stream);
command = UnitCommand.all[stream.readByte()]; command = UnitCommand.all[stream.readByte()];
} }
} }

View File

@@ -1,27 +1,24 @@
package mindustry.world.blocks.units; package mindustry.world.blocks.units;
import arc.*;
import mindustry.annotations.Annotations.*;
import arc.struct.EnumSet;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.util.*; import arc.struct.*;
import arc.util.ArcAnnotate.*; import arc.util.ArcAnnotate.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.gen.*;
import mindustry.game.EventType.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
import java.io.*; import java.io.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
//TODO remove
public class MechPad extends Block{ public class MechPad extends Block{
public @NonNull UnitDef mech; public @NonNull UnitDef mech;
public float buildTime = 60 * 5; public float buildTime = 60 * 5;
@@ -50,7 +47,7 @@ public class MechPad extends Block{
MechFactoryEntity entity = tile.ent(); MechFactoryEntity entity = tile.ent();
if(!entity.consValid()) return; if(!entity.consValid()) return;
player.beginRespawning(entity); //player.beginRespawning(entity);
entity.sameMech = false; entity.sameMech = false;
} }
@@ -63,24 +60,24 @@ public class MechPad extends Block{
Fx.spawn.at(entity); Fx.spawn.at(entity);
if(entity.player == null) return; if(entity.player == null) return;
Mech mech = ((MechPad)tile.block()).mech; //Mech mech = ((MechPad)tile.block()).mech;
boolean resetSpawner = !entity.sameMech && entity.player.mech == mech; //boolean resetSpawner = !entity.sameMech && entity.player.mech == mech;
entity.player.mech = !entity.sameMech && entity.player.mech == mech ? UnitTypes.starter : mech; //entity.player.mech = !entity.sameMech && entity.player.mech == mech ? UnitTypes.starter : mech;
Playerc player = entity.player; Playerc player = entity.player;
entity.progress = 0; //entity.progress = 0;
entity.player.onRespawn(tile); //entity.player.onRespawn(tile);
if(resetSpawner) entity.player.lastSpawner = null; //if(resetSpawner) entity.player.lastSpawner = null;
entity.player = null; //entity.player = null;
Events.fire(new MechChangeEvent(player, player.mech)); //Events.fire(new MechChangeEvent(player, player.mech));
} }
protected static boolean checkValidTap(Tile tile, Playerc player){ protected static boolean checkValidTap(Tile tile, Playerc player){
MechFactoryEntity entity = tile.ent(); MechFactoryEntity entity = tile.ent();
return !player.dead() && tile.interactable(player.team()) && Math.abs(player.x - tile.drawx()) <= tile.block().size * tilesize && return false;//!player.dead() && tile.interactable(player.team()) && Math.abs(player.x - tile.drawx()) <= tile.block().size * tilesize &&
Math.abs(player.y - tile.drawy()) <= tile.block().size * tilesize && entity.consValid() && entity.player == null; //Math.abs(player.y - tile.drawy()) <= tile.block().size * tilesize && entity.consValid() && entity.player == null;
} }
@Override @Override
@@ -101,7 +98,8 @@ public class MechPad extends Block{
Call.onMechFactoryTap(player, tile); Call.onMechFactoryTap(player, tile);
}else if(player.isLocal() && mobile && !player.dead() && entity.consValid() && entity.player == null){ }else if(player.isLocal() && mobile && !player.dead() && entity.consValid() && entity.player == null){
//deselect on double taps //deselect on double taps
player.moveTarget = player.moveTarget == tile.entity ? null : tile.entity; //TODO remove
//player.moveTarget = player.moveTarget == tile.entity ? null : tile.entity;
} }
} }
@@ -110,7 +108,8 @@ public class MechPad extends Block{
MechFactoryEntity entity = tile.ent(); MechFactoryEntity entity = tile.ent();
if(entity.player != null){ if(entity.player != null){
RespawnBlock.drawRespawn(tile, entity.heat, entity.progress, entity.time, entity.player, (!entity.sameMech && entity.player.mech == mech ? UnitTypes.starter : mech)); //TODO remove
//RespawnBlock.drawRespawn(tile, entity.heat, entity.progress, entity.time, entity.player, (!entity.sameMech && entity.player.mech == mech ? UnitTypes.starter : mech));
} }
} }

View File

@@ -1,14 +0,0 @@
package mindustry.world.blocks.units;
import arc.struct.*;
import mindustry.world.*;
import mindustry.world.meta.*;
public class RallyPoint extends Block{
public RallyPoint(String name){
super(name);
update = solid = true;
flags = EnumSet.of(BlockFlag.rally);
}
}

View File

@@ -95,7 +95,7 @@ public class RepairPoint extends Block{
Draw.color(Color.valueOf("e8ffd7")); Draw.color(Color.valueOf("e8ffd7"));
Drawf.laser(laser, laserEnd, Drawf.laser(laser, laserEnd,
tile.drawx() + Angles.trnsx(ang, len), tile.drawy() + Angles.trnsy(ang, len), tile.drawx() + Angles.trnsx(ang, len), tile.drawy() + Angles.trnsy(ang, len),
entity.target.x, entity.target.y, entity.strength); entity.target.x(), entity.target.y(), entity.strength);
Draw.color(); Draw.color();
} }
} }
@@ -110,11 +110,10 @@ public class RepairPoint extends Block{
RepairPointEntity entity = tile.ent(); RepairPointEntity entity = tile.ent();
boolean targetIsBeingRepaired = false; boolean targetIsBeingRepaired = false;
if(entity.target != null && (entity.target.dead() || entity.target.dst(tile) > repairRadius || entity.target.health >= entity.target.maxHealth())){ if(entity.target != null && (entity.target.dead() || entity.target.dst(tile) > repairRadius || entity.target.health() >= entity.target.maxHealth())){
entity.target = null; entity.target = null;
}else if(entity.target != null && entity.consValid()){ }else if(entity.target != null && entity.consValid()){
entity.target.health += repairSpeed * Time.delta() * entity.strength * entity.efficiency(); entity.target.heal(repairSpeed * Time.delta() * entity.strength * entity.efficiency());
entity.target.clampHealth();
entity.rotation = Mathf.slerpDelta(entity.rotation, entity.angleTo(entity.target), 0.5f); entity.rotation = Mathf.slerpDelta(entity.rotation, entity.angleTo(entity.target), 0.5f);
targetIsBeingRepaired = true; targetIsBeingRepaired = true;
} }
@@ -127,8 +126,7 @@ public class RepairPoint extends Block{
if(entity.timer(timerTarget, 20)){ if(entity.timer(timerTarget, 20)){
rect.setSize(repairRadius * 2).setCenter(tile.drawx(), tile.drawy()); rect.setSize(repairRadius * 2).setCenter(tile.drawx(), tile.drawy());
entity.target = Units.closest(tile.team(), tile.drawx(), tile.drawy(), repairRadius, entity.target = Units.closest(tile.team(), tile.drawx(), tile.drawy(), repairRadius, Unitc::damaged);
unit -> unit.health < unit.maxHealth());
} }
} }

View File

@@ -39,12 +39,12 @@ public class ConsumeLiquid extends ConsumeLiquidBase{
@Override @Override
public void update(Tilec entity){ public void update(Tilec entity){
entity.getLiquids().remove(liquid, Math.min(use(entity), entity.getLiquids().get(liquid))); entity.liquids().remove(liquid, Math.min(use(entity), entity.liquids().get(liquid)));
} }
@Override @Override
public boolean valid(Tilec entity){ public boolean valid(Tilec entity){
return entity != null && entity.getLiquids() != null && entity.getLiquids().get(liquid) >= use(entity); return entity != null && entity.liquids() != null && entity.liquids().get(liquid) >= use(entity);
} }
@Override @Override

View File

@@ -23,6 +23,6 @@ public abstract class ConsumeLiquidBase extends Consume{
} }
protected float use(Tilec entity){ protected float use(Tilec entity){
return Math.min(amount * entity.delta(), entity.block.liquidCapacity); return Math.min(amount * entity.delta(), entity.block().liquidCapacity);
} }
} }

View File

@@ -42,7 +42,7 @@ public class ConsumePower extends Consume{
@Override @Override
public void update(Tilec entity){ public void update(Tilec entity){
// Nothing to do since PowerGraph directly updates entity.getPower().status // Nothing to do since PowerGraph directly updates entity.power().status
} }
@Override @Override

View File

@@ -15,7 +15,7 @@ public class ConsumeModule extends BlockModule{
public void update(){ public void update(){
//everything is valid here //everything is valid here
if(entity.tile.isEnemyCheat()){ if(entity.tile().isEnemyCheat()){
valid = optionalValid = true; valid = optionalValid = true;
return; return;
} }
@@ -23,9 +23,9 @@ public class ConsumeModule extends BlockModule{
boolean prevValid = valid(); boolean prevValid = valid();
valid = true; valid = true;
optionalValid = true; optionalValid = true;
boolean docons = entity.block.shouldConsume(entity.tile) && entity.block.productionValid(entity.tile); boolean docons = entity.block().shouldConsume(entity.tile()) && entity.block().productionValid(entity.tile());
for(Consume cons : entity.block.consumes.all()){ for(Consume cons : entity.block().consumes.all()){
if(cons.isOptional()) continue; if(cons.isOptional()) continue;
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){ if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
@@ -35,7 +35,7 @@ public class ConsumeModule extends BlockModule{
valid &= cons.valid(entity); valid &= cons.valid(entity);
} }
for(Consume cons : entity.block.consumes.optionals()){ for(Consume cons : entity.block().consumes.optionals()){
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){ if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
cons.update(entity); cons.update(entity);
} }
@@ -45,13 +45,13 @@ public class ConsumeModule extends BlockModule{
} }
public void trigger(){ public void trigger(){
for(Consume cons : entity.block.consumes.all()){ for(Consume cons : entity.block().consumes.all()){
cons.trigger(entity); cons.trigger(entity);
} }
} }
public boolean valid(){ public boolean valid(){
return valid && entity.block.shouldConsume(entity.tile); return valid && entity.block().shouldConsume(entity.tile());
} }
public boolean optionalValid(){ public boolean optionalValid(){

View File

@@ -12,6 +12,9 @@ public class ItemModule extends BlockModule{
private int[] items = new int[content.items().size]; private int[] items = new int[content.items().size];
private int total; private int total;
// Make the take() loop persistent so it does not return the same item twice in a row unless there is nothing else to return.
protected int takeRotation;
public void forEach(ItemConsumer cons){ public void forEach(ItemConsumer cons){
for(int i = 0; i < items.length; i++){ for(int i = 0; i < items.length; i++){
if(items[i] > 0){ if(items[i] > 0){
@@ -68,10 +71,13 @@ public class ItemModule extends BlockModule{
public Item take(){ public Item take(){
for(int i = 0; i < items.length; i++){ for(int i = 0; i < items.length; i++){
if(items[i] > 0){ int index = (i + takeRotation);
items[i]--; if(index >= items.length) index -= items.length; //conditional instead of mod
total--; if(items[index] > 0){
return content.item(i); items[index] --;
total --;
takeRotation = index + 1;
return content.item(index % items.length);
} }
} }
return null; return null;

View File

@@ -50,6 +50,6 @@ public class DirectConsumerTests extends PowerTestFixture{
consumerTile.entity.update(); consumerTile.entity.update();
graph.update(); graph.update();
assertEquals(expectedSatisfaction, consumertile.entity.getPower().status); assertEquals(expectedSatisfaction, consumertile.entity.power().status);
} }
} }

View File

@@ -66,7 +66,7 @@ public class PowerTests extends PowerTestFixture{
// Update and check for the expected power status of the consumer // Update and check for the expected power status of the consumer
powerGraph.update(); powerGraph.update();
assertEquals(expectedSatisfaction, directConsumertile.entity.getPower().status, Mathf.FLOAT_ROUNDING_ERROR, parameterDescription + ": Satisfaction of direct consumer did not match"); assertEquals(expectedSatisfaction, directConsumertile.entity.power().status, Mathf.FLOAT_ROUNDING_ERROR, parameterDescription + ": Satisfaction of direct consumer did not match");
} }
/** /**
@@ -104,14 +104,14 @@ public class PowerTests extends PowerTestFixture{
} }
float maxCapacity = 100f; float maxCapacity = 100f;
Tile batteryTile = createFakeTile(0, 2, createFakeBattery(maxCapacity)); Tile batteryTile = createFakeTile(0, 2, createFakeBattery(maxCapacity));
batterytile.entity.getPower().status = initialBatteryCapacity / maxCapacity; batterytile.entity.power().status = initialBatteryCapacity / maxCapacity;
powerGraph.add(batteryTile); powerGraph.add(batteryTile);
powerGraph.update(); powerGraph.update();
assertEquals(expectedBatteryCapacity / maxCapacity, batterytile.entity.getPower().status, Mathf.FLOAT_ROUNDING_ERROR, parameterDescription + ": Expected battery status did not match"); assertEquals(expectedBatteryCapacity / maxCapacity, batterytile.entity.power().status, Mathf.FLOAT_ROUNDING_ERROR, parameterDescription + ": Expected battery status did not match");
if(directConsumerTile != null){ if(directConsumerTile != null){
assertEquals(expectedSatisfaction, directConsumertile.entity.getPower().status, Mathf.FLOAT_ROUNDING_ERROR, parameterDescription + ": Satisfaction of direct consumer did not match"); assertEquals(expectedSatisfaction, directConsumertile.entity.power().status, Mathf.FLOAT_ROUNDING_ERROR, parameterDescription + ": Satisfaction of direct consumer did not match");
} }
} }
@@ -127,13 +127,13 @@ public class PowerTests extends PowerTestFixture{
powerGraph.add(consumerTile); powerGraph.add(consumerTile);
powerGraph.update(); powerGraph.update();
assertEquals(1.0f, consumertile.entity.getPower().status, Mathf.FLOAT_ROUNDING_ERROR); assertEquals(1.0f, consumertile.entity.power().status, Mathf.FLOAT_ROUNDING_ERROR);
powerGraph.remove(producerTile); powerGraph.remove(producerTile);
powerGraph.add(consumerTile); powerGraph.add(consumerTile);
powerGraph.update(); powerGraph.update();
assertEquals(0.0f, consumertile.entity.getPower().status, Mathf.FLOAT_ROUNDING_ERROR); assertEquals(0.0f, consumertile.entity.power().status, Mathf.FLOAT_ROUNDING_ERROR);
if(consumerTile.block().consumes.hasPower()){ if(consumerTile.block().consumes.hasPower()){
ConsumePower consumePower = consumerTile.block().consumes.getPower(); ConsumePower consumePower = consumerTile.block().consumes.getPower();
assertFalse(consumePower.valid(consumerTile.ent())); assertFalse(consumePower.valid(consumerTile.ent()));