Removed logic disable timer

This commit is contained in:
Anuken 2022-02-24 12:59:57 -05:00
parent f9dfe8cbcc
commit 30787e49ad
11 changed files with 58 additions and 31 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -2157,6 +2157,7 @@ public class Blocks{
ambientSound = Sounds.smelter;
ambientSoundVolume = 0.03f;
generateEffect = Fx.generatespark;
consume(new ConsumeItemFlammable());
consume(new ConsumeItemExplode());
@ -2183,6 +2184,7 @@ public class Blocks{
hasLiquids = true;
size = 2;
drawer.iconOverride = new String[]{"", "-turbine0", "-turbine1"};
generateEffect = Fx.generatespark;
ambientSound = Sounds.smelter;
ambientSoundVolume = 0.06f;
@ -2201,6 +2203,7 @@ public class Blocks{
hasItems = true;
size = 3;
ambientSound = Sounds.steam;
generateEffect = Fx.generatespark;
ambientSoundVolume = 0.03f;
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion());
@ -2215,6 +2218,7 @@ public class Blocks{
powerProduction = 4.5f;
itemDuration = 60 * 14f;
envEnabled = Env.any;
generateEffect = Fx.generatespark;
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion());
consume(new ConsumeItemRadioactive());

View File

@ -166,6 +166,12 @@ public class SerpuloTechTree{
});
});
node(message, () -> {
});
//logic disabled until further notice
/*
node(microProcessor, () -> {
node(switchBlock, () -> {
node(message, () -> {
@ -188,7 +194,7 @@ public class SerpuloTechTree{
});
});
});
});
});*/
node(illuminator, () -> {

View File

@ -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;

View File

@ -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;
}

View File

@ -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{

View File

@ -1244,13 +1244,6 @@ public class LStatements{
rebuild(table);
}
/*
unitBuildSpeed,
unitDamage,
blockHealth,
blockDamage
*/
void rebuild(Table table){
table.clearChildren();

View File

@ -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){

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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)
}
}