From 30787e49adb02ff88748b4ec2604bccfded74dc1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 24 Feb 2022 12:59:57 -0500 Subject: [PATCH] Removed logic disable timer --- core/assets-raw/sprites/units/quad.png | Bin 3576 -> 3532 bytes core/src/mindustry/content/Blocks.java | 4 +++ .../mindustry/content/SerpuloTechTree.java | 8 +++++- core/src/mindustry/content/UnitTypes.java | 2 +- .../mindustry/entities/comp/BuildingComp.java | 25 +++++------------- core/src/mindustry/logic/LExecutor.java | 5 ++++ core/src/mindustry/logic/LStatements.java | 7 ----- core/src/mindustry/type/Weapon.java | 2 +- .../world/blocks/logic/LogicBlock.java | 11 ++++++++ .../world/consumers/ConsumeItemExplosive.java | 20 ++++++++++++++ tools/build.gradle | 5 ++-- 11 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 core/src/mindustry/world/consumers/ConsumeItemExplosive.java diff --git a/core/assets-raw/sprites/units/quad.png b/core/assets-raw/sprites/units/quad.png index 878c8eed77f3d980308fa5e76920614178a135f0..51b20f747d13cd60301264741eefa1963898f51a 100644 GIT binary patch delta 3402 zcmV-Q4Yl(48_XM!Wq(phL_t(|obBD|daSq(1<-)uy#FKLBn7s#wI$0;>AGL}*D0_i zE#@iRU;qA(+t*(gaA*7A-nD&j@7g}NcWocsyS5MRUE2ruuI+<+*Y?3((I(NJ%J~#- zn*Kod5N?|OLiY>~Z4c=l!CBigx+ieV_K5BQ9Jf88yB{Yw^M7}HQg=J9Xq(iPyK~=- zE2U^#(|ymnIr&*!XA3J0H_xCef$o|O_av^f|CEONQ7zxC>58wrXtz9v>l_`5UUAE^ z>86hEs)NocT<6ICTYlT)mSxw8y^fE&NOuM|O<@^&Znb^uM#i1doxn}l!r6;xBje8K zj^j)bx(qYZwSRTSozPv1o5H!StuyZLaQcF3(lcLeT~}K$Ol0F~=)c0j1=U^%Fs#l@ zq_!>eAK~DFYOlmFP)8wkVRTy?T&VgnuNH>t2^&Id|Ic>K=BJ3&MIF8zuqHz;8 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4|@cUiI|?n&Kssj|4|bQdN{OCC*} zNkMS~(ME9ef%5Ux_a_*_k>t2tPw7mslYbj;40rD_^YY+>xI1;%haSZxN*IlJU*ut2 zzlPz6w*?-@b&D8}cvsv5xK0%Z0^Sw(2rjJRNW8n^9>N7x913?=++#Smieu64ihB^} zRB { + + }); + + //logic disabled until further notice + /* node(microProcessor, () -> { node(switchBlock, () -> { node(message, () -> { @@ -188,7 +194,7 @@ public class SerpuloTechTree{ }); }); }); - }); + });*/ node(illuminator, () -> { diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 546158308b..c5c0b421a5 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -967,7 +967,7 @@ public class UnitTypes{ targetAir = false; targetFlags = new BlockFlag[]{BlockFlag.generator, null}; hitSize = 7; - itemCapacity = 15; + itemCapacity = 0; weapons.add(new Weapon(){{ y = 0f; diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index f053bf2452..a1f3c43e4d 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -66,13 +66,14 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, transient byte cdump; transient int rotation; transient float payloadRotation; - transient boolean enabled = true; - transient float enabledControlTime; transient String lastAccessed; transient boolean wasDamaged; //used only by the indexer transient boolean wasVisible; //used only by the block renderer when fog is on (TODO replace with discovered check?) transient float visualLiquid; + transient boolean enabled = true; + transient @Nullable Building lastDisabler; + @Nullable PowerModule power; @Nullable ItemModule items; @Nullable LiquidModule liquids; @@ -82,8 +83,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, /** Same as efficiency, but for optional consumers only. */ transient float optionalEfficiency; - public transient float healSuppressionTime = -1f; - public transient float lastHealTime = -120f * 10f; + transient float healSuppressionTime = -1f; + transient float lastHealTime = -120f * 10f; private transient float timeScale = 1f, timeScaleDuration; private transient float dumpAccum; @@ -195,9 +196,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, if(version >= 1){ byte on = read.b(); this.enabled = on == 1; - if(!this.enabled){ - enabledControlTime = timeToUncontrol; - } } //get which modules should actually be read; this was added in version 2 @@ -497,7 +495,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } public BlockStatus status(){ - if(enabledControlTime > 0 && !enabled){ + if(!enabled){ return BlockStatus.logicDisable; } @@ -1803,7 +1801,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, public void control(LAccess type, double p1, double p2, double p3, double p4){ if(type == LAccess.enabled){ enabled = !Mathf.zero((float)p1); - enabledControlTime = timeToUncontrol; } } @@ -1866,16 +1863,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, timeScale = 1f; } - //TODO unacceptable overhead? - if(!enabled && block.autoResetEnabled){ - noSleep(); - enabledControlTime -= Time.delta; - - if(enabledControlTime <= 0){ - enabled = true; - } - } - if(!allowUpdate()){ enabled = false; } diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index d22a39ae20..de483e1f6f 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -560,6 +560,11 @@ public class LExecutor{ public void run(LExecutor exec){ Object obj = exec.obj(target); if(obj instanceof Building b && (exec.privileged || (b.team == exec.team && exec.linkIds.contains(b.id)))){ + + if(type == LAccess.enabled && !exec.bool(p1)){ + b.lastDisabler = exec.build; + } + if(type.isObj && exec.var(p1).isobj){ b.control(type, exec.obj(p1), exec.num(p2), exec.num(p3), exec.num(p4)); }else{ diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index 0488e68444..40809d7cdb 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -1244,13 +1244,6 @@ public class LStatements{ rebuild(table); } - /* - unitBuildSpeed, - unitDamage, - blockHealth, - blockDamage - */ - void rebuild(Table table){ table.clearChildren(); diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index ebde50d2ea..3fe2cfca3b 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -401,7 +401,7 @@ public class Weapon implements Cloneable{ shootAngle = bulletRotation(unit, mount, bulletX, bulletY), lifeScl = bullet.scaleVelocity ? Mathf.clamp(Mathf.dst(shootX, shootY, mount.aimX, mount.aimY) / bullet.range) : 1f; - bullet(mount, unit, shootX, shootY, angleOffset + shootAngle + Mathf.range(inaccuracy), lifeScl, shootAngle, mountX, mountY); + bullet(mount, unit, bulletX, bulletY, angleOffset + shootAngle + Mathf.range(inaccuracy), lifeScl, shootAngle, mountX, mountY); } protected void bullet(WeaponMount mount, Unit unit, float shootX, float shootY, float angle, float lifescl, float mountRotation, float mountX, float mountY){ diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index 44e9aac01e..62dc305fbb 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -397,6 +397,17 @@ public class LogicBlock extends Block{ } } + @Override + public void removeFromProximity(){ + super.removeFromProximity(); + + for(var link : executor.links){ + if(!link.enabled && link.lastDisabler == this){ + link.enabled = true; + } + } + } + @Override public Cursor getCursor(){ return !accessible() ? SystemCursor.arrow : super.getCursor(); diff --git a/core/src/mindustry/world/consumers/ConsumeItemExplosive.java b/core/src/mindustry/world/consumers/ConsumeItemExplosive.java new file mode 100644 index 0000000000..447928c8f7 --- /dev/null +++ b/core/src/mindustry/world/consumers/ConsumeItemExplosive.java @@ -0,0 +1,20 @@ +package mindustry.world.consumers; + +import mindustry.gen.*; + +public class ConsumeItemExplosive extends ConsumeItemFilter{ + + public ConsumeItemExplosive(float minExplosiveness){ + super(item -> item.explosiveness >= minExplosiveness); + } + + public ConsumeItemExplosive(){ + this(0.2f); + } + + @Override + public float efficiencyMultiplier(Building build){ + var item = getConsumed(build); + return item == null ? 0f : item.explosiveness; + } +} diff --git a/tools/build.gradle b/tools/build.gradle index 057b4a2c47..148da40dee 100644 --- a/tools/build.gradle +++ b/tools/build.gradle @@ -28,7 +28,8 @@ def enableAA = true //it's not compiled for other platforms so they don't get it def useFastAA = project.hasProperty("fastAA") || System.getProperty("user.name") == "anuke" -def antialias = { File file -> +@groovy.transform.CompileStatic +private def antialias(File file, boolean doAntialias, boolean useFastAA){ if(!doAntialias) return if(useFastAA){ @@ -168,7 +169,7 @@ task pack(dependsOn: [classes, configurations.runtimeClasspath]){ if(file.isDirectory() || (file.toString().replace("\\", "/").contains("/ui/") && file.toString().startsWith("icon-")) || file.toString().contains(".9.png")) return executor.submit{ - antialias(file.file) + antialias(file.file, doAntialias, useFastAA) } }