Skip to content

Commit

Permalink
Visuals and optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Slotterleet committed May 24, 2024
1 parent 54ded55 commit 4ec0ce6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
Binary file modified res/maps/awakening.msav
Binary file not shown.
7 changes: 7 additions & 0 deletions src/fos/core/FOSMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public FOSMod() {
clientLoaded();
});

Events.run(EventType.Trigger.newGame, () -> {
// remove landing cutscene on Awakening
if (state.rules.sector != null && state.rules.sector == FOSSectors.awakening.sector) {
Reflect.set(renderer, "landTime", 0f);
}
});

Events.run(EventType.Trigger.update, () -> {
if (!mobile) {
boolean useDiscord = !OS.hasProp("nodiscord");
Expand Down
9 changes: 9 additions & 0 deletions src/fos/core/FOSVars.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import arc.Core;
import arc.struct.Seq;
import fos.ai.FOSPathfinder;
import fos.content.FOSSectors;
import fos.controllers.*;
import fos.files.InternalFileTree;
import fos.graphics.FOSOreRenderer;
Expand All @@ -16,6 +17,8 @@

import java.util.*;

import static mindustry.Vars.*;

public class FOSVars {
/** A research dialog that shows one of the two tech trees declared below. */
public static ResearchCoreDialog researchCoreDialog;
Expand Down Expand Up @@ -90,4 +93,10 @@ public static void load() {
TechTree.roots.remove(mechTree);
*/
}

public static boolean mapStarted() {
return state.rules.sector != null && state.rules.sector == FOSSectors.awakening.sector ?
state.tick >= 160 :
renderer.getLandTime() <= 0;
}
}
9 changes: 4 additions & 5 deletions src/fos/io/DeathMapControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public class DeathMapControl implements SaveFileReader.CustomChunk {
public volatile short[] deathMap;
public boolean shouldSave;

public DeathMapControl() {
Events.on(EventType.ResetEvent.class, e ->
Expand All @@ -34,6 +35,8 @@ public DeathMapControl() {
if (deathMap[tile.array()] < 0) {
deathMap[tile.array()] = Short.MAX_VALUE;
}

shouldSave = true;
});
});

Expand Down Expand Up @@ -65,10 +68,6 @@ public void read(DataInput stream) throws IOException {

@Override
public boolean shouldWrite() {
if (deathMap == null) return false;
for (int i : deathMap) {
if (i != 0) return true;
}
return false;
return deathMap != null && shouldSave;
}
}
5 changes: 3 additions & 2 deletions src/fos/type/blocks/storage/DetectorCoreBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import arc.util.Time;
import arc.util.io.*;
import fos.audio.FOSLoopsCore;
import fos.core.FOSVars;
import fos.type.blocks.environment.UndergroundOreBlock;
import mindustry.Vars;
import mindustry.game.Team;
Expand Down Expand Up @@ -135,7 +136,7 @@ public void buildConfiguration(Table table) {
@Override
public void draw() {
super.draw();
if (canConsume() && team == player.team()) {
if (canConsume() && team == player.team() && FOSVars.mapStarted()) {
Draw.z(Layer.light);
Draw.alpha(0.6f);
Lines.stroke(2.5f, effectColor);
Expand Down Expand Up @@ -174,7 +175,7 @@ public void draw() {

@Override
public boolean shouldActiveSound() {
return canConsume() && showOres;
return canConsume() && showOres && FOSVars.mapStarted();
}

public float radarRot() {
Expand Down

0 comments on commit 4ec0ce6

Please sign in to comment.