Skip to content

Commit

Permalink
more advancements
Browse files Browse the repository at this point in the history
  • Loading branch information
VuzZis committed Nov 26, 2024
1 parent fdb72ef commit 7a44945
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 12 deletions.
12 changes: 12 additions & 0 deletions assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,22 @@ settings.sv-update-id.confirm = [accent]Subvoyage[] detected changes that need t
sv_advancement.new = New Advancement!
sv_advancement.welcome.name = Welcome!
sv_advancement.welcome.description = Launch Subvoyage for the first time.
sv_advancement.beta.name = boulder
sv_advancement.beta.description = Play Subvoyage while it's still in beta.
sv_advancement.sector_dive.name = Step by step
sv_advancement.sector_dive.description = Capture Dive.
sv_advancement.overstress.name = Overstress
sv_advancement.overstress.description = Cause diffusers' slowdown.
sv_advancement.locked.name = ???
sv_advancement.locked.description = Unlock to see the advancement.
sv_advancement.uwu.name = Kawaii
sv_advancement.uwu.description = Turn on UwU mode.
sv_advancement.unit_helio.name = Helicopter-Helicopter
sv_advancement.unit_helio.description = Produce a helicopter unit.
sv_advancement.unit_hydro.name = Robo-frog
sv_advancement.unit_hydro.description = Produce a hydromech unit.
sv_advancement.unit_rover.name = When rovers fly
sv_advancement.unit_rover.description = Produce a rover unit.

advancements = Advancements

Expand Down
12 changes: 12 additions & 0 deletions assets/bundles/bundle_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,22 @@ settings.sv-update-id.confirm = [accent]Subvoyage[] обнаружил изме
sv_advancement.new = Новое достижение!
sv_advancement.welcome.name = Здравствуй!
sv_advancement.welcome.description = Запустите Subvoyage в первый раз.
sv_advancement.beta.name = камень
sv_advancement.beta.description = Сыграйте в Subvoyage во времена бета-версии.
sv_advancement.sector_dive.name = Шаг за шагом
sv_advancement.sector_dive.description = Захватите Погружение.
sv_advancement.overstress.name = Перегрузка
sv_advancement.overstress.description = Создать замедление диффузоров.
sv_advancement.locked.name = ???
sv_advancement.locked.description = Разблокируйте, чтобы увидеть достижение.
sv_advancement.uwu.name = Ути-пути
sv_advancement.uwu.description = Активируйте UwU режим.
sv_advancement.unit_helio.name = Стрекоза
sv_advancement.unit_helio.description = Произведите вертолёт.
sv_advancement.unit_hydro.name = Корабль на курьих ножках
sv_advancement.unit_hydro.description = Произведите гидромех.
sv_advancement.unit_rover.name = Один в поле не воин
sv_advancement.unit_rover.description = Произведите ровер.

advancements = Достижения

Expand Down
9 changes: 9 additions & 0 deletions src/subvoyage/Subvoyage.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import subvoyage.core.CustomRender;
import subvoyage.core.Logic;
import subvoyage.draw.visual.*;
import subvoyage.ui.advancements.Advancement;
import subvoyage.utility.*;
import subvoyage.world.techtree.*;

Expand All @@ -29,6 +30,14 @@ public Subvoyage(){
Events.run(Trigger.newGame,Logic::newGame);
Events.run(EventType.Trigger.draw, CustomRender::draw);

Events.on(UnitCreateEvent.class,e -> {
if(e.unit.team == SvTeam.melius) {
if(e.unit.type == SvUnits.lapetus) Advancement.unit_helio.unlock();
if(e.unit.type == SvUnits.leeft) Advancement.unit_hydro.unlock();
if(e.unit.type == SvUnits.stunt) Advancement.unit_rover.unlock();
}
});

Events.on(EventType.FileTreeInitEvent.class, e -> app.post(SvShaders::init));
Events.on(EventType.DisposeEvent.class, e -> SvShaders.dispose());
}
Expand Down
2 changes: 2 additions & 0 deletions src/subvoyage/content/SvUnits.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import subvoyage.type.unit.rover.RoverUnitType;
import subvoyage.type.unit.type.*;
import subvoyage.type.unit.weapons.*;
import subvoyage.ui.advancements.Advancement;

