Skip to content

Commit

Permalink
planet change and add multiBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 17, 2024
1 parent 3c43eaa commit 5c415dc
Show file tree
Hide file tree
Showing 15 changed files with 361 additions and 145 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/blocks/environment/root-vent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified atlas.sai2
Binary file not shown.
67 changes: 38 additions & 29 deletions src/sw/SWVars.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import mindustry.ui.fragments.*;
import sw.audio.*;
import sw.content.*;
import sw.core.*;
import sw.dream.*;
import sw.graphics.*;
import sw.world.*;
Expand All @@ -19,35 +20,14 @@ public class SWVars implements Loadable {
public static Seq<FluidArea> fluidAreas = new Seq<>();
public static SectorPreset lastSectorPreset;

public static void init() {
// glenn stuff
Vars.mods.getScripts().runConsole("importPackage(Packages.rhino)");
Vars.mods.getScripts().runConsole(
"""
function importModClass(name){
let constr = Class.forName("rhino.NativeJavaPackage").getDeclaredConstructor(java.lang.Boolean.TYPE, java.lang.String, ClassLoader);
constr.setAccessible(true);
let p = constr.newInstance(true, name, Vars.mods.mainLoader());
public static EnvProcess envProcess;

let scope = Reflect.get(Vars.mods.getScripts(), "scope");
Reflect.invoke(ScriptableObject, p, "setParentScope", [scope], [Scriptable]);
importPackage(p);\s
public static void init() {
dev();

}"""
);
Vars.mods.getScripts().runConsole("importModClass(\"sw\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.content\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.content.blocks\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.dream\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.dream.events\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.maps\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.maps.generators\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.graphics\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.util\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.world.graph\")");
if (!Vars.headless) {
envProcess = new EnvProcess();
}
}
/** code to erase unlocked progress on this mod */
public static void clearUnlockModContent() {
Expand All @@ -66,8 +46,37 @@ public static void unlockModContent() {
});
}

