diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index a6b804c4f0..cde899e341 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -780,10 +780,10 @@ rules.wavetimer = Wave Timer rules.waves = Waves rules.attack = Attack Mode rules.enemyCheat = Infinite AI (Red Team) Resources -rules.unitdrops = Unit Drops +rules.blockhealthmultiplier = Block Health Multiplier +rules.blockdamagemultiplier = Block Damage Multiplier rules.unitbuildspeedmultiplier = Unit Production Speed Multiplier rules.unithealthmultiplier = Unit Health Multiplier -rules.blockhealthmultiplier = Block Health Multiplier rules.unitdamagemultiplier = Unit Damage Multiplier rules.enemycorebuildradius = Enemy Core No-Build Radius:[lightgray] (tiles) rules.wavespacing = Wave Spacing:[lightgray] (sec) diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index 3ef88f6473..f35264ef00 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java @@ -133,6 +133,9 @@ public class Vars implements Loadable{ public static boolean clearSectors = false; /** whether any light rendering is enabled */ public static boolean enableLight = true; + /** Whether to draw shadows of blocks at map edges and static blocks. + * Do not change unless you know exactly what you are doing.*/ + public static boolean enableDarkness = true; /** application data directory, equivalent to {@link Settings#getDataDirectory()} */ public static Fi dataDirectory; /** data subdirectory used for screenshots */ diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index b92b3f4d86..6309f88dfa 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -222,7 +222,7 @@ public class Renderer implements ApplicationListener{ Draw.draw(Layer.light, lights::draw); } - if(state.rules.drawDarkness){ + if(enableDarkness){ Draw.draw(Layer.darkness, blocks::drawDarkness); } diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 14b33712b5..6191f882bf 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -93,6 +93,10 @@ public abstract class BulletType extends Content{ public float weaveMag = -1f; public float hitShake = 0f; + public float lightRadius = 16f; + public float lightOpacity = 0.3f; + public Color lightColor = Pal.powerLight; + public BulletType(float speed, float damage){ this.speed = speed; this.damage = damage; @@ -161,6 +165,10 @@ public abstract class BulletType extends Content{ public void draw(Bulletc b){ } + public void drawLight(Bulletc b){ + Drawf.light(b, lightRadius, lightColor, lightOpacity); + } + public void init(Bulletc b){ if(killShooter && b.owner() instanceof Healthc){ ((Healthc)b.owner()).kill(); diff --git a/core/src/mindustry/entities/bullet/ContinuousLaserBulletType.java b/core/src/mindustry/entities/bullet/ContinuousLaserBulletType.java index 5332453b78..5166c800b8 100644 --- a/core/src/mindustry/entities/bullet/ContinuousLaserBulletType.java +++ b/core/src/mindustry/entities/bullet/ContinuousLaserBulletType.java @@ -28,6 +28,9 @@ public class ContinuousLaserBulletType extends BulletType{ pierce = true; hittable = false; hitColor = colors[2]; + incendAmount = 1; + incendSpread = 5; + incendChance = 0.4f; } protected ContinuousLaserBulletType(){ @@ -53,15 +56,6 @@ public class ContinuousLaserBulletType extends BulletType{ } } - /* - @Override - public void hit(Bulletc b, float hitx, float hity){ - hitEffect.at(hitx, hity, colors[2]); - if(Mathf.chance(0.4)){ - Fires.create(world.tileWorld(hitx + Mathf.range(5f), hity + Mathf.range(5f))); - } - }*/ - @Override public void draw(Bulletc b){ float baseLen = length * b.fout(); @@ -82,4 +76,9 @@ public class ContinuousLaserBulletType extends BulletType{ Draw.reset(); } + @Override + public void drawLight(Bulletc b){ + //no light drawn here + } + } diff --git a/core/src/mindustry/entities/bullet/LaserBulletType.java b/core/src/mindustry/entities/bullet/LaserBulletType.java index b81b78362e..cf54709f3c 100644 --- a/core/src/mindustry/entities/bullet/LaserBulletType.java +++ b/core/src/mindustry/entities/bullet/LaserBulletType.java @@ -95,4 +95,9 @@ public class LaserBulletType extends BulletType{ Tmp.v1.trns(b.rotation(), baseLen * 1.1f); Drawf.light(b.x(), b.y(), b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, width * 1.4f * b.fout(), colors[0], 0.6f); } + + @Override + public void drawLight(Bulletc b){ + //no light drawn here + } } diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index b97e6bea4e..345dd99192 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -18,6 +18,7 @@ import static mindustry.Vars.*; @Component abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Drawc, Shielderc, Ownerc, Velc, Bulletc, Timerc{ @Import Team team; + @Import Entityc owner; IntSeq collided = new IntSeq(6); Object data; @@ -49,9 +50,9 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw @Override public float damageMultiplier(){ - if(owner() instanceof Unitc){ - return ((Unitc)owner()).damageMultiplier(); - } + if(owner instanceof Unitc) return ((Unitc)owner).damageMultiplier() * state.rules.unitDamageMultiplier; + if(owner instanceof Tilec) return state.rules.blockDamageMultiplier; + return 1f; } @@ -133,8 +134,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw Draw.z(Layer.bullet); type.draw(this); - //TODO refactor - Drawf.light(x(), y(), 16f, Pal.powerLight, 0.3f); + type.drawLight(this); } /** Sets the bullet's rotation in degrees. */ diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index a26c6307d0..335d7b58b9 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -32,10 +32,12 @@ public class Rules{ public float unitBuildSpeedMultiplier = 1f; /** How much health units start with. */ public float unitHealthMultiplier = 1f; - /** How much health blocks start with. */ - public float blockHealthMultiplier = 1f; /** How much damage any other units deal. */ public float unitDamageMultiplier = 1f; + /** How much health blocks start with. */ + public float blockHealthMultiplier = 1f; + /** How much damage blocks (turrets) deal. */ + public float blockDamageMultiplier = 1f; /** Multiplier for buildings resource cost. */ public float buildCostMultiplier = 1f; /** Multiplier for building speed. */ @@ -68,9 +70,6 @@ public class Rules{ public boolean tutorial = false; /** Whether a gameover can happen at all. Set this to false to implement custom gameover conditions. */ public boolean canGameOver = true; - /** Whether to draw shadows of blocks at map edges and static blocks. - * Do not change unless you know exactly what you are doing.*/ - public boolean drawDarkness = true; /** EXPERIMENTAL building AI. TODO remove */ public boolean buildAI = true; /** Starting items put in cores */ @@ -93,7 +92,7 @@ public class Rules{ /** special tags for additional info */ public StringMap tags = new StringMap(); - /** Copies this ruleset exactly. Not very efficient at all, do not use often. */ + /** Copies this ruleset exactly. Not efficient at all, do not use often. */ public Rules copy(){ return JsonIO.copy(this); } diff --git a/core/src/mindustry/graphics/Pixelator.java b/core/src/mindustry/graphics/Pixelator.java index 67dc58dd7d..b4093c9efa 100644 --- a/core/src/mindustry/graphics/Pixelator.java +++ b/core/src/mindustry/graphics/Pixelator.java @@ -43,9 +43,8 @@ public class Pixelator implements Disposable{ Draw.draw(Layer.end, () -> { buffer.end(); - Draw.blend(Blending.disabled); - Draw.rect(buffer); - Draw.blend(); + Blending.disabled.apply(); + buffer.blit(Shaders.screenspace); Core.camera.position.set(px, py); renderer.setScale(pre); diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index cb38dd43fc..651d435bf8 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -669,7 +669,7 @@ public class Mods implements Loadable{ return new LoadedMod(sourceFile, zip, mainMod, meta); } - /** Represents a plugin that has been loaded from a jar file.*/ + /** Represents a mod's state. May be a jar file, folder or zip. */ public static class LoadedMod implements Publishable, Disposable{ /** The location of this mod's zip file/folder on the disk. */ public final Fi file; @@ -803,7 +803,7 @@ public class Mods implements Loadable{ } } - /** Plugin metadata information.*/ + /** Mod metadata information.*/ public static class ModMeta{ public String name, displayName, author, description, version, main, minGameVersion; public Seq dependencies = Seq.with(); diff --git a/core/src/mindustry/net/Administration.java b/core/src/mindustry/net/Administration.java index b07ba61e6d..a9b5ff38c2 100644 --- a/core/src/mindustry/net/Administration.java +++ b/core/src/mindustry/net/Administration.java @@ -293,8 +293,7 @@ public class Administration{ public boolean adminPlayer(String id, String usid){ PlayerInfo info = getCreateInfo(id); - if(info.admin && info.adminUsid != null && info.adminUsid.equals(usid)) - return false; + if(info.admin && info.adminUsid != null && info.adminUsid.equals(usid)) return false; info.adminUsid = usid; info.admin = true; @@ -310,8 +309,7 @@ public class Administration{ public boolean unAdminPlayer(String id){ PlayerInfo info = getCreateInfo(id); - if(!info.admin) - return false; + if(!info.admin) return false; info.admin = false; save(); diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index be09111dd9..2a40472260 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -140,6 +140,7 @@ public class CustomRulesDialog extends BaseDialog{ number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier); number("$rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources); number("$rules.blockhealthmultiplier", f -> rules.blockHealthMultiplier = f, () -> rules.blockHealthMultiplier); + number("$rules.blockdamagemultiplier", f -> rules.blockDamageMultiplier = f, () -> rules.blockDamageMultiplier); main.button("$configure", () -> loadoutDialog.show(Blocks.coreShard.itemCapacity, rules.loadout, diff --git a/gradle.properties b/gradle.properties index 82aea73568..b8958e4529 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=9fadfb97c7270920c22ac75ee4815663df7efc3d +archash=a074a6f49cf19f417b40fede82a429dab8c91cc0