import static arc.Core.atlas;
import static arc.graphics.g2d.Draw.color;
Expand Down Expand Up @@ -2951,6 +2952,7 @@ public static void hmech(String... ids) {


public static void loadUwu(boolean isUwu) {
if(isUwu && Advancement.uwu != null) Advancement.uwu.unlock();
leeft.region = atlas.find(leeft.name+(isUwu ? "-uwu" :""));
leeft.weapons.first().layerOffset = isUwu ? -1 : 0;
leeft.drawCell = !isUwu;
Expand Down
19 changes: 16 additions & 3 deletions src/subvoyage/core/Logic.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package subvoyage.core;

import arc.Core;
import arc.util.Http;
import arc.util.Log;
import arc.util.Structs;
import arc.util.Time;
import arc.util.serialization.Jval;
import mindustry.game.Team;
import mindustry.gen.Musics;
import mindustry.type.SectorPreset;
import subvoyage.Subvoyage;
import subvoyage.SubvoyageSettings;
import subvoyage.SvVars;
import subvoyage.content.SvSectorPresets;
Expand All @@ -20,6 +24,9 @@
import subvoyage.ui.SvUI;
import subvoyage.ui.advancements.Advancement;
import subvoyage.utility.Var;
import subvoyage.utility.VersionControl;

import java.util.Arrays;

import static arc.Core.bundle;
import static arc.Core.settings;
Expand Down Expand Up @@ -80,11 +87,12 @@ public static void gameUpdate() {
LegionfieldAbility.update();
if(!state.isPaused() && SubvoyageCoreBlock.cutscene) SubvoyageCoreBlock.landTime-=Time.delta;

if(state.rules.planet == atlacian) Advancement.unlock(Advancement.welcome);
if(state.rules.planet == atlacian) Advancement.welcome.unlock();
if(state.rules.planet == atlacian && beta) Advancement.beta.unlock();

for (SectorPreset sect : SvSectorPresets.all) {
if(sect.sector.isCaptured() && Advancement.get("sector_"+sect.name.replace("subvoyage-","")) != null) {
Advancement.unlock(Advancement.get("sector_"+sect.name.replace("subvoyage-","")));
Advancement.get("sector_"+sect.name.replace("subvoyage-","")).unlock();
}
}
}
Expand All @@ -105,12 +113,17 @@ public static void worldLoad() {
SubvoyageCoreBlock.landTime = 0f;
}


/*Updating*/
public static boolean beta = false;
public static void checkUpdates() {
boolean autoUpdate = SubvoyageSettings.autoUpdate();
Log.info("[Subvoyage] Autoupdate: "+(autoUpdate ? "Enabled" : "Disabled"));
if(autoUpdate) AutoUpdater.begin();
Http.get(ghApi+"/repos/"+ Subvoyage.repo+"/releases/latest", res -> {
var json = Jval.read(res.getResultAsString());
String tagName = json.getString("tag_name");
beta = Structs.contains(Subvoyage.versionControl.parseTagAttributes(tagName.replace("b","-beta")),(a) -> a.name().equals("BETA"));
},(err) -> {});
}

static int currentVersion = 1;
Expand Down
4 changes: 4 additions & 0 deletions src/subvoyage/type/block/production/Diffuser.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import mindustry.world.meta.Stat;
import mindustry.world.meta.StatUnit;
import mindustry.world.meta.StatValues;
import subvoyage.ui.advancements.Advancement;

import static mindustry.Vars.world;

Expand Down Expand Up @@ -132,6 +133,8 @@ public void updateTile(){
builds.addUnique(db);
diffuserK = builds.size;
}
if(decrease(1f,diffuserK) < 0.35f)
Advancement.overstress.unlock();

totalProgress += warmup * delta();

Expand All @@ -157,6 +160,7 @@ public void updateTile(){
if(timer(timerDump, dumpTime)){
dump();
}

}

@Override
Expand Down
23 changes: 20 additions & 3 deletions src/subvoyage/ui/advancements/Advancement.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ public class Advancement {
public static Seq<Advancement> all = Seq.with();

public static Advancement
welcome,
sector_dive
welcome,beta,
sector_dive,
unit_helio, unit_hydro, unit_rover,
overstress,
uwu
;

public String id;
Expand All @@ -28,7 +31,17 @@ private Advancement() {}
public static void load() {
add(
"welcome","sublemon_frog", // Launching Subvoyage
"sector_dive","ceramic-burner" // Capturing Dive
"beta","sodilate-boulder1", // Launching Subvoyage

"sector_dive","ceramic-burner", // Capturing Dive

"unit_helio","lapetus-full", // Unit - Lapetus
"unit_hydro","leeft-full", // Unit - Leeft
"unit_rover","stunt-full", //Unit - Stunt

"overstress","water-diffuser", //Overstressing Diffuser

"uwu","leeft-uwu" //UwU Mode
);
}

Expand Down Expand Up @@ -70,4 +83,8 @@ public static Advancement from(String title_, String icon_) {
return adv;
}

public void unlock() {
Advancement.unlock(this);
}

}
6 changes: 3 additions & 3 deletions src/subvoyage/ui/advancements/AdvancementToastFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public void setup() {
gr.table(t -> {
t.label(this::title).marginLeft(50f).top().left();
t.row();
t.label(this::description).marginTop(8f).top().left().fontScale(0.8f).width(320f-50f-10f*2f).wrap().color(Pal.lightishGray);
}).marginLeft(5f).top().left().growY();
t.label(this::description).marginTop(8f).top().left().fontScale(0.8f).growX().wrap().color(Pal.lightishGray);
}).marginLeft(5f).top().growX().growY();

gr.update(() -> {
if(current == null && queue.firstOpt() != null) {
Expand Down Expand Up @@ -90,7 +90,7 @@ public String title() {
return current == null ? "oh" : clamp(current.title,20);
}
public String description() {
return current == null ? "no" : clamp(current.description,50);
return current == null ? "no" : clamp(current.description,70);
}

public static String clamp(String str, int maxLength) {
Expand Down
4 changes: 2 additions & 2 deletions src/subvoyage/ui/advancements/AdvancementsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public TextureRegion icon(Advancement adv) {
return !Advancement.unlocked(adv) ? findCache("subvoyage-advancement-locked") : findCache(adv.icon);
}
public String title(Advancement adv) {
return !Advancement.unlocked(adv) ? Core.bundle.get("sv_advancement.locked.name") : clamp(adv.title,20);
return !Advancement.unlocked(adv) ? Core.bundle.get("sv_advancement.locked.name") : clamp(adv.title,40);
}
public String description(Advancement adv) {
return !Advancement.unlocked(adv) ? Core.bundle.get("sv_advancement.locked.description") : clamp(adv.description,50);
return !Advancement.unlocked(adv) ? Core.bundle.get("sv_advancement.locked.description") : clamp(adv.description,100);
}

public static String clamp(String str, int maxLength) {
Expand Down
2 changes: 1 addition & 1 deletion src/subvoyage/utility/VersionControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class VersionControl {

enum Attribute {
public enum Attribute {
FIX,
BETA
}
Expand Down

0 comments on commit 7a44945

Please sign in to comment.