c l e a n u p
@@ -22,12 +22,14 @@ First, make sure you have [JDK 8](https://adoptopenjdk.net/) installed. Open a t
|
||||
#### Windows
|
||||
|
||||
_Running:_ `gradlew desktop:run`
|
||||
_Building:_ `gradlew desktop:dist`
|
||||
_Building:_ `gradlew desktop:dist`
|
||||
_Sprite Packing:_ `gradlew tools:pack`
|
||||
|
||||
#### Linux/Mac OS
|
||||
|
||||
_Running:_ `./gradlew desktop:run`
|
||||
_Building:_ `./gradlew desktop:dist`
|
||||
_Building:_ `./gradlew desktop:dist`
|
||||
_Sprite Packing:_ `./gradlew tools:pack`
|
||||
|
||||
#### Server
|
||||
|
||||
|
||||
@@ -164,6 +164,7 @@ public class EntityProcess extends BaseProcessor{
|
||||
fbuilder.initializer(tree.getInitializer().toString());
|
||||
}
|
||||
|
||||
if(!isFinal) fbuilder.addModifiers(Modifier.PROTECTED);
|
||||
fbuilder.addAnnotations(f.annotations().map(AnnotationSpec::get));
|
||||
builder.addField(fbuilder.build());
|
||||
}
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
mindustry.entities.def.EntityDefs.DecalDef=1
|
||||
mindustry.entities.def.EntityDefs.EffectDef=2
|
||||
mindustry.entities.def.EntityDefs.TileDef=3
|
||||
mindustry.entities.def.EntityDefs.GenericUnitDef=5
|
||||
mindustry.entities.def.EntityDefs.BulletDef=0
|
||||
mindustry.entities.def.EntityDefs.PlayerDef=4
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -45,7 +45,7 @@ schematic.exportfile = Esporta File
|
||||
schematic.importfile = Importa File
|
||||
schematic.browseworkshop = Naviga nel Workshop
|
||||
schematic.copy = Copia negli Appunti
|
||||
schematic.copy.import = Incolla dagli Appunti
|
||||
schematic.copy.import = Importa dagli Appunti
|
||||
schematic.shareworkshop = Condividi nel Workshop
|
||||
schematic.flip = [accent][[{0}][]/[accent][[{1}][]: Ruota Schematica
|
||||
schematic.saved = Schematica salvata.
|
||||
@@ -59,6 +59,7 @@ stat.built = Costruzioni Erette:[accent] {0}
|
||||
stat.destroyed = Costruzioni Distrutte:[accent] {0}
|
||||
stat.deconstructed = Costruzioni Smantellate:[accent] {0}
|
||||
stat.delivered = Risorse Lanciate:
|
||||
stat.playtime = Tempo Di Gioco:[accent] {0}
|
||||
stat.rank = Livello Finale: [accent]{0}
|
||||
|
||||
launcheditems = [accent]Oggetti Lanciati
|
||||
@@ -69,7 +70,7 @@ level.select = Selezione del Livello
|
||||
level.mode = Modalità di Gioco:
|
||||
showagain = Non mostrare più
|
||||
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
|
||||
savegame = Salva
|
||||
loadgame = Carica
|
||||
@@ -104,6 +105,7 @@ mods.none = [lightgray]Nessuna mod trovata!
|
||||
mods.guide = Guida per il modding
|
||||
mods.report = Segnala un Bug
|
||||
mods.openfolder = Apri Cartella Mods
|
||||
mod.display = [gray]Mod:[orange] {0}
|
||||
mod.enabled = [lightgray]Abilitato
|
||||
mod.disabled = [scarlet]Disabilitato
|
||||
mod.disable = Disabilita
|
||||
@@ -143,7 +145,7 @@ server.closing = [accent]Chiusura server...
|
||||
server.kicked.kick = Sei stato espulso dal server!
|
||||
server.kicked.whitelist = Non sei presente nella whitelist.
|
||||
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.serverOutdated = Server obsoleto! Chiedi all'host di aggiornare la versione del 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.savecreate.name = Salvataggio Automatico
|
||||
setting.publichost.name = Gioco Visibile Pubblicamente
|
||||
setting.playerlimit.name = Limite Giocatori
|
||||
setting.chatopacity.name = Opacità Chat
|
||||
setting.lasersopacity.name = Opacità Raggi Energetici
|
||||
setting.bridgeopacity.name = Opacità Nastri e Condotti Sopraelevati
|
||||
|
||||
@@ -40,7 +40,7 @@ schematic = Blauwdruk
|
||||
schematic.add = Bewaar blauwdruk...
|
||||
schematics = Blauwdrukken
|
||||
schematic.replace = Er bestaat al een blauwdruk met die naam. Overschrijven?
|
||||
schematic.import = Importeer blauwdrul...
|
||||
schematic.import = Importeer blauwdruk...
|
||||
schematic.exportfile = Exporteer bestand
|
||||
schematic.importfile = Importeer bestand
|
||||
schematic.browseworkshop = Blader Werkplaats
|
||||
@@ -245,13 +245,13 @@ workshop.listing = Bewerk Workshop vermelding
|
||||
ok = Oke
|
||||
open = Open
|
||||
customize = Aanpassen
|
||||
cancel = Anuleer
|
||||
cancel = Annuleer
|
||||
openlink = Open Link
|
||||
copylink = Customize Link
|
||||
back = Teru
|
||||
back = Terug
|
||||
data.export = Exporteer Data
|
||||
data.import = Importeer Data
|
||||
data.exported = Data Geexporteerd.
|
||||
data.exported = Data Geëxporteerd.
|
||||
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.
|
||||
classic.export = Exporteer klassieke data
|
||||
@@ -450,7 +450,7 @@ launch.title = Lancering Sucessvol
|
||||
launch.next = [LIGHT_GRAY]volgende lanceerkans in ronde {0}
|
||||
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.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
|
||||
configure = Configureer startinventaris
|
||||
bannedblocks = Verboden Blokken
|
||||
@@ -532,21 +532,21 @@ blocks.input = Input
|
||||
blocks.output = Output
|
||||
blocks.booster = Booster
|
||||
block.unknown = [LIGHT_GRAY]???
|
||||
blocks.powercapacity = Stroom Capaciteit
|
||||
blocks.powershot = Stroom/Shot
|
||||
blocks.damage = Damage
|
||||
blocks.powercapacity = Stroomcapaciteit
|
||||
blocks.powershot = Stroom/Schot
|
||||
blocks.damage = Schade
|
||||
blocks.targetsair = Luchtdoelwitten
|
||||
blocks.targetsground = Gronddoelwitten
|
||||
blocks.itemsmoved = Beweegsnelheid
|
||||
blocks.launchtime = Tijd tussen lanceringen
|
||||
blocks.shootrange = Bereik
|
||||
blocks.size = Formaat
|
||||
blocks.liquidcapacity = Vloeistof Capaciteit
|
||||
blocks.powerrange = Stroom Bereik
|
||||
blocks.powerconnections = Maximale Hoeveelheid Dradem
|
||||
blocks.poweruse = Stroom verbruik
|
||||
blocks.powerdamage = Stroom/Damage
|
||||
blocks.itemcapacity = Materiaal Capaciteit
|
||||
blocks.liquidcapacity = Vloeistofcapaciteit
|
||||
blocks.powerrange = Stroombereik
|
||||
blocks.powerconnections = Maximale Hoeveelheid Connecties
|
||||
blocks.poweruse = Stroomverbruik
|
||||
blocks.powerdamage = Stroom/Schade
|
||||
blocks.itemcapacity = Materiaalcapaciteit
|
||||
blocks.basepowergeneration = Standaard Stroom Generatie
|
||||
blocks.productiontime = Productie Tijd
|
||||
blocks.repairtime = Volledige Blok Repareertijd
|
||||
@@ -556,17 +556,17 @@ blocks.drilltier = Valt te delven
|
||||
blocks.drillspeed = Standaard mine snelheid
|
||||
blocks.boosteffect = Boost Effect
|
||||
blocks.maxunits = Maximaal Actieve Units
|
||||
blocks.health = Health
|
||||
blocks.buildtime = Bouw tijd
|
||||
blocks.buildcost = Bouw kosten
|
||||
blocks.health = Levenspunten
|
||||
blocks.buildtime = Bouwtijd
|
||||
blocks.buildcost = Bouwkosten
|
||||
blocks.inaccuracy = Onnauwkeurigheid
|
||||
blocks.shots = Shoten
|
||||
blocks.reload = Schoten/Seconde
|
||||
blocks.ammo = Ammonutie
|
||||
blocks.ammo = Ammunitie
|
||||
|
||||
bar.drilltierreq = Betere miner nodig
|
||||
bar.drillspeed = Mining Snelheid: {0}/s
|
||||
bar.pumpspeed = Pomp Snelheid: {0}/s
|
||||
bar.pumpspeed = Pompsnelheid: {0}/s
|
||||
bar.efficiency = Rendement: {0}%
|
||||
bar.powerbalance = Stroom: {0}
|
||||
bar.powerstored = Opgeslagen: {0}/{1}
|
||||
@@ -591,15 +591,15 @@ bullet.frag = [stat]clusterbom
|
||||
bullet.knockback = [stat]{0}[lightgray] terugslag
|
||||
bullet.freezing = [stat]bevriezend
|
||||
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
|
||||
|
||||
unit.blocks = blokken
|
||||
unit.powersecond = stroom eenheid/seconde
|
||||
unit.liquidsecond = vloeistof eenheid/seconde
|
||||
unit.powersecond = stroomeenheid/seconde
|
||||
unit.liquidsecond = vloeistofeenheid/seconde
|
||||
unit.itemssecond = items/seconde
|
||||
unit.liquidunits = vloeistof eenheid
|
||||
unit.powerunits = stroom eenheid
|
||||
unit.liquidunits = vloeistofeenheid
|
||||
unit.powerunits = stroomeenheid
|
||||
unit.degrees = graden
|
||||
unit.seconds = secondes
|
||||
unit.persecond = /sec
|
||||
@@ -615,8 +615,8 @@ category.items = Items
|
||||
category.crafting = Productie
|
||||
category.shooting = Wapens
|
||||
category.optional = Optionele Verbeteringen
|
||||
setting.landscape.name = Vergrendel Landscape
|
||||
setting.shadows.name = Schaduws
|
||||
setting.landscape.name = Vergrendel Landschap
|
||||
setting.shadows.name = Schaduwen
|
||||
setting.blockreplace.name = Automatische Blok Suggesties
|
||||
setting.linear.name = Linear Filtering
|
||||
setting.hints.name = Hints
|
||||
@@ -629,14 +629,14 @@ setting.autotarget.name = Auto-Target
|
||||
setting.keyboard.name = Muis+Toetsenbord Controls
|
||||
setting.touchscreen.name = Touchscreen Controls
|
||||
setting.fpscap.name = Max FPS
|
||||
setting.fpscap.none = None
|
||||
setting.fpscap.none = Geen
|
||||
setting.fpscap.text = {0} FPS
|
||||
setting.uiscale.name = UI Schaal[lightgray] (herstart vereist)[]
|
||||
setting.swapdiagonal.name = Altijd Diagonaal Plaatsen
|
||||
setting.difficulty.training = kalm
|
||||
setting.difficulty.training = oefening
|
||||
setting.difficulty.easy = makkelijk
|
||||
setting.difficulty.normal = normaal
|
||||
setting.difficulty.hard = hard
|
||||
setting.difficulty.hard = moeilijk
|
||||
setting.difficulty.insane = krankzinnig
|
||||
setting.difficulty.name = Moeilijkheidsgraad:
|
||||
setting.screenshake.name = Schuddend Scherm
|
||||
@@ -932,7 +932,7 @@ block.lancer.name = Lancer
|
||||
block.conveyor.name = Lopende Band
|
||||
block.titanium-conveyor.name = Titanium 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.router.name = Router
|
||||
block.distributor.name = Distributor
|
||||
@@ -1060,7 +1060,7 @@ unit.eradicator.name = Eradicator
|
||||
unit.lich.name = Lich
|
||||
unit.reaper.name = Reaper
|
||||
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.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.
|
||||
@@ -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.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.drillturret = Duo's hebben[accent] koperen ammonutie []nodig om te schieten.\nPlaatst 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.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.\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.unpause = 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.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.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.lead.description = A basic starter material. Used extensively in electronics and liquid transportation blocks.
|
||||
item.copper.description = Een nuttig materiaal voor gebouwen. Wordt erg vaak in blokken gebruikt.
|
||||
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.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.
|
||||
|
||||
|
Before Width: | Height: | Size: 758 B After Width: | Height: | Size: 751 B |
|
Before Width: | Height: | Size: 723 KiB After Width: | Height: | Size: 723 KiB |
|
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 900 KiB |
|
Before Width: | Height: | Size: 900 KiB After Width: | Height: | Size: 262 KiB |
@@ -19,46 +19,6 @@ import mindustry.world.Tile;
|
||||
public class Call {
|
||||
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) {
|
||||
if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)2;
|
||||
packet.type = (byte)0;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)3;
|
||||
packet.type = (byte)1;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)4;
|
||||
packet.type = (byte)2;
|
||||
TEMP_BUFFER.position(0);
|
||||
packet.writeLength = TEMP_BUFFER.position();
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)5;
|
||||
packet.type = (byte)3;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeBulletType(TEMP_BUFFER, type);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)6;
|
||||
packet.type = (byte)4;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putFloat(angle);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)7;
|
||||
packet.type = (byte)5;
|
||||
TEMP_BUFFER.position(0);
|
||||
packet.writeLength = TEMP_BUFFER.position();
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)8;
|
||||
packet.type = (byte)6;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, other);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)2;
|
||||
packet.type = (byte)9;
|
||||
packet.type = (byte)7;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putShort(amount);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)2;
|
||||
packet.type = (byte)9;
|
||||
packet.type = (byte)7;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putShort(amount);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)10;
|
||||
packet.type = (byte)8;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putInt(snapshotID);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)11;
|
||||
packet.type = (byte)9;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, ip);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)12;
|
||||
packet.type = (byte)10;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)13;
|
||||
packet.type = (byte)11;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)14;
|
||||
packet.type = (byte)12;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)2;
|
||||
packet.type = (byte)15;
|
||||
packet.type = (byte)13;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putShort(amount);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)16;
|
||||
packet.type = (byte)14;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, winner);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)17;
|
||||
packet.type = (byte)15;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)17;
|
||||
packet.type = (byte)15;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)18;
|
||||
packet.type = (byte)16;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)18;
|
||||
packet.type = (byte)16;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)19;
|
||||
packet.type = (byte)17;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)19;
|
||||
packet.type = (byte)17;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)1;
|
||||
packet.type = (byte)20;
|
||||
packet.type = (byte)18;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, reason);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)1;
|
||||
packet.type = (byte)21;
|
||||
packet.type = (byte)19;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeKick(TEMP_BUFFER, reason);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)22;
|
||||
packet.type = (byte)20;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, info);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)22;
|
||||
packet.type = (byte)20;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, info);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)23;
|
||||
packet.type = (byte)21;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)24;
|
||||
packet.type = (byte)22;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)25;
|
||||
packet.type = (byte)23;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putLong(time);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)26;
|
||||
packet.type = (byte)24;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putLong(time);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)27;
|
||||
packet.type = (byte)25;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putInt(playerid);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)28;
|
||||
packet.type = (byte)26;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putFloat(x);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)29;
|
||||
packet.type = (byte)27;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeRules(TEMP_BUFFER, rules);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)29;
|
||||
packet.type = (byte)27;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeRules(TEMP_BUFFER, rules);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)2;
|
||||
packet.type = (byte)30;
|
||||
packet.type = (byte)28;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putFloat(waveTime);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)31;
|
||||
packet.type = (byte)29;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)31;
|
||||
packet.type = (byte)29;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)32;
|
||||
packet.type = (byte)30;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)33;
|
||||
packet.type = (byte)31;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)34;
|
||||
packet.type = (byte)32;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)34;
|
||||
packet.type = (byte)32;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)35;
|
||||
packet.type = (byte)33;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)36;
|
||||
packet.type = (byte)34;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)37;
|
||||
packet.type = (byte)35;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)38;
|
||||
packet.type = (byte)36;
|
||||
TEMP_BUFFER.position(0);
|
||||
packet.writeLength = TEMP_BUFFER.position();
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)38;
|
||||
packet.type = (byte)36;
|
||||
TEMP_BUFFER.position(0);
|
||||
packet.writeLength = TEMP_BUFFER.position();
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)39;
|
||||
packet.type = (byte)37;
|
||||
TEMP_BUFFER.position(0);
|
||||
TEMP_BUFFER.putInt(x);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)40;
|
||||
packet.type = (byte)38;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)41;
|
||||
packet.type = (byte)39;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)41;
|
||||
packet.type = (byte)39;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)42;
|
||||
packet.type = (byte)40;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)42;
|
||||
packet.type = (byte)40;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)43;
|
||||
packet.type = (byte)41;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)44;
|
||||
packet.type = (byte)42;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)45;
|
||||
packet.type = (byte)43;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)45;
|
||||
packet.type = (byte)43;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeString(TEMP_BUFFER, message);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)46;
|
||||
packet.type = (byte)44;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)46;
|
||||
packet.type = (byte)44;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)47;
|
||||
packet.type = (byte)45;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)47;
|
||||
packet.type = (byte)45;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)48;
|
||||
packet.type = (byte)46;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile);
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)49;
|
||||
packet.type = (byte)47;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)49;
|
||||
packet.type = (byte)47;
|
||||
TEMP_BUFFER.position(0);
|
||||
if(mindustry.Vars.net.server()) {
|
||||
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,
|
||||
Tile tile) {
|
||||
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);
|
||||
packet.writeBuffer = TEMP_BUFFER;
|
||||
packet.priority = (byte)0;
|
||||
packet.type = (byte)50;
|
||||
packet.type = (byte)49;
|
||||
TEMP_BUFFER.position(0);
|
||||
mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item);
|
||||
TEMP_BUFFER.putInt(amount);
|
||||
@@ -1132,4 +1111,23 @@ public class Call {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ public class Bullets implements ContentList{
|
||||
}};
|
||||
|
||||
damageLightning = new BulletType(0.0001f, 0f){{
|
||||
lifetime = Lightning.lifetime;
|
||||
lifetime = Fx.lightning.lifetime;
|
||||
hitEffect = Fx.hitLancer;
|
||||
despawnEffect = Fx.none;
|
||||
status = StatusEffects.shocked;
|
||||
@@ -425,7 +425,8 @@ public class Bullets implements ContentList{
|
||||
if(Mathf.chance(0.04 * Time.delta())){
|
||||
Tile tile = world.tileWorld(b.x(), b.y());
|
||||
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){
|
||||
hitEffect.at(hitx, hity, colors[2]);
|
||||
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++){
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Damage{
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -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(){
|
||||
|
||||
if(useTree()){
|
||||
|
||||
@@ -51,6 +51,19 @@ public class Predict{
|
||||
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)}.
|
||||
*/
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package mindustry.entities;
|
||||
|
||||
/**
|
||||
* Marks an entity as serializable.
|
||||
*/
|
||||
public interface SaveTrait extends Saveable{
|
||||
byte version();
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class Units{
|
||||
* @return whether the target is invalid
|
||||
*/
|
||||
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)} */
|
||||
|
||||
@@ -47,12 +47,13 @@ public class LiquidBulletType extends BulletType{
|
||||
super.update(b);
|
||||
|
||||
if(liquid.canExtinguish()){
|
||||
//TODO implement
|
||||
Tile tile = world.tileWorld(b.x(), b.y());
|
||||
if(tile != null && Fire.has(tile.x, tile.y)){
|
||||
Fire.extinguish(tile, 100f);
|
||||
b.remove();
|
||||
hit(b);
|
||||
}
|
||||
//if(tile != null && Fire.has(tile.x, tile.y)){
|
||||
//Fire.extinguish(tile, 100f);
|
||||
// b.remove();
|
||||
// hit(b);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,13 +67,14 @@ public class LiquidBulletType extends BulletType{
|
||||
@Override
|
||||
public void hit(Bulletc b, float hitx, float hity){
|
||||
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){
|
||||
float intensity = 400f;
|
||||
Fire.extinguish(world.tileWorld(hitx, hity), intensity);
|
||||
//Fire.extinguish(world.tileWorld(hitx, hity), intensity);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ public class EntityComps{
|
||||
private UnitController controller;
|
||||
private UnitDef type;
|
||||
|
||||
@Override
|
||||
public int itemCapacity(){
|
||||
return type.itemCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float bounds(){
|
||||
return hitSize() * 2f;
|
||||
@@ -288,7 +293,7 @@ public class EntityComps{
|
||||
|
||||
@Component
|
||||
abstract class TimerComp{
|
||||
@ReadOnly Interval timer = new Interval(6);
|
||||
Interval timer = new Interval(6);
|
||||
|
||||
public boolean timer(int index, float time){
|
||||
return timer.get(index, time);
|
||||
@@ -433,11 +438,11 @@ public class EntityComps{
|
||||
}
|
||||
|
||||
@Component
|
||||
class RotComp{
|
||||
abstract class RotComp implements Entityc{
|
||||
float rotation;
|
||||
|
||||
void interpolate(){
|
||||
Syncc sync = (Syncc)this;
|
||||
Syncc sync = as(Syncc.class);
|
||||
|
||||
if(sync.interpolator().values.length > 0){
|
||||
rotation = sync.interpolator().values[0];
|
||||
@@ -446,7 +451,7 @@ public class EntityComps{
|
||||
}
|
||||
|
||||
@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 ObjectSet<Tile> tmpTiles = new ObjectSet<>();
|
||||
static int sleepingEntities = 0;
|
||||
@@ -460,7 +465,6 @@ public class EntityComps{
|
||||
LiquidModule liquids;
|
||||
ConsumeModule cons;
|
||||
|
||||
private Interval timer;
|
||||
private float timeScale = 1f, timeScaleDuration;
|
||||
|
||||
private @Nullable SoundLoop sound;
|
||||
@@ -481,7 +485,7 @@ public class EntityComps{
|
||||
|
||||
health(block.health);
|
||||
maxHealth(block.health);
|
||||
timer = new Interval(block.timers);
|
||||
timer(new Interval(block.timers));
|
||||
|
||||
if(shouldAdd){
|
||||
add();
|
||||
@@ -490,6 +494,12 @@ public class EntityComps{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBoost(float intensity, float duration){
|
||||
timeScale = Math.max(timeScale, intensity);
|
||||
timeScaleDuration = Math.max(timeScaleDuration, duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float timeScale(){
|
||||
return timeScale;
|
||||
@@ -505,11 +515,6 @@ public class EntityComps{
|
||||
cons.trigger();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean timer(int id, float time){
|
||||
return timer.get(id, time);
|
||||
}
|
||||
|
||||
/** Scaled delta. */
|
||||
@Override
|
||||
public float delta(){
|
||||
@@ -671,8 +676,10 @@ public class EntityComps{
|
||||
}
|
||||
|
||||
@Component
|
||||
abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
@Nullable Unitc unit;
|
||||
abstract static class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
private static final Unitc noUnit = GenericUnitEntity.create();
|
||||
|
||||
@NonNull @ReadOnly Unitc unit = noUnit;
|
||||
|
||||
@ReadOnly Team team = Team.sharded;
|
||||
String name = "noname";
|
||||
@@ -698,7 +705,7 @@ public class EntityComps{
|
||||
}
|
||||
|
||||
public void update(){
|
||||
if(unit != null){
|
||||
if(!dead()){
|
||||
x(unit.x());
|
||||
y(unit.y());
|
||||
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){
|
||||
if(unit == null) throw new IllegalArgumentException("Unit cannot be null. Use clearUnit() instead.");
|
||||
this.unit = unit;
|
||||
unit.team(team);
|
||||
if(unit != noUnit){
|
||||
unit.team(team);
|
||||
}
|
||||
}
|
||||
|
||||
boolean dead(){
|
||||
return unit == null;
|
||||
return unit == noUnit;
|
||||
}
|
||||
|
||||
String uuid(){
|
||||
@@ -1472,12 +1495,13 @@ public class EntityComps{
|
||||
}
|
||||
|
||||
@Component
|
||||
abstract class ItemsComp{
|
||||
abstract class ItemsComp implements Posc{
|
||||
@ReadOnly ItemStack stack = new ItemStack();
|
||||
|
||||
abstract int itemCapacity();
|
||||
|
||||
void update(){
|
||||
@Override
|
||||
public void update(){
|
||||
stack.amount = Mathf.clamp(stack.amount, 0, itemCapacity());
|
||||
}
|
||||
|
||||
@@ -1506,11 +1530,19 @@ public class EntityComps{
|
||||
stack.item = item;
|
||||
stack.amount = Mathf.clamp(stack.amount, 0, itemCapacity());
|
||||
}
|
||||
|
||||
int maxAccepted(Item item){
|
||||
return stack.item != item && stack.amount > 0 ? 0 : itemCapacity() - stack.amount;
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
abstract class MassComp implements Velc{
|
||||
float mass;
|
||||
float mass = 1f;
|
||||
|
||||
public void applyImpulse(float x, float y){
|
||||
vel().add(x / mass, y / mass);
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
|
||||
@@ -19,4 +19,7 @@ class EntityDefs{
|
||||
|
||||
@EntityDef({PlayerComp.class})
|
||||
class PlayerDef{}
|
||||
|
||||
@EntityDef({UnitComp.class})
|
||||
class GenericUnitDef{}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,8 @@ import mindustry.gen.*;
|
||||
public interface UnitController{
|
||||
void unit(Unitc unit);
|
||||
Unitc unit();
|
||||
|
||||
default void command(UnitCommand command){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,13 +67,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
//methods to override
|
||||
|
||||
@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;
|
||||
createItemTransfer(item, x, y, to, null);
|
||||
}
|
||||
|
||||
@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;
|
||||
createItemTransfer(item, x, y, to, () -> to.addItem(item));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class Placement{
|
||||
int nodeLimit = 1000;
|
||||
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);
|
||||
boolean found = false;
|
||||
while(!queue.isEmpty() && totalNodes++ < nodeLimit){
|
||||
|
||||
@@ -6,12 +6,10 @@ import arc.util.io.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.ctype.ContentType;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Teams.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.maps.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import java.io.*;
|
||||
@@ -188,10 +186,7 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
|
||||
if(tile.entity != null){
|
||||
try{
|
||||
readChunk(stream, true, in -> {
|
||||
byte version = in.readByte();
|
||||
tile.entity.read(in, version);
|
||||
});
|
||||
readChunk(stream, true, in -> tile.entity.read(in));
|
||||
}catch(Exception 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
|
||||
int groups = 0;
|
||||
|
||||
for(EntityGroup<?> group : entities.all()){
|
||||
if(!group.isEmpty() && group.all().get(0) instanceof SaveTrait){
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
stream.writeInt(Groups.sync.size());
|
||||
for(Syncc entity : Groups.sync){
|
||||
writeChunk(stream, true, out -> {
|
||||
out.writeByte(entity.classId());
|
||||
entity.write(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();
|
||||
for(int j = 0; j < amount; j++){
|
||||
//TODO throw exception on read fail
|
||||
readChunk(stream, true, in -> {
|
||||
byte typeid = in.readByte();
|
||||
byte version = in.readByte();
|
||||
SaveTrait trait = (SaveTrait)content.<TypeID>getByID(ContentType.typeid, typeid).constructor.get();
|
||||
trait.readSave(in, version);
|
||||
});
|
||||
}
|
||||
int amount = stream.readInt();
|
||||
for(int j = 0; j < amount; j++){
|
||||
readChunk(stream, true, in -> {
|
||||
byte typeid = in.readByte();
|
||||
Syncc sync = (Syncc)ClassMapping.map(typeid).get();
|
||||
sync.read(in);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package mindustry.io.versions;
|
||||
|
||||
import arc.func.*;
|
||||
import mindustry.entities.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class Save1 extends Save2{
|
||||
@@ -13,7 +10,8 @@ public class Save1 extends Save2{
|
||||
|
||||
@Override
|
||||
public void readEntities(DataInput stream) throws IOException{
|
||||
Prov[] table = LegacyTypeTable.getTable(lastReadBuild);
|
||||
//TODO implement
|
||||
//Prov[] table = LegacyTypeTable.getTable(lastReadBuild);
|
||||
|
||||
byte groups = stream.readByte();
|
||||
|
||||
@@ -23,8 +21,8 @@ public class Save1 extends Save2{
|
||||
readChunk(stream, true, in -> {
|
||||
byte typeid = in.readByte();
|
||||
byte version = in.readByte();
|
||||
SaveTrait trait = (SaveTrait)table[typeid].get();
|
||||
trait.readSave(in, version);
|
||||
//SaveTrait trait = (SaveTrait)table[typeid].get();
|
||||
//trait.readSave(in, version);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package mindustry.io.versions;
|
||||
|
||||
import mindustry.ctype.ContentType;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.io.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import static mindustry.Vars.content;
|
||||
|
||||
public class Save2 extends SaveVersion{
|
||||
|
||||
public Save2(){
|
||||
@@ -16,6 +12,7 @@ public class Save2 extends SaveVersion{
|
||||
|
||||
@Override
|
||||
public void readEntities(DataInput stream) throws IOException{
|
||||
//TODO implement
|
||||
byte groups = stream.readByte();
|
||||
|
||||
for(int i = 0; i < groups; i++){
|
||||
@@ -25,8 +22,8 @@ public class Save2 extends SaveVersion{
|
||||
readChunk(stream, true, in -> {
|
||||
byte typeid = in.readByte();
|
||||
byte version = in.readByte();
|
||||
SaveTrait trait = (SaveTrait)content.<TypeID>getByID(ContentType.typeid, typeid).constructor.get();
|
||||
trait.readSave(in, version);
|
||||
//SaveTrait trait = (SaveTrait)content.<TypeID>getByID(ContentType.typeid, typeid).constructor.get();
|
||||
//trait.readSave(in, version);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class RandomItemFilter extends GenerateFilter{
|
||||
if(tile.block() instanceof StorageBlock && !(tile.block() instanceof CoreBlock)){
|
||||
for(ItemStack stack : drops){
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public abstract class BasicGenerator extends RandomGenerator{
|
||||
Tile end = tiles.getn(endX, endY);
|
||||
GridBits closed = new GridBits(width, height);
|
||||
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);
|
||||
boolean found = false;
|
||||
while(!queue.isEmpty()){
|
||||
|
||||
@@ -4,11 +4,11 @@ import arc.*;
|
||||
import arc.assets.*;
|
||||
import arc.audio.*;
|
||||
import arc.audio.mock.*;
|
||||
import arc.struct.Array;
|
||||
import arc.struct.*;
|
||||
import arc.files.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.struct.Array;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.*;
|
||||
import arc.util.serialization.*;
|
||||
@@ -18,9 +18,8 @@ import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.content.TechTree.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.Effects.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Objectives.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -275,13 +274,14 @@ public class ContentParser{
|
||||
|
||||
return block;
|
||||
},
|
||||
ContentType.unit, (TypeParser<UnitType>)(mod, name, value) -> {
|
||||
ContentType.unit, (TypeParser<UnitDef>)(mod, name, value) -> {
|
||||
readBundle(ContentType.unit, name, value);
|
||||
|
||||
UnitType unit;
|
||||
//TODO fix
|
||||
UnitDef unit;
|
||||
if(locate(ContentType.unit, name) == null){
|
||||
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{
|
||||
unit = locate(ContentType.unit, name);
|
||||
}
|
||||
@@ -293,7 +293,6 @@ public class ContentParser{
|
||||
},
|
||||
ContentType.item, parser(ContentType.item, Item::new),
|
||||
ContentType.liquid, parser(ContentType.liquid, Liquid::new),
|
||||
ContentType.mech, parser(ContentType.mech, Mech::new),
|
||||
ContentType.zone, parser(ContentType.zone, Zone::new)
|
||||
);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import arc.util.serialization.JsonValue.*;
|
||||
import arc.util.serialization.JsonWriter.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.*;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class NetworkIO{
|
||||
stream.writeInt(state.wave);
|
||||
stream.writeFloat(state.wavetime);
|
||||
|
||||
stream.writeInt(player.id);
|
||||
stream.writeInt(player.id());
|
||||
player.write(stream);
|
||||
|
||||
SaveIO.getSaveWriter().writeContentHeader(stream);
|
||||
@@ -45,11 +45,11 @@ public class NetworkIO{
|
||||
state.wave = stream.readInt();
|
||||
state.wavetime = stream.readFloat();
|
||||
|
||||
entities.clear();
|
||||
Groups.all.clear();
|
||||
int id = stream.readInt();
|
||||
player.resetNoAdd();
|
||||
player.reset();
|
||||
player.read(stream);
|
||||
player.resetID(id);
|
||||
player.id(id);
|
||||
player.add();
|
||||
|
||||
SaveIO.getSaveWriter().readContentHeader(stream);
|
||||
|
||||
@@ -53,9 +53,9 @@ public class ItemsDisplay extends Table{
|
||||
private String format(Item item){
|
||||
builder.setLength(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(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();
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ public class AdminsDialog extends FloatingDialog{
|
||||
res.addImageButton(Icon.cancel, () -> {
|
||||
ui.showConfirm("$confirm", "$confirmunadmin", () -> {
|
||||
netServer.admins.unAdminPlayer(info.id);
|
||||
Groups.player.all().each(player -> {
|
||||
if(player != null && player.uuid != null && player.uuid.equals(info.id)){
|
||||
player.isAdmin = false;
|
||||
Groups.player.each(player -> {
|
||||
if(player != null && !player.isLocal() && player.uuid().equals(info.id)){
|
||||
player.admin(false);
|
||||
}
|
||||
});
|
||||
setup();
|
||||
|
||||
@@ -122,7 +122,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
setFilter(TextureFilter.Linear);
|
||||
}}){{
|
||||
float[] time = {0};
|
||||
setColor(Color.gray(0.3f));
|
||||
setColor(Color.grays(0.3f));
|
||||
setScale(1.5f);
|
||||
update(() -> {
|
||||
setOrigin(Align.center);
|
||||
@@ -140,7 +140,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
Stack sub = new Stack();
|
||||
|
||||
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 -> {
|
||||
//TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class HostDialog extends FloatingDialog{
|
||||
cont.table(t -> {
|
||||
t.add("$name").padRight(10);
|
||||
t.addField(Core.settings.getString("name"), text -> {
|
||||
player.name = text;
|
||||
player.name(text);
|
||||
Core.settings.put("name", text);
|
||||
Core.settings.save();
|
||||
ui.listfrag.rebuild();
|
||||
@@ -32,12 +32,12 @@ public class HostDialog extends FloatingDialog{
|
||||
|
||||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
new PaletteDialog().show(color -> {
|
||||
player.color.set(color);
|
||||
player.color().set(color);
|
||||
Core.settings.put("color-0", Color.rgba8888(color));
|
||||
Core.settings.save();
|
||||
});
|
||||
}).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);
|
||||
|
||||
cont.row();
|
||||
@@ -67,7 +67,7 @@ public class HostDialog extends FloatingDialog{
|
||||
Time.runTask(5f, () -> {
|
||||
try{
|
||||
net.host(Vars.port);
|
||||
player.isAdmin = true;
|
||||
player.admin(true);
|
||||
|
||||
if(steam){
|
||||
Core.app.post(() -> Core.settings.getBoolOnce("steampublic2", () -> {
|
||||
|
||||
@@ -248,22 +248,22 @@ public class JoinDialog extends FloatingDialog{
|
||||
t.add("$name").padRight(10);
|
||||
if(!steam){
|
||||
t.addField(Core.settings.getString("name"), text -> {
|
||||
player.name = text;
|
||||
player.name(text);
|
||||
Core.settings.put("name", text);
|
||||
Core.settings.save();
|
||||
}).grow().pad(8).get().setMaxLength(maxNameLength);
|
||||
}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, () -> {
|
||||
new PaletteDialog().show(color -> {
|
||||
player.color.set(color);
|
||||
player.color().set(color);
|
||||
Core.settings.put("color-0", Color.rgba8888(color));
|
||||
Core.settings.save();
|
||||
});
|
||||
}).size(54f).get();
|
||||
button.update(() -> button.getStyle().imageUpColor = player.color);
|
||||
button.update(() -> button.getStyle().imageUpColor = player.color());
|
||||
}).width(w).height(70f).pad(4);
|
||||
cont.row();
|
||||
cont.add(pane).width(w + 38).pad(0);
|
||||
@@ -335,7 +335,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
public void connect(String ip, int port){
|
||||
if(player.name.trim().isEmpty()){
|
||||
if(player.name().trim().isEmpty()){
|
||||
ui.showInfo("$noname");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class PaletteDialog extends Dialog{
|
||||
cons.get(color);
|
||||
hide();
|
||||
}).size(48).get();
|
||||
button.setChecked(player.color.equals(color));
|
||||
button.setChecked(player.color().equals(color));
|
||||
button.getStyle().imageUpColor = color;
|
||||
|
||||
if(i % 4 == 3){
|
||||
|
||||
@@ -16,7 +16,6 @@ import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.net.Administration.*;
|
||||
@@ -39,7 +38,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
||||
public static void requestItem(Playerc player, Tile tile, Item item, int amount){
|
||||
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;
|
||||
|
||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||
@@ -50,10 +49,10 @@ public class BlockInventoryFragment extends Fragment{
|
||||
|
||||
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));
|
||||
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();
|
||||
|
||||
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);
|
||||
holding = false;
|
||||
holdTime = 0f;
|
||||
@@ -140,7 +139,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
|
||||
container.add(i);
|
||||
|
||||
Boolp canPick = () -> player.acceptsItem(item) && !state.isPaused();
|
||||
Boolp canPick = () -> player.unit().acceptsItem(item) && !state.isPaused();
|
||||
|
||||
HandCursorListener l = new HandCursorListener();
|
||||
l.setEnabled(canPick);
|
||||
@@ -157,7 +156,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
@Override
|
||||
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;
|
||||
int amount = Math.min(1, player.maxAccepted(item));
|
||||
int amount = Math.min(1, player.unit().maxAccepted(item));
|
||||
if(amount > 0){
|
||||
Call.requestItem(player, tile, item, amount);
|
||||
lastItem = item;
|
||||
|
||||
@@ -65,11 +65,11 @@ public class PlayerListFragment extends Fragment{
|
||||
|
||||
float h = 74f;
|
||||
|
||||
Groups.player.all().sort(Structs.comparing(Unitc::team));
|
||||
Groups.player.all().each(user -> {
|
||||
NetConnection connection = user.con;
|
||||
Groups.player.sort(Structs.comparing(Playerc::team));
|
||||
Groups.player.each(user -> {
|
||||
NetConnection connection = user.con();
|
||||
|
||||
if(connection == null && net.server() && !user.isLocal) return;
|
||||
if(connection == null && net.server() && !user.isLocal()) return;
|
||||
|
||||
Table button = new Table();
|
||||
button.left();
|
||||
@@ -87,15 +87,16 @@ public class PlayerListFragment extends Fragment{
|
||||
}
|
||||
};
|
||||
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.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.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();
|
||||
|
||||
float bs = (h) / 2f;
|
||||
@@ -113,27 +114,27 @@ public class PlayerListFragment extends Fragment{
|
||||
t.addImageButton(Icon.admin, Styles.clearTogglePartiali, () -> {
|
||||
if(net.client()) return;
|
||||
|
||||
String id = user.uuid;
|
||||
String id = user.uuid();
|
||||
|
||||
if(netServer.admins.isAdmin(id, connection.address)){
|
||||
ui.showConfirm("$confirm", "$confirmunadmin", () -> netServer.admins.unAdminPlayer(id));
|
||||
}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())
|
||||
.touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled)
|
||||
.checked(user.isAdmin);
|
||||
.checked(user.admin());
|
||||
|
||||
t.addImageButton(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace));
|
||||
|
||||
}).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.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);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Build{
|
||||
|
||||
tile.set(sub, team, rotation);
|
||||
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)));
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class Build{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ public class CachedTile extends Tile{
|
||||
|
||||
if(block.hasEntity()){
|
||||
Tilec n = block.newEntity();
|
||||
n.cons = new ConsumeModule(entity);
|
||||
n.tile = this;
|
||||
n.block = block;
|
||||
if(block.hasItems) n.items = new ItemModule();
|
||||
if(block.hasLiquids) n.liquids = new LiquidModule();
|
||||
if(block.hasPower) n.power = new PowerModule();
|
||||
n.cons(new ConsumeModule(entity));
|
||||
n.tile(this);
|
||||
n.block(block);
|
||||
if(block.hasItems) n.items(new ItemModule());
|
||||
if(block.hasLiquids) n.liquids(new LiquidModule());
|
||||
if(block.hasPower) n.power(new PowerModule());
|
||||
entity = n;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
package mindustry.world.blocks;
|
||||
|
||||
import arc.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import arc.Graphics.*;
|
||||
import arc.Graphics.Cursor.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
@@ -66,10 +64,10 @@ public class BuildBlock extends Block{
|
||||
float healthf = tile.entity == null ? 1f : tile.entity.healthf();
|
||||
tile.set(block, team, rotation);
|
||||
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()
|
||||
if(!headless && builderID == player.id){
|
||||
if(!headless && builderID == player.id()){
|
||||
if(!skipConfig){
|
||||
tile.block().playerPlaced(tile);
|
||||
}
|
||||
@@ -141,6 +139,8 @@ public class BuildBlock extends Block{
|
||||
public void tapped(Tile tile, Playerc player){
|
||||
BuildEntity entity = tile.ent();
|
||||
|
||||
//TODO building
|
||||
/*
|
||||
//if the target is constructible, begin constructing
|
||||
if(entity.cblock != null){
|
||||
if(player.buildWasAutoPaused && !player.isBuilding){
|
||||
@@ -148,7 +148,7 @@ public class BuildBlock extends Block{
|
||||
}
|
||||
//player.clearBuilding();
|
||||
player.addBuildRequest(new BuildRequest(tile.x, tile.y, tile.rotation(), entity.cblock), false);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,7 +156,8 @@ public class BuildBlock extends Block{
|
||||
Fx.blockExplosionSmoke.at(tile);
|
||||
|
||||
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);
|
||||
|
||||
progress = Mathf.clamp(progress + maxProgress);
|
||||
builderID = builder.getId();
|
||||
builderID = builder.id();
|
||||
|
||||
if(progress >= 1f || state.rules.infiniteResources){
|
||||
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(core != null){
|
||||
int accepting = core.tile.block().acceptStack(requirements[i].item, accumulated, core.tile, builder);
|
||||
core.tile.block().handleStack(requirements[i].item, accepting, 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);
|
||||
accumulator[i] -= accepting;
|
||||
}else{
|
||||
accumulator[i] -= accumulated;
|
||||
@@ -280,7 +281,7 @@ public class BuildBlock extends Block{
|
||||
progress = Mathf.clamp(progress - amount);
|
||||
|
||||
if(builder instanceof Playerc){
|
||||
builderID = builder.getID();
|
||||
builderID = builder.id();
|
||||
}
|
||||
|
||||
if(progress <= 0 || state.rules.infiniteResources){
|
||||
|
||||
@@ -89,7 +89,7 @@ public class OverdriveProjector extends Block{
|
||||
float realBoost = (speedBoost + entity.phaseHeat * speedBoostPhase) * entity.efficiency();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ArtilleryTurret extends ItemTurret{
|
||||
float maxTraveled = type.lifetime * type.speed;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ItemTurret extends CooledTurret{
|
||||
}
|
||||
|
||||
@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();
|
||||
|
||||
BulletType type = ammo.get(item);
|
||||
@@ -97,7 +97,7 @@ public class ItemTurret extends CooledTurret{
|
||||
}
|
||||
|
||||
@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++){
|
||||
handleItem(item, tile, null);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
if(entity.bulletLife > 0 && entity.bullet != null){
|
||||
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.time(0f);
|
||||
entity.heat = 1f;
|
||||
@@ -95,7 +95,7 @@ public class LaserTurret extends PowerTurret{
|
||||
protected void bullet(Tile tile, BulletType type, float angle){
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,8 @@ public class LiquidTurret extends Turret{
|
||||
protected boolean validateTarget(Tile tile){
|
||||
TurretEntity entity = tile.ent();
|
||||
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);
|
||||
}
|
||||
@@ -83,10 +84,10 @@ public class LiquidTurret extends Turret{
|
||||
int tr = (int)(range / tilesize);
|
||||
for(int x = -tr; x <= tr; x++){
|
||||
for(int y = -tr; y <= tr; y++){
|
||||
if(Fire.has(x + tile.x, y + tile.y)){
|
||||
entity.target = world.tile(x + tile.x, y + tile.y);
|
||||
return;
|
||||
}
|
||||
//if(Fire.has(x + tile.x, y + tile.y)){
|
||||
// entity.target = world.tile(x + tile.x, y + tile.y);
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,9 +191,9 @@ public abstract class Turret extends Block{
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
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{
|
||||
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){
|
||||
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){
|
||||
@@ -329,10 +329,8 @@ public abstract class Turret extends Block{
|
||||
@Override
|
||||
public void read(DataInput stream) throws IOException{
|
||||
super.read(stream);
|
||||
if(revision == 1){
|
||||
reload = stream.readFloat();
|
||||
rotation = stream.readFloat();
|
||||
}
|
||||
reload = stream.readFloat();
|
||||
rotation = stream.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -72,7 +72,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
ConveyorEntity entity = tile.ent();
|
||||
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(),
|
||||
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){
|
||||
entity.next = tile.front().entity;
|
||||
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;
|
||||
|
||||
if(Math.abs(tx) > Math.abs(ty)){
|
||||
centery = Mathf.clamp((tile.worldy() - unit.y) / centerDstScl, -centerSpeed, centerSpeed);
|
||||
if(Math.abs(tile.worldy() - unit.y) < 1f) centery = 0f;
|
||||
centery = Mathf.clamp((tile.worldy() - unit.y()) / centerDstScl, -centerSpeed, centerSpeed);
|
||||
if(Math.abs(tile.worldy() - unit.y()) < 1f) centery = 0f;
|
||||
}else{
|
||||
centerx = Mathf.clamp((tile.worldx() - unit.x) / centerDstScl, -centerSpeed, centerSpeed);
|
||||
if(Math.abs(tile.worldx() - unit.x) < 1f) centerx = 0f;
|
||||
centerx = Mathf.clamp((tile.worldx() - unit.x()) / centerDstScl, -centerSpeed, centerSpeed);
|
||||
if(Math.abs(tile.worldx() - unit.x()) < 1f) centerx = 0f;
|
||||
}
|
||||
|
||||
if(entity.len * itemSpace < 0.9f){
|
||||
@@ -179,7 +179,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
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--){
|
||||
float nextpos = (i == e.len - 1 ? 100f : e.ys[i + 1]) - itemSpace;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Junction extends Block{
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package mindustry.world.blocks.distribution;
|
||||
|
||||
import arc.math.Mathf;
|
||||
import arc.util.Time;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.Item;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.BlockGroup;
|
||||
|
||||
import java.io.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
public class OverflowGate extends Block{
|
||||
public float speed = 1f;
|
||||
@@ -117,23 +115,5 @@ public class OverflowGate extends Block{
|
||||
Item lastItem;
|
||||
Tile lastInput;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,9 +162,6 @@ public class Sorter extends Block{
|
||||
public void read(DataInput stream) throws IOException{
|
||||
super.read(stream);
|
||||
sortItem = content.item(stream.readShort());
|
||||
if(revision == 1){
|
||||
new DirectionalItemBuffer(20, 45f).read(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
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)){
|
||||
tryMoveLiquid(tile, tile.getNearby(tile.rotation()), leakResistance, tile.entity.liquids().current());
|
||||
|
||||
@@ -28,7 +28,7 @@ public class LiquidBridge extends ItemBridge{
|
||||
|
||||
Tile other = world.tile(entity.link);
|
||||
if(!linkValid(tile, other)){
|
||||
tryDumpLiquid(tile, entity.getLiquids().current());
|
||||
tryDumpLiquid(tile, entity.liquids().current());
|
||||
}else{
|
||||
((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(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);
|
||||
}else{
|
||||
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
||||
|
||||
Tile other = world.tile(entity.link);
|
||||
if(!linkValid(tile, other)){
|
||||
tryDumpLiquid(tile, entity.getLiquids().current());
|
||||
tryDumpLiquid(tile, entity.liquids().current());
|
||||
}else{
|
||||
((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(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);
|
||||
}else{
|
||||
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
|
||||
bars.add("poweroutput", entity -> new Bar(() ->
|
||||
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,
|
||||
() -> ((GeneratorEntity)entity).productionEfficiency));
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
Events.fire(Trigger.impactPower);
|
||||
}
|
||||
|
||||
if(entity.timer(timerUse, itemDuration / entity.timeScale)){
|
||||
if(entity.timer(timerUse, itemDuration / entity.timeScale())){
|
||||
entity.consume();
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -86,7 +86,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
if(fuel > 0){
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ public class PowerDiode extends Block{
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
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("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())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class PowerGenerator extends PowerDistributor{
|
||||
if(hasPower && outputsPower && !consumes.hasPower()){
|
||||
bars.add("power", entity -> new Bar(() ->
|
||||
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,
|
||||
() -> ((GeneratorEntity)entity).productionEfficiency));
|
||||
}
|
||||
|
||||
@@ -41,11 +41,11 @@ public class PowerNode extends PowerBlock{
|
||||
public void configured(Tile tile, Playerc player, int value){
|
||||
Tilec entity = tile.entity;
|
||||
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){
|
||||
//unlink
|
||||
entity.getPower().links.removeValue(value);
|
||||
entity.power().links.removeValue(value);
|
||||
if(valid) other.entity.power().links.removeValue(tile.pos());
|
||||
|
||||
PowerGraph newgraph = new PowerGraph();
|
||||
@@ -59,10 +59,10 @@ public class PowerNode extends PowerBlock{
|
||||
//reflow from other end
|
||||
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())){
|
||||
entity.getPower().links.add(other.pos());
|
||||
if(!entity.power().links.contains(other.pos())){
|
||||
entity.power().links.add(other.pos());
|
||||
}
|
||||
|
||||
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{
|
||||
while(entity.getPower().links.size > 0){
|
||||
tile.configure(entity.getPower().links.get(0));
|
||||
while(entity.power().links.size > 0){
|
||||
tile.configure(entity.power().links.get(0));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -267,8 +267,8 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
Tilec entity = tile.ent();
|
||||
|
||||
for(int i = 0; i < entity.getPower().links.size; i++){
|
||||
Tile link = world.tile(entity.getPower().links.get(i));
|
||||
for(int i = 0; i < entity.power().links.size; i++){
|
||||
Tile link = world.tile(entity.power().links.get(i));
|
||||
|
||||
if(!linkValid(tile, link)) continue;
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ public class LaunchPad extends StorageBlock{
|
||||
public void draw(Tile 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;
|
||||
|
||||
Lines.stroke(2f);
|
||||
@@ -72,7 +73,7 @@ public class LaunchPad extends StorageBlock{
|
||||
public void update(Tile tile){
|
||||
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()){
|
||||
Events.fire(Trigger.itemLaunch);
|
||||
Fx.padlaunch.at(tile);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Unloader extends Block{
|
||||
public void update(Tile tile){
|
||||
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()){
|
||||
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))){
|
||||
|
||||
@@ -57,7 +57,7 @@ public class CommandCenter extends Block{
|
||||
ObjectSet<Tile> set = indexer.getAllied(tile.team(), BlockFlag.comandCenter);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ public class CommandCenter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput stream, byte version) throws IOException{
|
||||
super.read(stream, version);
|
||||
public void read(DataInput stream) throws IOException{
|
||||
super.read(stream);
|
||||
command = UnitCommand.all[stream.readByte()];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
package mindustry.world.blocks.units;
|
||||
|
||||
import arc.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import arc.struct.EnumSet;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
//TODO remove
|
||||
public class MechPad extends Block{
|
||||
public @NonNull UnitDef mech;
|
||||
public float buildTime = 60 * 5;
|
||||
@@ -50,7 +47,7 @@ public class MechPad extends Block{
|
||||
MechFactoryEntity entity = tile.ent();
|
||||
|
||||
if(!entity.consValid()) return;
|
||||
player.beginRespawning(entity);
|
||||
//player.beginRespawning(entity);
|
||||
entity.sameMech = false;
|
||||
}
|
||||
|
||||
@@ -63,24 +60,24 @@ public class MechPad extends Block{
|
||||
Fx.spawn.at(entity);
|
||||
|
||||
if(entity.player == null) return;
|
||||
Mech mech = ((MechPad)tile.block()).mech;
|
||||
boolean resetSpawner = !entity.sameMech && entity.player.mech == mech;
|
||||
entity.player.mech = !entity.sameMech && entity.player.mech == mech ? UnitTypes.starter : mech;
|
||||
//Mech mech = ((MechPad)tile.block()).mech;
|
||||
//boolean resetSpawner = !entity.sameMech && entity.player.mech == mech;
|
||||
//entity.player.mech = !entity.sameMech && entity.player.mech == mech ? UnitTypes.starter : mech;
|
||||
|
||||
Playerc player = entity.player;
|
||||
|
||||
entity.progress = 0;
|
||||
entity.player.onRespawn(tile);
|
||||
if(resetSpawner) entity.player.lastSpawner = null;
|
||||
entity.player = null;
|
||||
//entity.progress = 0;
|
||||
//entity.player.onRespawn(tile);
|
||||
//if(resetSpawner) entity.player.lastSpawner = 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){
|
||||
MechFactoryEntity entity = tile.ent();
|
||||
return !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;
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,7 +98,8 @@ public class MechPad extends Block{
|
||||
Call.onMechFactoryTap(player, tile);
|
||||
}else if(player.isLocal() && mobile && !player.dead() && entity.consValid() && entity.player == null){
|
||||
//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();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class RepairPoint extends Block{
|
||||
Draw.color(Color.valueOf("e8ffd7"));
|
||||
Drawf.laser(laser, laserEnd,
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -110,11 +110,10 @@ public class RepairPoint extends Block{
|
||||
RepairPointEntity entity = tile.ent();
|
||||
|
||||
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;
|
||||
}else if(entity.target != null && entity.consValid()){
|
||||
entity.target.health += repairSpeed * Time.delta() * entity.strength * entity.efficiency();
|
||||
entity.target.clampHealth();
|
||||
entity.target.heal(repairSpeed * Time.delta() * entity.strength * entity.efficiency());
|
||||
entity.rotation = Mathf.slerpDelta(entity.rotation, entity.angleTo(entity.target), 0.5f);
|
||||
targetIsBeingRepaired = true;
|
||||
}
|
||||
@@ -127,8 +126,7 @@ public class RepairPoint extends Block{
|
||||
|
||||
if(entity.timer(timerTarget, 20)){
|
||||
rect.setSize(repairRadius * 2).setCenter(tile.drawx(), tile.drawy());
|
||||
entity.target = Units.closest(tile.team(), tile.drawx(), tile.drawy(), repairRadius,
|
||||
unit -> unit.health < unit.maxHealth());
|
||||
entity.target = Units.closest(tile.team(), tile.drawx(), tile.drawy(), repairRadius, Unitc::damaged);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ public class ConsumeLiquid extends ConsumeLiquidBase{
|
||||
|
||||
@Override
|
||||
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
|
||||
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
|
||||
|
||||
@@ -23,6 +23,6 @@ public abstract class ConsumeLiquidBase extends Consume{
|
||||
}
|
||||
|
||||
protected float use(Tilec entity){
|
||||
return Math.min(amount * entity.delta(), entity.block.liquidCapacity);
|
||||
return Math.min(amount * entity.delta(), entity.block().liquidCapacity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ConsumePower extends Consume{
|
||||
|
||||
@Override
|
||||
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
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ConsumeModule extends BlockModule{
|
||||
|
||||
public void update(){
|
||||
//everything is valid here
|
||||
if(entity.tile.isEnemyCheat()){
|
||||
if(entity.tile().isEnemyCheat()){
|
||||
valid = optionalValid = true;
|
||||
return;
|
||||
}
|
||||
@@ -23,9 +23,9 @@ public class ConsumeModule extends BlockModule{
|
||||
boolean prevValid = valid();
|
||||
valid = 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(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
|
||||
@@ -35,7 +35,7 @@ public class ConsumeModule extends BlockModule{
|
||||
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)){
|
||||
cons.update(entity);
|
||||
}
|
||||
@@ -45,13 +45,13 @@ public class ConsumeModule extends BlockModule{
|
||||
}
|
||||
|
||||
public void trigger(){
|
||||
for(Consume cons : entity.block.consumes.all()){
|
||||
for(Consume cons : entity.block().consumes.all()){
|
||||
cons.trigger(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean valid(){
|
||||
return valid && entity.block.shouldConsume(entity.tile);
|
||||
return valid && entity.block().shouldConsume(entity.tile());
|
||||
}
|
||||
|
||||
public boolean optionalValid(){
|
||||
|
||||
@@ -12,6 +12,9 @@ public class ItemModule extends BlockModule{
|
||||
private int[] items = new int[content.items().size];
|
||||
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){
|
||||
for(int i = 0; i < items.length; i++){
|
||||
if(items[i] > 0){
|
||||
@@ -68,10 +71,13 @@ public class ItemModule extends BlockModule{
|
||||
|
||||
public Item take(){
|
||||
for(int i = 0; i < items.length; i++){
|
||||
if(items[i] > 0){
|
||||
items[i]--;
|
||||
total--;
|
||||
return content.item(i);
|
||||
int index = (i + takeRotation);
|
||||
if(index >= items.length) index -= items.length; //conditional instead of mod
|
||||
if(items[index] > 0){
|
||||
items[index] --;
|
||||
total --;
|
||||
takeRotation = index + 1;
|
||||
return content.item(index % items.length);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -50,6 +50,6 @@ public class DirectConsumerTests extends PowerTestFixture{
|
||||
consumerTile.entity.update();
|
||||
graph.update();
|
||||
|
||||
assertEquals(expectedSatisfaction, consumertile.entity.getPower().status);
|
||||
assertEquals(expectedSatisfaction, consumertile.entity.power().status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class PowerTests extends PowerTestFixture{
|
||||
|
||||
// Update and check for the expected power status of the consumer
|
||||
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;
|
||||
Tile batteryTile = createFakeTile(0, 2, createFakeBattery(maxCapacity));
|
||||
batterytile.entity.getPower().status = initialBatteryCapacity / maxCapacity;
|
||||
batterytile.entity.power().status = initialBatteryCapacity / maxCapacity;
|
||||
|
||||
powerGraph.add(batteryTile);
|
||||
|
||||
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){
|
||||
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.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.add(consumerTile);
|
||||
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()){
|
||||
ConsumePower consumePower = consumerTile.block().consumes.getPower();
|
||||
assertFalse(consumePower.valid(consumerTile.ent()));
|
||||
|
||||