public static boolean isOnSector(Sector sector) {
return Vars.state.getSector() == sector;
/**
* makes it so that i can access things with console
*/
public static void dev() {
Vars.mods.getScripts().runConsole("importPackage(Packages.rhino)");
Vars.mods.getScripts().runConsole(
"""
function importModClass(name){
let constr = Class.forName("rhino.NativeJavaPackage").getDeclaredConstructor(java.lang.Boolean.TYPE, java.lang.String, ClassLoader);
constr.setAccessible(true);
let p = constr.newInstance(true, name, Vars.mods.mainLoader());
let scope = Reflect.get(Vars.mods.getScripts(), "scope");
Reflect.invoke(ScriptableObject, p, "setParentScope", [scope], [Scriptable]);
importPackage(p);\s
}"""
);
Vars.mods.getScripts().runConsole("importModClass(\"sw\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.content\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.content.blocks\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.dream\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.dream.events\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.maps\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.maps.generators\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.graphics\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.util\")");
Vars.mods.getScripts().runConsole("importModClass(\"sw.world.graph\")");
}

/**This is where you initialize your content lists. But do not forget about correct order.
Expand Down
31 changes: 25 additions & 6 deletions src/sw/content/SWFx.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,39 @@
import mindustry.entities.*;
import mindustry.graphics.*;
import mindustry.world.*;
import sw.world.*;

public class SWFx {
public static final Rand rand = new Rand();
public static final Vec2 temp = new Vec2();

public static Effect
gasVent = new Effect(60f, e -> {
Draw.color(e.color, Color.black, e.fin());
Draw.alpha(e.fslope() * 0.6f);
gasVent = new Effect(120f, e -> {
if (!(e.data instanceof MultiShape shape)) return;
rand.setSeed(e.id);
Angles.randLenVectors(e.id, 3, 20f * e.fin(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, 10 * Interp.sine.apply(e.fin() * 1.2f));
shape.tiles.each(tile -> {
if (rand.chance(0.5d)) {
Draw.color(Color.valueOf("E3D8B6"), e.fout() / 2f);
e.scaled(30, b -> {
Angles.randLenVectors(tile.pos() + e.id, 5, 4f * b.fin(), (x, y) -> {
Fill.circle(
tile.worldx() + x + Angles.trnsx(Mathf.angle(x, y), 4f),
tile.worldy() + y + Angles.trnsy(Mathf.angle(x, y), 4f),
3f * b.fout()
);
});
});
if (tile.block().isAir()) {
float angle = rand.random(360f);
Fill.circle(
tile.worldx() + Angles.trnsx(angle, 4f * e.fin()),
tile.worldy() + Angles.trnsy(angle, 4f * e.fin()),
5f * Interp.circle.apply(Mathf.slope(e.fin()))
);
}
}
});
}).layer(Layer.darkness - 1),
}).layer(Layer.blockUnder),

boreMine = new Effect(60f, 48f, e -> {
Draw.color(e.color);
Expand Down
52 changes: 9 additions & 43 deletions src/sw/content/SWPlanets.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sw.content;

import arc.graphics.*;
import arc.math.geom.*;
import mindustry.content.*;
import mindustry.game.*;
import mindustry.graphics.g3d.*;
Expand All @@ -14,8 +13,8 @@ public class SWPlanets {
public static Planet wendi, unknown;

public static void load() {
wendi = new Planet("wendi", Planets.sun, 1f, 2) {{
meshLoader = () -> new HexMesh(this, 6);
wendi = new Planet("wendi", Planets.sun, 1f, 3) {{
meshLoader = () -> new HexMesh(this, 7);

sectorSeed = 2;
allowWaves = true;
Expand Down Expand Up @@ -52,68 +51,35 @@ public static void load() {

generator = new ModularPlanetGenerator() {{
heights.addAll(
new HeightPass.CraterHeight() {{
pos.set(Vec3.X);
radius = 1f;
offset = 0.7f;
set = true;
}},
new HeightPass.CraterHeight() {{
pos.set(Vec3.Y);
radius = 0.8f;
offset = 0.7f;
set = true;
}},
new HeightPass.CraterHeight() {{
pos.set(Vec3.Z);
radius = 0.6f;
offset = 0.7f;
set = true;
}},
new HeightPass.CraterHeight() {{
pos.set(Vec3.X).scl(-1f).rotate(new Vec3(Vec3.Z).scl(-1f), 45f);
radius = 0.5f;
offset = 0.7f;
set = true;
}},
new HeightPass.CraterHeight() {{
pos.set(Vec3.Y).scl(-1f).rotate(new Vec3(Vec3.X).scl(-1f), 75f);
radius = 0.3f;
offset = 0.7f;
set = true;
}},
new HeightPass.NoiseHeight() {{
offset.set(100, 220, 50442);
scale = 1;
offset.set(1000f, 0f, 0f);
octaves = 7;
persistence = 0.5;
magnitude = 2;
heightOffset = -2;
heightOffset = -1;
}},
new HeightPass.ClampHeight(-0.7f, 1f)
new HeightPass.ClampHeight(0f, 1f)
);
baseColor = SWEnvironment.soil.mapColor;
colors.addAll(
new ColorPass.NoiseColorPass() {{
offset.set(100, 220, 50442);
seed = 5;
scale = 1;
octaves = 7;
persistence = 0.5;
magnitude = 2;
out = SWEnvironment.gravel.mapColor;
out = SWEnvironment.roots.mapColor;
}},
new ColorPass.NoiseColorPass() {{
offset.set(100, 220, 50442);
seed = 2;
scale = 1;
seed = 4;
octaves = 7;
persistence = 0.5;
magnitude = 2;
out = SWEnvironment.roots.mapColor;
out = SWEnvironment.marble.mapColor;
}},
new ColorPass.FlatColorPass() {{
min = max = -0.7f;
min = max = 0f;
out = SWEnvironment.solventRegular.mapColor;
}}
);
Expand Down
Loading

0 comments on commit 5c415dc

Please sign in to comment.