diff --git a/core/assets-raw/sprites/units/conquer-cell.png b/core/assets-raw/sprites/units/conquer-cell.png index e7e350d5ec..07d08e545f 100644 Binary files a/core/assets-raw/sprites/units/conquer-cell.png and b/core/assets-raw/sprites/units/conquer-cell.png differ diff --git a/core/assets-raw/sprites/units/conquer-glow.png b/core/assets-raw/sprites/units/conquer-glow.png index 3e79f202b3..b1374eb85a 100644 Binary files a/core/assets-raw/sprites/units/conquer-glow.png and b/core/assets-raw/sprites/units/conquer-glow.png differ diff --git a/core/assets-raw/sprites/units/conquer.aseprite b/core/assets-raw/sprites/units/conquer.aseprite index 277e406fa9..e1a86d0650 100644 Binary files a/core/assets-raw/sprites/units/conquer.aseprite and b/core/assets-raw/sprites/units/conquer.aseprite differ diff --git a/core/assets-raw/sprites/units/conquer.png b/core/assets-raw/sprites/units/conquer.png index aa349920a5..d7f4c333eb 100644 Binary files a/core/assets-raw/sprites/units/conquer.png and b/core/assets-raw/sprites/units/conquer.png differ diff --git a/core/assets-raw/sprites/units/weapons/conquer-weapon-glow.png b/core/assets-raw/sprites/units/weapons/conquer-weapon-glow.png new file mode 100644 index 0000000000..0d00463db2 Binary files /dev/null and b/core/assets-raw/sprites/units/weapons/conquer-weapon-glow.png differ diff --git a/core/assets-raw/sprites/units/weapons/conquer-weapon.png b/core/assets-raw/sprites/units/weapons/conquer-weapon.png index 7a8ecca09b..32aad4fecd 100644 Binary files a/core/assets-raw/sprites/units/weapons/conquer-weapon.png and b/core/assets-raw/sprites/units/weapons/conquer-weapon.png differ diff --git a/core/assets-raw/sprites/units/weapons/vanquish-weapon-old.png b/core/assets-raw/sprites/units/weapons/vanquish-weapon-old.png deleted file mode 100644 index 7a98d2a6c8..0000000000 Binary files a/core/assets-raw/sprites/units/weapons/vanquish-weapon-old.png and /dev/null differ diff --git a/core/assets/scripts/global.js b/core/assets/scripts/global.js index bcc2247d9f..f4ebebe16f 100755 --- a/core/assets/scripts/global.js +++ b/core/assets/scripts/global.js @@ -107,6 +107,7 @@ importPackage(Packages.mindustry.net) importPackage(Packages.mindustry.service) importPackage(Packages.mindustry.type) importPackage(Packages.mindustry.type.ammo) +importPackage(Packages.mindustry.type.unit) importPackage(Packages.mindustry.type.weapons) importPackage(Packages.mindustry.type.weather) importPackage(Packages.mindustry.ui) @@ -121,6 +122,7 @@ importPackage(Packages.mindustry.world.blocks.defense.turrets) importPackage(Packages.mindustry.world.blocks.distribution) importPackage(Packages.mindustry.world.blocks.environment) importPackage(Packages.mindustry.world.blocks.experimental) +importPackage(Packages.mindustry.world.blocks.heat) importPackage(Packages.mindustry.world.blocks.legacy) importPackage(Packages.mindustry.world.blocks.liquid) importPackage(Packages.mindustry.world.blocks.logic) @@ -134,6 +136,7 @@ importPackage(Packages.mindustry.world.consumers) importPackage(Packages.mindustry.world.draw) importPackage(Packages.mindustry.world.meta) importPackage(Packages.mindustry.world.modules) +const AdminRequestEvent = Packages.mindustry.game.EventType.AdminRequestEvent const PlayerIpUnbanEvent = Packages.mindustry.game.EventType.PlayerIpUnbanEvent const PlayerIpBanEvent = Packages.mindustry.game.EventType.PlayerIpBanEvent const PlayerUnbanEvent = Packages.mindustry.game.EventType.PlayerUnbanEvent @@ -141,10 +144,12 @@ const PlayerBanEvent = Packages.mindustry.game.EventType.PlayerBanEvent const PlayerLeave = Packages.mindustry.game.EventType.PlayerLeave const PlayerConnect = Packages.mindustry.game.EventType.PlayerConnect const PlayerJoin = Packages.mindustry.game.EventType.PlayerJoin +const PlayerConnectionConfirmed = Packages.mindustry.game.EventType.PlayerConnectionConfirmed const ConnectPacketEvent = Packages.mindustry.game.EventType.ConnectPacketEvent const ConnectionEvent = Packages.mindustry.game.EventType.ConnectionEvent const UnitChangeEvent = Packages.mindustry.game.EventType.UnitChangeEvent const UnitUnloadEvent = Packages.mindustry.game.EventType.UnitUnloadEvent +const UnitSpawnEvent = Packages.mindustry.game.EventType.UnitSpawnEvent const UnitCreateEvent = Packages.mindustry.game.EventType.UnitCreateEvent const UnitDrownEvent = Packages.mindustry.game.EventType.UnitDrownEvent const UnitDestroyEvent = Packages.mindustry.game.EventType.UnitDestroyEvent @@ -178,6 +183,7 @@ const SectorInvasionEvent = Packages.mindustry.game.EventType.SectorInvasionEven const SectorLoseEvent = Packages.mindustry.game.EventType.SectorLoseEvent const WorldLoadEvent = Packages.mindustry.game.EventType.WorldLoadEvent const FileTreeInitEvent = Packages.mindustry.game.EventType.FileTreeInitEvent +const MusicRegisterEvent = Packages.mindustry.game.EventType.MusicRegisterEvent const ClientLoadEvent = Packages.mindustry.game.EventType.ClientLoadEvent const ContentInitEvent = Packages.mindustry.game.EventType.ContentInitEvent const BlockInfoEvent = Packages.mindustry.game.EventType.BlockInfoEvent @@ -191,8 +197,8 @@ const PlayEvent = Packages.mindustry.game.EventType.PlayEvent const DisposeEvent = Packages.mindustry.game.EventType.DisposeEvent const ServerLoadEvent = Packages.mindustry.game.EventType.ServerLoadEvent const ClientCreateEvent = Packages.mindustry.game.EventType.ClientCreateEvent -const SaveWriteEvent = Packages.mindustry.game.EventType.SaveWriteEvent const SaveLoadEvent = Packages.mindustry.game.EventType.SaveLoadEvent +const SaveWriteEvent = Packages.mindustry.game.EventType.SaveWriteEvent const MapPublishEvent = Packages.mindustry.game.EventType.MapPublishEvent const MapMakeEvent = Packages.mindustry.game.EventType.MapMakeEvent const ResizeEvent = Packages.mindustry.game.EventType.ResizeEvent diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 6fa79887f1..8348aea868 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -7,6 +7,7 @@ import mindustry.*; import mindustry.entities.*; import mindustry.entities.bullet.*; import mindustry.entities.effect.*; +import mindustry.entities.part.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.type.*; @@ -3648,7 +3649,7 @@ public class Blocks{ }}; switchBlock = new SwitchBlock("switch"){{ - requirements(Category.logic, with(Items.graphite, 5)); + requirements(Category.logic, with(Items.graphite, 5, Items.copper, 5)); }}; microProcessor = new LogicBlock("micro-processor"){{ @@ -3683,13 +3684,13 @@ public class Blocks{ }}; memoryCell = new MemoryBlock("memory-cell"){{ - requirements(Category.logic, with(Items.graphite, 30, Items.silicon, 30)); + requirements(Category.logic, with(Items.graphite, 30, Items.silicon, 30, Items.copper, 30)); memoryCapacity = 64; }}; memoryBank = new MemoryBlock("memory-bank"){{ - requirements(Category.logic, with(Items.graphite, 80, Items.silicon, 80, Items.phaseFabric, 30)); + requirements(Category.logic, with(Items.graphite, 80, Items.silicon, 80, Items.phaseFabric, 30, Items.copper, 30)); memoryCapacity = 512; size = 2; diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index d9c6c431b3..f47f4049b5 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -11,6 +11,8 @@ import mindustry.entities.*; import mindustry.entities.abilities.*; import mindustry.entities.bullet.*; import mindustry.entities.effect.*; +import mindustry.entities.part.*; +import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.type.*; @@ -2432,10 +2434,10 @@ public class UnitTypes{ vanquish = new TankUnitType("vanquish"){{ hitSize = 28f; treadPullOffset = 4; - speed = 0.6f; + speed = 0.63f; health = 9000; armor = 20f; - areaDamage = 12f; + areaDamage = 13f; treadRects = new Rect[]{new Rect(22, 16, 28, 130)}; weapons.add(new Weapon("vanquish-weapon"){{ @@ -2513,18 +2515,24 @@ public class UnitTypes{ weapons.add(new Weapon("conquer-weapon"){{ layerOffset = 0.0001f; reload = 120f; - shootY = 71f / 4f; + shootY = 32.5f; shake = 5f; recoil = 4f; rotate = true; rotateSpeed = 0.6f; mirror = false; x = 0f; - shadow = 32f; - y = -8f; + y = -2f; + shadow = 50f; heatColor = Color.valueOf("f9350f"); cooldownTime = 80f; + parts.add(new RegionPart("-glow"){{ + color = Color.red; + blending = Blending.additive; + outline = mirror = false; + }}); + bullet = new BasicBulletType(8f, 110){{ sprite = "missile-large"; width = 9.5f; @@ -2545,9 +2553,9 @@ public class UnitTypes{ }}); //TODO could change color when shooting - //decals.add(new UnitDecal("conquer-glow", Pal.turretHeat.cpy(), Blending.additive){{ - // layer = -1f; - //}}); + decals.add(new UnitDecal("conquer-glow", Color.red, Blending.additive){{ + layer = -1f; + }}); }}; //endregion diff --git a/core/src/mindustry/entities/part/RegionPart.java b/core/src/mindustry/entities/part/RegionPart.java new file mode 100644 index 0000000000..b0a9e834b0 --- /dev/null +++ b/core/src/mindustry/entities/part/RegionPart.java @@ -0,0 +1,131 @@ +package mindustry.entities.part; + +import arc.*; +import arc.graphics.*; +import arc.graphics.g2d.*; +import arc.math.*; +import arc.struct.*; +import arc.util.*; +import mindustry.graphics.*; + +public class RegionPart extends WeaponPart{ + public String suffix = ""; + public TextureRegion heat; + public TextureRegion[] regions = {}; + public TextureRegion[] outlines = {}; + + /** If true, turret reload is used as the measure of progress. Otherwise, warmup is used. */ + public boolean useReload = true; + /** If true, parts are mirrored across the turret. Requires -1 and -2 regions. */ + public boolean mirror = true; + /** If true, an outline is drawn under the part. */ + public boolean outline = true; + /** If true, the layer is overridden to be under the turret itself. */ + public boolean under = false; + /** If true, the base + outline regions are drawn. Set to false for heat-only regions. */ + public boolean drawRegion = true; + /** If true, progress is inverted. */ + public boolean invert = false; + public Blending blending = Blending.normal; + public boolean useProgressHeat = false; + public Interp interp = Interp.linear; + public float layer = -1; + public float outlineLayerOffset = -0.01f; + public float rotation, rotMove; + public float x, y, moveX, moveY; + public float oscMag = 0f, oscScl = 7f; + public boolean oscAbs = false; + public @Nullable Color color; + public Color heatColor = Pal.turretHeat.cpy(); + + public RegionPart(String region){ + this.suffix = region; + } + + public RegionPart(){ + } + + @Override + public void draw(PartParams params){ + float z = Draw.z(); + if(layer > 0){ + Draw.z(layer); + } + float prevZ = layer > 0 ? layer : z; + float progress = useReload ? 1f - params.reload : params.warmup; + + if(oscMag > 0) progress += oscAbs ? Mathf.absin(oscScl, oscMag) : Mathf.sin(oscScl, oscMag); + if(invert) progress = 1f - progress; + + progress = interp.apply(progress); + int len = mirror ? 2 : 1; + + for(int i = 0; i < len; i++){ + //can be null + var region = drawRegion ? regions[Math.min(i, regions.length - 1)] : null; + float sign = i == 1 ? -1 : 1; + Tmp.v1.set((x + moveX * progress) * sign, y + moveY * progress).rotate((params.rotation - 90)); + + float + rx = params.x + Tmp.v1.x, + ry = params.y + Tmp.v1.y, + rot = i * sign + rotMove * progress * sign + params.rotation - 90; + + Draw.xscl = i == 0 ? 1 : -1; + + if(outline && drawRegion){ + Draw.z(prevZ + outlineLayerOffset); + Draw.rect(outlines[i], rx, ry, rot); + Draw.z(prevZ); + } + + if(drawRegion && region.found()){ + if(color != null) Draw.color(color); + Draw.blend(blending); + Draw.rect(region, rx, ry, rot); + Draw.blend(); + if(color != null) Draw.color(); + } + + if(heat.found()){ + Drawf.additive(heat, heatColor.write(Tmp.c1).a((useProgressHeat ? params.warmup : params.heat) * heatColor.a), rx, ry, rot, Layer.turretHeat); + } + + Draw.xscl = 1f; + } + + Draw.z(z); + } + + @Override + public void load(String name){ + if(under) layer = Layer.turret - 0.0001f; + + if(drawRegion){ + //TODO l/r + if(mirror && turretShading){ + regions = new TextureRegion[]{ + Core.atlas.find(name + suffix + "1"), + Core.atlas.find(name + suffix + "2") + }; + + outlines = new TextureRegion[]{ + Core.atlas.find(name + suffix + "1-outline"), + Core.atlas.find(name + suffix + "2-outline") + }; + }else{ + regions = new TextureRegion[]{Core.atlas.find(name + suffix)}; + outlines = new TextureRegion[]{Core.atlas.find(name + suffix + "-outline")}; + } + } + + heat = Core.atlas.find(name + suffix + "-heat"); + } + + @Override + public void getOutlines(Seq out){ + if(outline && drawRegion){ + out.addAll(regions); + } + } +} \ No newline at end of file diff --git a/core/src/mindustry/entities/part/WeaponPart.java b/core/src/mindustry/entities/part/WeaponPart.java new file mode 100644 index 0000000000..b02c86158f --- /dev/null +++ b/core/src/mindustry/entities/part/WeaponPart.java @@ -0,0 +1,32 @@ +package mindustry.entities.part; + +import arc.graphics.g2d.*; +import arc.struct.*; + +public abstract class WeaponPart{ + public static final PartParams params = new PartParams(); + + /** If true, turret shading is used. Don't touch this, it is set up in unit/block init()! */ + public boolean turretShading; + + public abstract void draw(PartParams params); + public abstract void load(String name); + public void getOutlines(Seq out){} + + /** Parameters for drawing a part in draw(). */ + public static class PartParams{ + //TODO document + public float warmup, reload, heat; + public float x, y, rotation; + + public PartParams set(float warmup, float reload, float heat, float x, float y, float rotation){ + this.warmup = warmup; + this.reload = reload; + this.heat = heat; + this.x = x; + this.y = y; + this.rotation = rotation; + return this; + } + } +} diff --git a/core/src/mindustry/mod/ClassMap.java b/core/src/mindustry/mod/ClassMap.java index 72e3834f14..0780d9e45f 100644 --- a/core/src/mindustry/mod/ClassMap.java +++ b/core/src/mindustry/mod/ClassMap.java @@ -1,36 +1,46 @@ package mindustry.mod; import arc.struct.*; -import mindustry.world.blocks.payloads.*; - /** Generated class. Maps simple class names to concrete classes. For use in JSON mods. */ @SuppressWarnings("deprecation") public class ClassMap{ public static final ObjectMap> classes = new ObjectMap<>(); static{ + classes.put("AssemblerAI", mindustry.ai.types.AssemblerAI.class); classes.put("BuilderAI", mindustry.ai.types.BuilderAI.class); + classes.put("CargoAI", mindustry.ai.types.CargoAI.class); classes.put("DefenderAI", mindustry.ai.types.DefenderAI.class); classes.put("FlyingAI", mindustry.ai.types.FlyingAI.class); + classes.put("FlyingFollowAI", mindustry.ai.types.FlyingFollowAI.class); classes.put("FormationAI", mindustry.ai.types.FormationAI.class); classes.put("GroundAI", mindustry.ai.types.GroundAI.class); classes.put("HugAI", mindustry.ai.types.HugAI.class); classes.put("LogicAI", mindustry.ai.types.LogicAI.class); classes.put("MinerAI", mindustry.ai.types.MinerAI.class); + classes.put("MissileAI", mindustry.ai.types.MissileAI.class); classes.put("RepairAI", mindustry.ai.types.RepairAI.class); classes.put("SuicideAI", mindustry.ai.types.SuicideAI.class); classes.put("Ability", mindustry.entities.abilities.Ability.class); + classes.put("ArmorPlateAbility", mindustry.entities.abilities.ArmorPlateAbility.class); classes.put("EnergyFieldAbility", mindustry.entities.abilities.EnergyFieldAbility.class); classes.put("ForceFieldAbility", mindustry.entities.abilities.ForceFieldAbility.class); + classes.put("LiquidExplodeAbility", mindustry.entities.abilities.LiquidExplodeAbility.class); + classes.put("LiquidRegenAbility", mindustry.entities.abilities.LiquidRegenAbility.class); classes.put("MoveLightningAbility", mindustry.entities.abilities.MoveLightningAbility.class); + classes.put("RegenAbility", mindustry.entities.abilities.RegenAbility.class); classes.put("RepairFieldAbility", mindustry.entities.abilities.RepairFieldAbility.class); + classes.put("ShieldArcAbility", mindustry.entities.abilities.ShieldArcAbility.class); classes.put("ShieldRegenFieldAbility", mindustry.entities.abilities.ShieldRegenFieldAbility.class); classes.put("StatusFieldAbility", mindustry.entities.abilities.StatusFieldAbility.class); + classes.put("SuppressionFieldAbility", mindustry.entities.abilities.SuppressionFieldAbility.class); classes.put("UnitSpawnAbility", mindustry.entities.abilities.UnitSpawnAbility.class); classes.put("ArtilleryBulletType", mindustry.entities.bullet.ArtilleryBulletType.class); classes.put("BasicBulletType", mindustry.entities.bullet.BasicBulletType.class); classes.put("BombBulletType", mindustry.entities.bullet.BombBulletType.class); classes.put("BulletType", mindustry.entities.bullet.BulletType.class); + classes.put("ContinuousBulletType", mindustry.entities.bullet.ContinuousBulletType.class); + classes.put("ContinuousFlameBulletType", mindustry.entities.bullet.ContinuousFlameBulletType.class); classes.put("ContinuousLaserBulletType", mindustry.entities.bullet.ContinuousLaserBulletType.class); classes.put("EmpBulletType", mindustry.entities.bullet.EmpBulletType.class); classes.put("FireBulletType", mindustry.entities.bullet.FireBulletType.class); @@ -45,17 +55,25 @@ public class ClassMap{ classes.put("RailBulletType", mindustry.entities.bullet.RailBulletType.class); classes.put("SapBulletType", mindustry.entities.bullet.SapBulletType.class); classes.put("ShrapnelBulletType", mindustry.entities.bullet.ShrapnelBulletType.class); + classes.put("SpaceLiquidBulletType", mindustry.entities.bullet.SpaceLiquidBulletType.class); classes.put("ExplosionEffect", mindustry.entities.effect.ExplosionEffect.class); classes.put("MultiEffect", mindustry.entities.effect.MultiEffect.class); classes.put("ParticleEffect", mindustry.entities.effect.ParticleEffect.class); + classes.put("RadialEffect", mindustry.entities.effect.RadialEffect.class); classes.put("WaveEffect", mindustry.entities.effect.WaveEffect.class); + classes.put("WrapEffect", mindustry.entities.effect.WrapEffect.class); classes.put("Objectives", mindustry.game.Objectives.class); classes.put("Objective", mindustry.game.Objectives.Objective.class); + classes.put("OnPlanet", mindustry.game.Objectives.OnPlanet.class); + classes.put("OnSector", mindustry.game.Objectives.OnSector.class); classes.put("Produce", mindustry.game.Objectives.Produce.class); classes.put("Research", mindustry.game.Objectives.Research.class); classes.put("SectorComplete", mindustry.game.Objectives.SectorComplete.class); classes.put("AmmoType", mindustry.type.AmmoType.class); + classes.put("BlockSeq", mindustry.type.BlockSeq.class); + classes.put("BlockStack", mindustry.type.BlockStack.class); classes.put("Category", mindustry.type.Category.class); + classes.put("CellLiquid", mindustry.type.CellLiquid.class); classes.put("ErrorContent", mindustry.type.ErrorContent.class); classes.put("Item", mindustry.type.Item.class); classes.put("ItemSeq", mindustry.type.ItemSeq.class); @@ -70,12 +88,18 @@ public class ClassMap{ classes.put("SectorPreset", mindustry.type.SectorPreset.class); classes.put("StatusEffect", mindustry.type.StatusEffect.class); classes.put("TransitionHandler", mindustry.type.StatusEffect.TransitionHandler.class); + classes.put("TeamEntry", mindustry.type.TeamEntry.class); classes.put("UnitType", mindustry.type.UnitType.class); + classes.put("UnitEngine", mindustry.type.UnitType.UnitEngine.class); classes.put("Weapon", mindustry.type.Weapon.class); classes.put("Weather", mindustry.type.Weather.class); classes.put("WeatherEntry", mindustry.type.Weather.WeatherEntry.class); classes.put("ItemAmmoType", mindustry.type.ammo.ItemAmmoType.class); classes.put("PowerAmmoType", mindustry.type.ammo.PowerAmmoType.class); + classes.put("MissileUnitType", mindustry.type.unit.MissileUnitType.class); + classes.put("NeoplasmUnitType", mindustry.type.unit.NeoplasmUnitType.class); + classes.put("TankUnitType", mindustry.type.unit.TankUnitType.class); + classes.put("BuildWeapon", mindustry.type.weapons.BuildWeapon.class); classes.put("PointDefenseWeapon", mindustry.type.weapons.PointDefenseWeapon.class); classes.put("RepairBeamWeapon", mindustry.type.weapons.RepairBeamWeapon.class); classes.put("HealBeamMount", mindustry.type.weapons.RepairBeamWeapon.HealBeamMount.class); @@ -95,6 +119,10 @@ public class ClassMap{ classes.put("AcceleratorBuild", mindustry.world.blocks.campaign.Accelerator.AcceleratorBuild.class); classes.put("LaunchPad", mindustry.world.blocks.campaign.LaunchPad.class); classes.put("LaunchPadBuild", mindustry.world.blocks.campaign.LaunchPad.LaunchPadBuild.class); + classes.put("BuildTurret", mindustry.world.blocks.defense.BuildTurret.class); + classes.put("BuildTurretBuild", mindustry.world.blocks.defense.BuildTurret.BuildTurretBuild.class); + classes.put("DirectionalForceProjector", mindustry.world.blocks.defense.DirectionalForceProjector.class); + classes.put("DirectionalForceProjectorBuild", mindustry.world.blocks.defense.DirectionalForceProjector.DirectionalForceProjectorBuild.class); classes.put("Door", mindustry.world.blocks.defense.Door.class); classes.put("DoorBuild", mindustry.world.blocks.defense.Door.DoorBuild.class); classes.put("ForceProjector", mindustry.world.blocks.defense.ForceProjector.class); @@ -103,6 +131,8 @@ public class ClassMap{ classes.put("MendBuild", mindustry.world.blocks.defense.MendProjector.MendBuild.class); classes.put("OverdriveProjector", mindustry.world.blocks.defense.OverdriveProjector.class); classes.put("OverdriveBuild", mindustry.world.blocks.defense.OverdriveProjector.OverdriveBuild.class); + classes.put("RegenProjector", mindustry.world.blocks.defense.RegenProjector.class); + classes.put("RegenProjectorBuild", mindustry.world.blocks.defense.RegenProjector.RegenProjectorBuild.class); classes.put("ShockMine", mindustry.world.blocks.defense.ShockMine.class); classes.put("ShockMineBuild", mindustry.world.blocks.defense.ShockMine.ShockMineBuild.class); classes.put("Thruster", mindustry.world.blocks.defense.Thruster.class); @@ -111,6 +141,10 @@ public class ClassMap{ classes.put("WallBuild", mindustry.world.blocks.defense.Wall.WallBuild.class); classes.put("BaseTurret", mindustry.world.blocks.defense.turrets.BaseTurret.class); classes.put("BaseTurretBuild", mindustry.world.blocks.defense.turrets.BaseTurret.BaseTurretBuild.class); + classes.put("ContinuousLiquidTurret", mindustry.world.blocks.defense.turrets.ContinuousLiquidTurret.class); + classes.put("LiquidTurretBuild", mindustry.world.blocks.defense.turrets.ContinuousLiquidTurret.LiquidTurretBuild.class); + classes.put("ContinuousTurret", mindustry.world.blocks.defense.turrets.ContinuousTurret.class); + classes.put("ContinuousTurretBuild", mindustry.world.blocks.defense.turrets.ContinuousTurret.ContinuousTurretBuild.class); classes.put("ItemTurret", mindustry.world.blocks.defense.turrets.ItemTurret.class); classes.put("ItemEntry", mindustry.world.blocks.defense.turrets.ItemTurret.ItemEntry.class); classes.put("ItemTurretBuild", mindustry.world.blocks.defense.turrets.ItemTurret.ItemTurretBuild.class); @@ -118,6 +152,8 @@ public class ClassMap{ classes.put("LaserTurretBuild", mindustry.world.blocks.defense.turrets.LaserTurret.LaserTurretBuild.class); classes.put("LiquidTurret", mindustry.world.blocks.defense.turrets.LiquidTurret.class); classes.put("LiquidTurretBuild", mindustry.world.blocks.defense.turrets.LiquidTurret.LiquidTurretBuild.class); + classes.put("PayloadTurret", mindustry.world.blocks.defense.turrets.PayloadTurret.class); + classes.put("PayloadTurretBuild", mindustry.world.blocks.defense.turrets.PayloadTurret.PayloadTurretBuild.class); classes.put("PointDefenseTurret", mindustry.world.blocks.defense.turrets.PointDefenseTurret.class); classes.put("PointDefenseBuild", mindustry.world.blocks.defense.turrets.PointDefenseTurret.PointDefenseBuild.class); classes.put("PowerTurret", mindustry.world.blocks.defense.turrets.PowerTurret.class); @@ -136,6 +172,12 @@ public class ClassMap{ classes.put("ChainedBuilding", mindustry.world.blocks.distribution.ChainedBuilding.class); classes.put("Conveyor", mindustry.world.blocks.distribution.Conveyor.class); classes.put("ConveyorBuild", mindustry.world.blocks.distribution.Conveyor.ConveyorBuild.class); + classes.put("DirectionBridge", mindustry.world.blocks.distribution.DirectionBridge.class); + classes.put("DirectionBridgeBuild", mindustry.world.blocks.distribution.DirectionBridge.DirectionBridgeBuild.class); + classes.put("DirectionLiquidBridge", mindustry.world.blocks.distribution.DirectionLiquidBridge.class); + classes.put("DuctBridgeBuild", mindustry.world.blocks.distribution.DirectionLiquidBridge.DuctBridgeBuild.class); + classes.put("DirectionalUnloader", mindustry.world.blocks.distribution.DirectionalUnloader.class); + classes.put("DirectionalUnloaderBuild", mindustry.world.blocks.distribution.DirectionalUnloader.DirectionalUnloaderBuild.class); classes.put("Duct", mindustry.world.blocks.distribution.Duct.class); classes.put("DuctBuild", mindustry.world.blocks.distribution.Duct.DuctBuild.class); classes.put("DuctBridge", mindustry.world.blocks.distribution.DuctBridge.class); @@ -152,30 +194,39 @@ public class ClassMap{ classes.put("DriverBulletData", mindustry.world.blocks.distribution.MassDriver.DriverBulletData.class); classes.put("DriverState", mindustry.world.blocks.distribution.MassDriver.DriverState.class); classes.put("MassDriverBuild", mindustry.world.blocks.distribution.MassDriver.MassDriverBuild.class); + classes.put("OverflowDuct", mindustry.world.blocks.distribution.OverflowDuct.class); + classes.put("DuctRouterBuild", mindustry.world.blocks.distribution.OverflowDuct.DuctRouterBuild.class); classes.put("OverflowGate", mindustry.world.blocks.distribution.OverflowGate.class); classes.put("OverflowGateBuild", mindustry.world.blocks.distribution.OverflowGate.OverflowGateBuild.class); - classes.put("PayloadConveyor", PayloadConveyor.class); - classes.put("PayloadConveyorBuild", PayloadConveyor.PayloadConveyorBuild.class); - classes.put("PayloadRouter", PayloadRouter.class); - classes.put("PayloadRouterBuild", PayloadRouter.PayloadRouterBuild.class); + classes.put("PayloadConveyor", mindustry.world.blocks.distribution.PayloadConveyor.class); + classes.put("PayloadConveyorBuild", mindustry.world.blocks.distribution.PayloadConveyor.PayloadConveyorBuild.class); + classes.put("PayloadRouter", mindustry.world.blocks.distribution.PayloadRouter.class); + classes.put("PayloadRouterBuild", mindustry.world.blocks.distribution.PayloadRouter.PayloadRouterBuild.class); classes.put("Router", mindustry.world.blocks.distribution.Router.class); classes.put("RouterBuild", mindustry.world.blocks.distribution.Router.RouterBuild.class); classes.put("Sorter", mindustry.world.blocks.distribution.Sorter.class); classes.put("SorterBuild", mindustry.world.blocks.distribution.Sorter.SorterBuild.class); classes.put("StackConveyor", mindustry.world.blocks.distribution.StackConveyor.class); classes.put("StackConveyorBuild", mindustry.world.blocks.distribution.StackConveyor.StackConveyorBuild.class); + classes.put("StackRouter", mindustry.world.blocks.distribution.StackRouter.class); + classes.put("StackRouterBuild", mindustry.world.blocks.distribution.StackRouter.StackRouterBuild.class); classes.put("AirBlock", mindustry.world.blocks.environment.AirBlock.class); classes.put("Cliff", mindustry.world.blocks.environment.Cliff.class); classes.put("DoubleOverlayFloor", mindustry.world.blocks.environment.DoubleOverlayFloor.class); classes.put("EmptyFloor", mindustry.world.blocks.environment.EmptyFloor.class); classes.put("Floor", mindustry.world.blocks.environment.Floor.class); + classes.put("UpdateRenderState", mindustry.world.blocks.environment.Floor.UpdateRenderState.class); classes.put("OreBlock", mindustry.world.blocks.environment.OreBlock.class); classes.put("OverlayFloor", mindustry.world.blocks.environment.OverlayFloor.class); classes.put("Prop", mindustry.world.blocks.environment.Prop.class); + classes.put("SeaBush", mindustry.world.blocks.environment.SeaBush.class); + classes.put("Seaweed", mindustry.world.blocks.environment.Seaweed.class); classes.put("ShallowLiquid", mindustry.world.blocks.environment.ShallowLiquid.class); classes.put("SpawnBlock", mindustry.world.blocks.environment.SpawnBlock.class); classes.put("StaticTree", mindustry.world.blocks.environment.StaticTree.class); classes.put("StaticWall", mindustry.world.blocks.environment.StaticWall.class); + classes.put("SteamVent", mindustry.world.blocks.environment.SteamVent.class); + classes.put("TallBlock", mindustry.world.blocks.environment.TallBlock.class); classes.put("TreeBlock", mindustry.world.blocks.environment.TreeBlock.class); classes.put("WobbleProp", mindustry.world.blocks.environment.WobbleProp.class); classes.put("BlockForge", mindustry.world.blocks.experimental.BlockForge.class); @@ -184,6 +235,12 @@ public class ClassMap{ classes.put("BlockLoaderBuild", mindustry.world.blocks.experimental.BlockLoader.BlockLoaderBuild.class); classes.put("BlockUnloader", mindustry.world.blocks.experimental.BlockUnloader.class); classes.put("BlockUnloaderBuild", mindustry.world.blocks.experimental.BlockUnloader.BlockUnloaderBuild.class); + classes.put("HeatBlock", mindustry.world.blocks.heat.HeatBlock.class); + classes.put("HeatConductor", mindustry.world.blocks.heat.HeatConductor.class); + classes.put("HeatConductorBuild", mindustry.world.blocks.heat.HeatConductor.HeatConductorBuild.class); + classes.put("HeatConsumer", mindustry.world.blocks.heat.HeatConsumer.class); + classes.put("HeatProducer", mindustry.world.blocks.heat.HeatProducer.class); + classes.put("HeatProducerBuild", mindustry.world.blocks.heat.HeatProducer.HeatProducerBuild.class); classes.put("LegacyBlock", mindustry.world.blocks.legacy.LegacyBlock.class); classes.put("LegacyMechPad", mindustry.world.blocks.legacy.LegacyMechPad.class); classes.put("LegacyMechPadBuild", mindustry.world.blocks.legacy.LegacyMechPad.LegacyMechPadBuild.class); @@ -223,6 +280,8 @@ public class ClassMap{ classes.put("Payload", mindustry.world.blocks.payloads.Payload.class); classes.put("PayloadBlock", mindustry.world.blocks.payloads.PayloadBlock.class); classes.put("PayloadBlockBuild", mindustry.world.blocks.payloads.PayloadBlock.PayloadBlockBuild.class); + classes.put("PayloadConveyor", mindustry.world.blocks.payloads.PayloadConveyor.class); + classes.put("PayloadConveyorBuild", mindustry.world.blocks.payloads.PayloadConveyor.PayloadConveyorBuild.class); classes.put("PayloadDeconstructor", mindustry.world.blocks.payloads.PayloadDeconstructor.class); classes.put("PayloadDeconstructorBuild", mindustry.world.blocks.payloads.PayloadDeconstructor.PayloadDeconstructorBuild.class); classes.put("PayloadLoader", mindustry.world.blocks.payloads.PayloadLoader.class); @@ -231,6 +290,8 @@ public class ClassMap{ classes.put("PayloadDriverBuild", mindustry.world.blocks.payloads.PayloadMassDriver.PayloadDriverBuild.class); classes.put("PayloadDriverState", mindustry.world.blocks.payloads.PayloadMassDriver.PayloadDriverState.class); classes.put("PayloadMassDriverData", mindustry.world.blocks.payloads.PayloadMassDriver.PayloadMassDriverData.class); + classes.put("PayloadRouter", mindustry.world.blocks.payloads.PayloadRouter.class); + classes.put("PayloadRouterBuild", mindustry.world.blocks.payloads.PayloadRouter.PayloadRouterBuild.class); classes.put("PayloadSource", mindustry.world.blocks.payloads.PayloadSource.class); classes.put("PayloadSourceBuild", mindustry.world.blocks.payloads.PayloadSource.PayloadSourceBuild.class); classes.put("PayloadUnloader", mindustry.world.blocks.payloads.PayloadUnloader.class); @@ -240,9 +301,13 @@ public class ClassMap{ classes.put("UnitPayload", mindustry.world.blocks.payloads.UnitPayload.class); classes.put("Battery", mindustry.world.blocks.power.Battery.class); classes.put("BatteryBuild", mindustry.world.blocks.power.Battery.BatteryBuild.class); + classes.put("BeamNode", mindustry.world.blocks.power.BeamNode.class); + classes.put("BeamNodeBuild", mindustry.world.blocks.power.BeamNode.BeamNodeBuild.class); classes.put("BurnerGenerator", mindustry.world.blocks.power.BurnerGenerator.class); classes.put("BurnerGeneratorBuild", mindustry.world.blocks.power.BurnerGenerator.BurnerGeneratorBuild.class); classes.put("ConditionalConsumePower", mindustry.world.blocks.power.ConditionalConsumePower.class); + classes.put("ConsumeGenerator", mindustry.world.blocks.power.ConsumeGenerator.class); + classes.put("ConsumeGeneratorBuild", mindustry.world.blocks.power.ConsumeGenerator.ConsumeGeneratorBuild.class); classes.put("DecayGenerator", mindustry.world.blocks.power.DecayGenerator.class); classes.put("DynamicConsumePower", mindustry.world.blocks.power.DynamicConsumePower.class); classes.put("ImpactReactor", mindustry.world.blocks.power.ImpactReactor.class); @@ -273,6 +338,8 @@ public class ClassMap{ classes.put("AttributeSmelterBuild", mindustry.world.blocks.production.AttributeSmelter.AttributeSmelterBuild.class); classes.put("BeamDrill", mindustry.world.blocks.production.BeamDrill.class); classes.put("BeamDrillBuild", mindustry.world.blocks.production.BeamDrill.BeamDrillBuild.class); + classes.put("BurstDrill", mindustry.world.blocks.production.BurstDrill.class); + classes.put("BurstDrillBuild", mindustry.world.blocks.production.BurstDrill.BurstDrillBuild.class); classes.put("Cultivator", mindustry.world.blocks.production.Cultivator.class); classes.put("CultivatorBuild", mindustry.world.blocks.production.Cultivator.CultivatorBuild.class); classes.put("Drill", mindustry.world.blocks.production.Drill.class); @@ -283,8 +350,12 @@ public class ClassMap{ classes.put("GenericCrafterBuild", mindustry.world.blocks.production.GenericCrafter.GenericCrafterBuild.class); classes.put("GenericSmelter", mindustry.world.blocks.production.GenericSmelter.class); classes.put("SmelterBuild", mindustry.world.blocks.production.GenericSmelter.SmelterBuild.class); + classes.put("HeatCrafter", mindustry.world.blocks.production.HeatCrafter.class); + classes.put("HeatCrafterBuild", mindustry.world.blocks.production.HeatCrafter.HeatCrafterBuild.class); classes.put("Incinerator", mindustry.world.blocks.production.Incinerator.class); classes.put("IncineratorBuild", mindustry.world.blocks.production.Incinerator.IncineratorBuild.class); + classes.put("ItemIncinerator", mindustry.world.blocks.production.ItemIncinerator.class); + classes.put("ItemIncineratorBuild", mindustry.world.blocks.production.ItemIncinerator.ItemIncineratorBuild.class); classes.put("LiquidConverter", mindustry.world.blocks.production.LiquidConverter.class); classes.put("LiquidConverterBuild", mindustry.world.blocks.production.LiquidConverter.LiquidConverterBuild.class); classes.put("PayloadAcceptor", mindustry.world.blocks.production.PayloadAcceptor.class); @@ -297,6 +368,8 @@ public class ClassMap{ classes.put("SingleBlockProducerBuild", mindustry.world.blocks.production.SingleBlockProducer.SingleBlockProducerBuild.class); classes.put("SolidPump", mindustry.world.blocks.production.SolidPump.class); classes.put("SolidPumpBuild", mindustry.world.blocks.production.SolidPump.SolidPumpBuild.class); + classes.put("WallCrafter", mindustry.world.blocks.production.WallCrafter.class); + classes.put("WallCrafterBuild", mindustry.world.blocks.production.WallCrafter.WallCrafterBuild.class); classes.put("ItemSource", mindustry.world.blocks.sandbox.ItemSource.class); classes.put("ItemSourceBuild", mindustry.world.blocks.sandbox.ItemSource.ItemSourceBuild.class); classes.put("ItemVoid", mindustry.world.blocks.sandbox.ItemVoid.class); @@ -314,27 +387,63 @@ public class ClassMap{ classes.put("StorageBuild", mindustry.world.blocks.storage.StorageBlock.StorageBuild.class); classes.put("Unloader", mindustry.world.blocks.storage.Unloader.class); classes.put("UnloaderBuild", mindustry.world.blocks.storage.Unloader.UnloaderBuild.class); + classes.put("ContainerStat", mindustry.world.blocks.storage.Unloader.UnloaderBuild.ContainerStat.class); classes.put("CommandCenter", mindustry.world.blocks.units.CommandCenter.class); classes.put("CommandBuild", mindustry.world.blocks.units.CommandCenter.CommandBuild.class); classes.put("Reconstructor", mindustry.world.blocks.units.Reconstructor.class); classes.put("ReconstructorBuild", mindustry.world.blocks.units.Reconstructor.ReconstructorBuild.class); classes.put("RepairPoint", mindustry.world.blocks.units.RepairPoint.class); classes.put("RepairPointBuild", mindustry.world.blocks.units.RepairPoint.RepairPointBuild.class); + classes.put("UnitAssembler", mindustry.world.blocks.units.UnitAssembler.class); + classes.put("AssemblerUnitPlan", mindustry.world.blocks.units.UnitAssembler.AssemblerUnitPlan.class); + classes.put("UnitAssemblerBuild", mindustry.world.blocks.units.UnitAssembler.UnitAssemblerBuild.class); + classes.put("YeetData", mindustry.world.blocks.units.UnitAssembler.YeetData.class); + classes.put("UnitAssemblerModule", mindustry.world.blocks.units.UnitAssemblerModule.class); + classes.put("UnitAssemblerModuleBuild", mindustry.world.blocks.units.UnitAssemblerModule.UnitAssemblerModuleBuild.class); classes.put("UnitBlock", mindustry.world.blocks.units.UnitBlock.class); classes.put("UnitBuild", mindustry.world.blocks.units.UnitBlock.UnitBuild.class); + classes.put("UnitCargoLoader", mindustry.world.blocks.units.UnitCargoLoader.class); + classes.put("UnitTransportSourceBuild", mindustry.world.blocks.units.UnitCargoLoader.UnitTransportSourceBuild.class); + classes.put("UnitCargoUnloadPoint", mindustry.world.blocks.units.UnitCargoUnloadPoint.class); + classes.put("UnitCargoUnloadPointBuild", mindustry.world.blocks.units.UnitCargoUnloadPoint.UnitCargoUnloadPointBuild.class); classes.put("UnitFactory", mindustry.world.blocks.units.UnitFactory.class); classes.put("UnitFactoryBuild", mindustry.world.blocks.units.UnitFactory.UnitFactoryBuild.class); classes.put("UnitPlan", mindustry.world.blocks.units.UnitFactory.UnitPlan.class); classes.put("DrawAnimation", mindustry.world.draw.DrawAnimation.class); classes.put("DrawArcSmelter", mindustry.world.draw.DrawArcSmelter.class); classes.put("DrawBlock", mindustry.world.draw.DrawBlock.class); + classes.put("DrawBlurSpin", mindustry.world.draw.DrawBlurSpin.class); + classes.put("DrawBubbles", mindustry.world.draw.DrawBubbles.class); classes.put("DrawCells", mindustry.world.draw.DrawCells.class); + classes.put("DrawCircles", mindustry.world.draw.DrawCircles.class); + classes.put("DrawCrucibleFlame", mindustry.world.draw.DrawCrucibleFlame.class); classes.put("DrawCultivator", mindustry.world.draw.DrawCultivator.class); classes.put("DrawGlow", mindustry.world.draw.DrawGlow.class); + classes.put("DrawGlowRegion", mindustry.world.draw.DrawGlowRegion.class); + classes.put("DrawHeatInput", mindustry.world.draw.DrawHeatInput.class); + classes.put("DrawHeatOutput", mindustry.world.draw.DrawHeatOutput.class); + classes.put("DrawHeatRegion", mindustry.world.draw.DrawHeatRegion.class); classes.put("DrawLiquid", mindustry.world.draw.DrawLiquid.class); + classes.put("DrawLiquidOutputs", mindustry.world.draw.DrawLiquidOutputs.class); + classes.put("DrawLiquidRegion", mindustry.world.draw.DrawLiquidRegion.class); + classes.put("DrawLiquidTile", mindustry.world.draw.DrawLiquidTile.class); classes.put("DrawMixer", mindustry.world.draw.DrawMixer.class); + classes.put("DrawMulti", mindustry.world.draw.DrawMulti.class); + classes.put("DrawMultiWeave", mindustry.world.draw.DrawMultiWeave.class); + classes.put("DrawPartial", mindustry.world.draw.DrawPartial.class); + classes.put("DrawParticles", mindustry.world.draw.DrawParticles.class); + classes.put("DrawPistons", mindustry.world.draw.DrawPistons.class); + classes.put("DrawPulseShape", mindustry.world.draw.DrawPulseShape.class); + classes.put("DrawPump", mindustry.world.draw.DrawPump.class); + classes.put("DrawRegion", mindustry.world.draw.DrawRegion.class); classes.put("DrawRotator", mindustry.world.draw.DrawRotator.class); + classes.put("DrawShape", mindustry.world.draw.DrawShape.class); + classes.put("DrawSideRegion", mindustry.world.draw.DrawSideRegion.class); classes.put("DrawSmelter", mindustry.world.draw.DrawSmelter.class); + classes.put("DrawSpikes", mindustry.world.draw.DrawSpikes.class); + classes.put("DrawTurbines", mindustry.world.draw.DrawTurbines.class); + classes.put("DrawTurret", mindustry.world.draw.DrawTurret.class); + classes.put("DrawWarmupRegion", mindustry.world.draw.DrawWarmupRegion.class); classes.put("DrawWeave", mindustry.world.draw.DrawWeave.class); classes.put("Block", mindustry.world.Block.class); } diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index a3241be6a9..a50d8a3f1c 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -24,6 +24,7 @@ import mindustry.entities.Units.*; import mindustry.entities.abilities.*; import mindustry.entities.bullet.*; import mindustry.entities.effect.*; +import mindustry.entities.part.*; import mindustry.game.*; import mindustry.game.Objectives.*; import mindustry.gen.*; @@ -128,6 +129,13 @@ public class ContentParser{ readFields(result, data); return result; }); + put(WeaponPart.class, (type, data) -> { + var bc = resolve(data.getString("type", ""), RegionPart.class); + data.remove("type"); + var result = make(bc); + readFields(result, data); + return result; + }); put(Sound.class, (type, data) -> { if(fieldOpt(Sounds.class, data) != null) return fieldOpt(Sounds.class, data); if(Vars.headless) return new Sound(); diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index fde9584440..3889719f73 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -583,10 +583,32 @@ public class UnitType extends UnlockableContent{ } } + public void getRegionsToOutline(Seq out){ + for(Weapon weapon : weapons){ + for(var part : weapon.parts){ + part.getOutlines(out); + } + } + } + @Override public void createIcons(MultiPacker packer){ super.createIcons(packer); + var toOutline = new Seq(); + getRegionsToOutline(toOutline); + + for(var region : toOutline){ + if(region instanceof AtlasRegion atlas){ + String regionName = atlas.name; + Pixmap outlined = Pixmaps.outline(Core.atlas.getPixmap(region), outlineColor, outlineRadius); + + if(Core.settings.getBool("linear", true)) Pixmaps.bleed(outlined); + + packer.add(PageType.main, regionName + "-outline", outlined); + } + } + //currently does not create outlines for legs or base regions due to older mods having them outlined by default if(outlines){ diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 655482523a..c5cd032830 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -14,6 +14,7 @@ import mindustry.audio.*; import mindustry.content.*; import mindustry.entities.*; import mindustry.entities.bullet.*; +import mindustry.entities.part.*; import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.graphics.*; @@ -125,6 +126,8 @@ public class Weapon implements Cloneable{ public float shootStatusDuration = 60f * 5f; /** whether this weapon should fire when its owner dies */ public boolean shootOnDeath = false; + /** extra animated parts */ + public Seq parts = new Seq<>(); public Weapon(String name){ this.name = name; @@ -163,13 +166,9 @@ public class Weapon implements Cloneable{ wx = unit.x + Angles.trnsx(rotation, x, y) + Angles.trnsx(weaponRotation, 0, -mount.recoil), wy = unit.y + Angles.trnsy(rotation, x, y) + Angles.trnsy(weaponRotation, 0, -mount.recoil); - if(outlineRegion.found()){ - Draw.rect(outlineRegion, - wx, wy, - outlineRegion.width * Draw.scl * -Mathf.sign(flipSprite), - outlineRegion.height * Draw.scl, - weaponRotation); - } + Draw.xscl = -Mathf.sign(flipSprite); + Draw.rect(outlineRegion, wx, wy, weaponRotation); + Draw.xscl = 1f; Draw.z(z); } @@ -195,24 +194,37 @@ public class Weapon implements Cloneable{ drawOutline(unit, mount); } - Draw.rect(region, - wx, wy, - region.width * Draw.scl * -Mathf.sign(flipSprite), - region.height * Draw.scl, - weaponRotation); + Draw.xscl = -Mathf.sign(flipSprite); + + Draw.rect(region, wx, wy, weaponRotation); if(heatRegion.found() && mount.heat > 0){ Draw.color(heatColor, mount.heat); Draw.blend(Blending.additive); - Draw.rect(heatRegion, - wx, wy, - heatRegion.width * Draw.scl * -Mathf.sign(flipSprite), - heatRegion.height * Draw.scl, - weaponRotation); + Draw.rect(heatRegion, wx, wy, weaponRotation); Draw.blend(); Draw.color(); } + if(parts.size > 0){ + //TODO does it need an outline? + /* + if(outline.found()){ + //draw outline under everything when parts are involved + Draw.z(Layer.turret - 0.01f); + Draw.rect(outline, build.x + tb.recoilOffset.x, build.y + tb.recoilOffset.y, tb.drawrot()); + Draw.z(Layer.turret); + }*/ + + var params = WeaponPart.params.set(0f, Mathf.clamp(mount.reload / reload), mount.heat, wx, wy, weaponRotation + 90); + + for(var part : parts){ + part.draw(params); + } + } + + Draw.xscl = 1f; + Draw.z(z); } @@ -445,6 +457,12 @@ public class Weapon implements Cloneable{ region = Core.atlas.find(name); heatRegion = Core.atlas.find(name + "-heat"); outlineRegion = Core.atlas.find(name + "-outline"); + + //TODO outlinedRegions + for(var part : parts){ + part.turretShading = false; + part.load(name); + } } } diff --git a/core/src/mindustry/world/draw/DrawTurret.java b/core/src/mindustry/world/draw/DrawTurret.java index dc8d483119..952a4c7613 100644 --- a/core/src/mindustry/world/draw/DrawTurret.java +++ b/core/src/mindustry/world/draw/DrawTurret.java @@ -1,11 +1,11 @@ package mindustry.world.draw; import arc.*; -import arc.graphics.*; import arc.graphics.g2d.*; import arc.math.*; import arc.struct.*; import arc.util.*; +import mindustry.entities.part.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.type.*; @@ -17,7 +17,7 @@ import mindustry.world.blocks.defense.turrets.Turret.*; public class DrawTurret extends DrawBlock{ protected static final Rand rand = new Rand(); - public Seq parts = new Seq<>(); + public Seq parts = new Seq<>(); public String basePrefix = ""; /** Overrides the liquid to draw in the liquid region. */ public @Nullable Liquid liquidDraw; @@ -59,13 +59,16 @@ public class DrawTurret extends DrawBlock{ if(parts.size > 0){ if(outline.found()){ + //draw outline under everything when parts are involved Draw.z(Layer.turret - 0.01f); Draw.rect(outline, build.x + tb.recoilOffset.x, build.y + tb.recoilOffset.y, tb.drawrot()); Draw.z(Layer.turret); } + var params = WeaponPart.params.set(build.warmup(), tb.progress(), tb.heat, tb.x + tb.recoilOffset.x, tb.y + tb.recoilOffset.y, tb.rotation); + for(var part : parts){ - part.draw(tb); + part.draw(params); } } } @@ -102,7 +105,8 @@ public class DrawTurret extends DrawBlock{ base = Core.atlas.find(block.name + "-base"); for(var part : parts){ - part.load(block); + part.turretShading = true; + part.load(block.name); } //TODO test this for mods, e.g. exotic @@ -116,127 +120,4 @@ public class DrawTurret extends DrawBlock{ TextureRegion showTop = preview.found() ? preview : block.region; return top.found() ? new TextureRegion[]{base, showTop, top} : new TextureRegion[]{base, showTop}; } - - public static class RegionPart extends TurretPart{ - public String suffix = ""; - public TextureRegion heat; - public TextureRegion[] regions; - public TextureRegion[] outlines; - - /** If true, turret reload is used as the measure of progress. Otherwise, warmup is used. */ - public boolean useReload = true; - /** If true, parts are mirrored across the turret. Requires -1 and -2 regions. */ - public boolean mirror = true; - /** If true, an outline is drawn under the part. */ - public boolean outline = true; - /** If true, the layer is overridden to be under the turret itself. */ - public boolean under = false; - /** If true, the base + outline regions are drawn. Set to false for heat-only regions. */ - public boolean drawRegion = true; - /** If true, progress is inverted. */ - public boolean invert = false; - public boolean useProgressHeat = false; - public Interp interp = Interp.linear; - public float layer = -1; - public float outlineLayerOffset = -0.01f; - public float rotation, rotMove; - public float x, y, moveX, moveY; - public float oscMag = 0f, oscScl = 7f; - public boolean oscAbs = false; - public Color heatColor = Pal.turretHeat.cpy(); - - public RegionPart(String region){ - this.suffix = region; - } - - public RegionPart(){ - } - - @Override - public void draw(TurretBuild build){ - float z = Draw.z(); - if(layer > 0){ - Draw.z(layer); - } - float prevZ = layer > 0 ? layer : z; - - float progress = useReload ? 1f - build.progress() : build.warmup(); - - if(oscMag > 0) progress += oscAbs ? Mathf.absin(oscScl, oscMag) : Mathf.sin(oscScl, oscMag); - if(invert) progress = 1f - progress; - - progress = interp.apply(progress); - - for(int i = 0; i < regions.length; i++){ - //can be null if drawRegion == false - var region = regions[i]; - float sign = i == 1 ? -1 : 1; - Tmp.v1.set((x + moveX * progress) * sign, y + moveY * progress).rotate((build.rotation - 90)); - - float - rx = build.x + Tmp.v1.x + build.recoilOffset.x, - ry = build.y + Tmp.v1.y + build.recoilOffset.y, - rot = i * sign + rotMove * progress * sign + build.rotation - 90; - - Draw.xscl = i == 0 ? 1 : -1; - - if(outline && drawRegion){ - Draw.z(prevZ + outlineLayerOffset); - Draw.rect(outlines[i], rx, ry, rot); - Draw.z(prevZ); - } - - if(drawRegion && region.found()){ - Draw.rect(region, rx, ry, rot); - } - - if(heat.found()){ - Drawf.additive(heat, heatColor.write(Tmp.c1).a((useProgressHeat ? build.warmup() : build.heat) * heatColor.a), rx, ry, rot, Layer.turretHeat); - } - - Draw.xscl = 1f; - } - - Draw.z(z); - } - - @Override - public void load(Block block){ - if(under) layer = Layer.turret - 0.0001f; - - if(drawRegion){ - if(mirror){ - regions = new TextureRegion[]{ - Core.atlas.find(block.name + suffix + "1"), - Core.atlas.find(block.name + suffix + "2") - }; - - outlines = new TextureRegion[]{ - Core.atlas.find(block.name + suffix + "1-outline"), - Core.atlas.find(block.name + suffix + "2-outline") - }; - }else{ - regions = new TextureRegion[]{Core.atlas.find(block.name + suffix)}; - outlines = new TextureRegion[]{Core.atlas.find(block.name + suffix + "-outline")}; - } - }else{ - regions = new TextureRegion[1]; - } - - heat = Core.atlas.find(block.name + suffix + "-heat"); - } - - @Override - public void getOutlines(Seq out){ - if(outline && drawRegion){ - out.addAll(regions); - } - } - } - - public static abstract class TurretPart{ - public abstract void draw(TurretBuild build); - public abstract void load(Block block); - public void getOutlines(Seq out){} - } } diff --git a/gradle.properties b/gradle.properties index be0907b8dd..8d36b34f7b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,4 +24,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=ed731441e1 +archash=680252597e diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index 77d182c8c4..c974cdc12d 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -329,11 +329,9 @@ public class Generators{ } } - if(toOutline != null){ - for(TextureRegion region : toOutline){ - Pixmap pix = get(region).outline(block.outlineColor, block.outlineRadius); - save(pix, ((GenRegion)region).name + "-outline"); - } + for(TextureRegion region : toOutline){ + Pixmap pix = get(region).outline(block.outlineColor, block.outlineRadius); + save(pix, ((GenRegion)region).name + "-outline"); } if(regions.length == 0){ @@ -502,6 +500,14 @@ public class Generators{ } }; + Seq toOutline = new Seq<>(); + type.getRegionsToOutline(toOutline); + + for(TextureRegion region : toOutline){ + Pixmap pix = get(region).outline(type.outlineColor, type.outlineRadius); + save(pix, ((GenRegion)region).name + "-outline"); + } + Seq weapons = type.weapons; weapons.each(Weapon::load); weapons.removeAll(w -> !w.region.found());