From 62fb4cc2b87dc1baa75f1d248ecef9c0c9500d3b Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Thu, 6 Feb 2025 13:40:14 -0500 Subject: [PATCH 1/2] Change misleading comments (#6632) * Change misleading comments The previous javadoc were more confusing than anything. I think this is better? Still dislike the naming of the targets() method considering those are the senders and not the receivers but oh well * Remove wrong docs --- .../java/mindustry/annotations/Annotations.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/annotations/src/main/java/mindustry/annotations/Annotations.java b/annotations/src/main/java/mindustry/annotations/Annotations.java index 88811afca5..6aa8d5b9d9 100644 --- a/annotations/src/main/java/mindustry/annotations/Annotations.java +++ b/annotations/src/main/java/mindustry/annotations/Annotations.java @@ -182,18 +182,16 @@ public class Annotations{ /** A set of two booleans, one specifying server and one specifying client. */ public enum Loc{ - /** Method can only be invoked on the client from the server. */ + /** Server only. */ server(true, false), - /** Method can only be invoked on the server from the client. */ + /** Client only. */ client(false, true), - /** Method can be invoked from anywhere */ + /** Both server and client. */ both(true, true), /** Neither server nor client. */ none(false, false); - /** If true, this method can be invoked ON clients FROM servers. */ public final boolean isServer; - /** If true, this method can be invoked ON servers FROM clients. */ public final boolean isClient; Loc(boolean server, boolean client){ @@ -222,16 +220,16 @@ public class Annotations{ @Target(ElementType.METHOD) @Retention(RetentionPolicy.SOURCE) public @interface Remote{ - /** Specifies the locations from which this method can be invoked. */ + /** Specifies the locations from which this method can cause remote invocations (This -> Remote) [Default: Server -> Client]. */ Loc targets() default Loc.server; - /** Specifies which methods are generated. Only affects server-to-client methods. */ + /** Specifies which methods are generated. Only affects server-to-client methods (Server -> Client(s)) [Default: Server -> Client & Server -> All Clients]. */ Variant variants() default Variant.all; - /** The local locations where this method is called locally, when invoked. */ + /** The locations where this method is called locally, when invoked locally (This -> This) [Default: No local invocations]. */ Loc called() default Loc.none; - /** Whether to forward this packet to all other clients upon receival. Client only. */ + /** Whether the server should forward this packet to all other clients upon receival from a client (Client -> Server -> Other Clients). [Default: Don't Forward Client Invocations] */ boolean forward() default false; /** From a74460c49a15f20eaa14311b491555091e16e8ee Mon Sep 17 00:00:00 2001 From: Twcash <131608563+Twcash@users.noreply.github.com> Date: Thu, 6 Feb 2025 13:27:00 -0600 Subject: [PATCH 2/2] Give X Y offsets to DrawCruci and DrawArc and make DrawRegion support x y and rotation in DrawPlan (#10412) * Allow DrawRegions plan to support X Y and rotation * Give DrawArcSmelt and DrawCruci X and Y offsets * fixes --- core/src/mindustry/world/draw/DrawArcSmelt.java | 8 ++++---- core/src/mindustry/world/draw/DrawCrucibleFlame.java | 11 +++++------ core/src/mindustry/world/draw/DrawRegion.java | 6 +++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/src/mindustry/world/draw/DrawArcSmelt.java b/core/src/mindustry/world/draw/DrawArcSmelt.java index 1c2c5937b7..1ee86390a0 100644 --- a/core/src/mindustry/world/draw/DrawArcSmelt.java +++ b/core/src/mindustry/world/draw/DrawArcSmelt.java @@ -9,7 +9,7 @@ import mindustry.gen.*; public class DrawArcSmelt extends DrawBlock{ public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585"); public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 3f, flameRadiusMag = 0.3f, circleStroke = 1.5f; - + public float x = 0, y = 0; public float alpha = 0.68f; public int particles = 25; public float particleLife = 40f, particleRad = 7f, particleStroke = 1.1f, particleLen = 3f; @@ -26,10 +26,10 @@ public class DrawArcSmelt extends DrawBlock{ Draw.blend(blending); Draw.color(midColor, a); - if(drawCenter) Fill.circle(build.x, build.y, flameRad + si); + if(drawCenter) Fill.circle(build.x + x, build.y + y, flameRad + si); Draw.color(flameColor, a); - if(drawCenter) Lines.circle(build.x, build.y, (flameRad + circleSpace + si) * build.warmup()); + if(drawCenter) Lines.circle(build.x + x, build.y + y, (flameRad + circleSpace + si) * build.warmup()); Lines.stroke(particleStroke * build.warmup()); @@ -39,7 +39,7 @@ public class DrawArcSmelt extends DrawBlock{ float fin = (rand.random(1f) + base) % 1f, fout = 1f - fin; float angle = rand.random(360f); float len = particleRad * Interp.pow2Out.apply(fin); - Lines.lineAngle(build.x + Angles.trnsx(angle, len), build.y + Angles.trnsy(angle, len), angle, particleLen * fout * build.warmup()); + Lines.lineAngle(build.x + Angles.trnsx(angle, len) + x, build.y + Angles.trnsy(angle, len) + y, angle, particleLen * fout * build.warmup()); } Draw.blend(); diff --git a/core/src/mindustry/world/draw/DrawCrucibleFlame.java b/core/src/mindustry/world/draw/DrawCrucibleFlame.java index 31b0cc50ab..2e7cb9fdc6 100644 --- a/core/src/mindustry/world/draw/DrawCrucibleFlame.java +++ b/core/src/mindustry/world/draw/DrawCrucibleFlame.java @@ -9,8 +9,7 @@ import mindustry.gen.*; public class DrawCrucibleFlame extends DrawBlock{ public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585"); - public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 10f, flameRadiusMag = 0.6f, circleStroke = 1.5f; - + public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 10f, flameRadiusMag = 0.6f, circleStroke = 1.5f, x = 0, y = 0; public float alpha = 0.5f; public int particles = 30; public float particleLife = 70f, particleRad = 7f, particleSize = 3f, fadeMargin = 0.4f, rotateScl = 1.5f; @@ -27,10 +26,10 @@ public class DrawCrucibleFlame extends DrawBlock{ Draw.blend(Blending.additive); Draw.color(midColor, a); - Fill.circle(build.x, build.y, flameRad + si); + Fill.circle(build.x + x, build.y + y, flameRad + si); Draw.color(flameColor, a); - Lines.circle(build.x, build.y, (flameRad + circleSpace + si) * build.warmup()); + Lines.circle(build.x + x, build.y + y, (flameRad + circleSpace + si) * build.warmup()); float base = (Time.time / particleLife); rand.setSeed(build.id); @@ -40,8 +39,8 @@ public class DrawCrucibleFlame extends DrawBlock{ float len = particleRad * particleInterp.apply(fout); Draw.alpha(a * (1f - Mathf.curve(fin, 1f - fadeMargin))); Fill.circle( - build.x + Angles.trnsx(angle, len), - build.y + Angles.trnsy(angle, len), + build.x + Angles.trnsx(angle, len) + x, + build.y + Angles.trnsy(angle, len) + y, particleSize * fin * build.warmup() ); } diff --git a/core/src/mindustry/world/draw/DrawRegion.java b/core/src/mindustry/world/draw/DrawRegion.java index 86523ca492..5d2547890d 100644 --- a/core/src/mindustry/world/draw/DrawRegion.java +++ b/core/src/mindustry/world/draw/DrawRegion.java @@ -51,7 +51,11 @@ public class DrawRegion extends DrawBlock{ @Override public void drawPlan(Block block, BuildPlan plan, Eachable list){ if(!drawPlan) return; - Draw.rect(region, plan.drawx(), plan.drawy(), (buildingRotate ? plan.rotation * 90f : 0)); + if(spinSprite){ + Drawf.spinSprite(region, plan.drawx() + x, plan.drawy() + y, (buildingRotate ? plan.rotation * 90f : 0 + rotation)); + }else{ + Draw.rect(region, plan.drawx()+ x, plan.drawy() + y, (buildingRotate ? plan.rotation * 90f : 0 + rotation)); + } } @Override