Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressure rework 3 #58

Merged
merged 57 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
b3138ec
add liquids to the system
Dec 5, 2024
38c10cd
too lazy to change the bar today
Dec 5, 2024
32300e7
changed the bar
Dec 5, 2024
d25cfbc
not fully tested gauger
Dec 6, 2024
ecaee4c
liquid distribution
Dec 6, 2024
86162b9
forgot
Dec 6, 2024
80ef751
pump
Dec 7, 2024
70ca75c
valve and a few fixes
Dec 9, 2024
2ac4f87
air well
Dec 10, 2024
992cd80
shelter
Dec 17, 2024
80bb54e
valve effect fix
Dec 17, 2024
3e41e2e
add groups
Dec 18, 2024
1f6c794
generic crafters were rather easy
Dec 18, 2024
8f5ac1e
finally remove the old consumers
Dec 18, 2024
06f618c
source
Dec 19, 2024
5eed887
chainable pumps
Dec 19, 2024
18b3bbc
smooth
Dec 19, 2024
965f01f
mæth
Dec 20, 2024
c968f04
this can be removed :3
Dec 29, 2024
935c72f
some fixes and more cleanup + a convenient
Dec 30, 2024
34b35ee
Merge pull request #53 from stabu-dev/master
uujuju1 Jan 6, 2025
1f678c9
Revert "Fix EntityAnno"
uujuju1 Jan 7, 2025
ae1f6b0
Merge pull request #54 from stabu-dev/revert-53-master
uujuju1 Jan 7, 2025
52ee995
lemme just this real quick
Jan 7, 2025
9916f17
Fix EntityAnno
stabu-dev Jan 6, 2025
923b007
include an install task in the gradle
Jan 7, 2025
26629b9
set up density
Jan 7, 2025
3dfa918
uncomplicate
Jan 8, 2025
5e7cf71
a
Jan 8, 2025
e8ee6cc
flow change
Jan 11, 2025
4a8e7b6
flow change part 2 (havent done it dlc)
Jan 12, 2025
2e3e544
half working pump thingy
Jan 12, 2025
707ce5d
atleast this works with air
Jan 12, 2025
3e59eff
stats
Jan 12, 2025
0cf7adf
pump effects
Jan 13, 2025
ff117ad
hints
Jan 13, 2025
1e126b2
flow that actually works
Jan 14, 2025
ff21f28
pump fix (only on front)
Jan 14, 2025
f5df403
fluid capacity stat
Jan 14, 2025
e3fc2ba
pump sprite retouch
stabu-dev Jan 14, 2025
5af549e
some fixes
Jan 14, 2025
808bfee
gauge resprite again
Jan 19, 2025
460fdea
made javelin consume air
Jan 20, 2025
3ec76f2
pump blows up earlier
Jan 21, 2025
4122b37
some tweaks
Jan 21, 2025
4530215
filter pump (untested config thingy)
Jan 21, 2025
d5d9fdb
change settings to a proper place
Jan 22, 2025
619929a
add setting for custom liquid stats
Jan 29, 2025
221e214
demo boiler block, it has issues though
Jan 29, 2025
a8fb06c
how tf was this it working
Jan 30, 2025
54b72d9
light stat change
Jan 31, 2025
7eb28cd
techtree and change the gauge cost
Jan 31, 2025
ad6f120
slight density change
Jan 31, 2025
e402dc7
hints
Jan 31, 2025
2112f2f
funni stat changes
Feb 2, 2025
1ab6ad9
Merge branch 'master' into pressure-rework-3
uujuju1 Feb 3, 2025
2346a87
Update BlastTower.java
uujuju1 Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 45 additions & 18 deletions assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ setting.omaloon-discord-join = Join Omaloon discord server!
setting.omaloon-enable-soft-cleaner = Enable Safe Cleaner
setting.omaloon-enable-soft-cleaner.description = Cleans your campaign from not allowed content and research.

setting.omaloon-display-liquid-stats = Display custom viscosity/density
setting.omaloon-display-liquid-stats.description = [red]NEEDS RELOAD

binding.category-omaloon-editor = Editor

settings.omaloon-resethints = Reset Hints
Expand All @@ -62,13 +65,10 @@ omaloon.update.dialog.fullclean.confirm = Are you sure you want to reset your cu
requirement.omaloon-at-wave = Reach Wave {0} in {1}

## Hints
hint.omaloon-pump_positive = To create higher pressure, place \uC353[accent] mechanical pumps[] in series, adding liquid pipes between them.\nTo increase pressure faster, place \uC353[accent] mechanical pumps[] in parallel.
hint.omaloon-pump_negative = To decrease pressure faster, add more \uC353[accent]mechanical pumps[].
hint.omaloon-drill_positive_pressure = \uC351 [accent]Hammer drills[] require negative pressure to operate. Rotate the \uC353[accent] mechanical pumps[] away from the drills to create negative pressure.
hint.omaloon-press_or_shelter_negative_pressure = Some buildings require positive pressure. Rotate the \uC353[accent] mechanical pumps[] to these blocks to create positive pressure.
hint.omaloon-pump = The pumps only stop when there is a block in front of it or the front block has enough pressure.
hint.omaloon-low_pressure = Buildings will implode when it reaches -50 pressure units. To avoid this, use \uC354 [accent]Liquid Valve[], which will reduce the pressure, preventing it from reaching dangerous levels.
hint.omaloon-valve = One valve can handle up to three pumps. If you have more pumps, place more valves to avoid jamming.
hint.omaloon-air = Air is equivalent to pressure in it's density. So each fluid unit of air equals one pascal inside the Liquid Tube.
hint.omaloon-drill = Drills work with negative pressure, working faster with lower pressures.
hint.omaloon-pump_chaining = Pumps chained in series can reach a higher pressure gradient between the ends. If they're chained in parallel, they work faster.
hint.omaloon-shelter = Shelters work with positive pressure, covering a larger area at higher pressures.

## planets
planet.omaloon-omaloon.name = Omaloon
Expand Down Expand Up @@ -268,12 +268,18 @@ block.omaloon-liquid-tube.description = Moves liquids.
block.omaloon-liquid-pump.name = Mechanical Pump
block.omaloon-liquid-pump.description = Moves liquids forward.

block.omaloon-filter-pump.name = Filter
block.omaloon-filter-pump.description = Moves liquids forward. Liquid can be choosen manually

block.omaloon-liquid-junction.name = Liquid Junction
block.omaloon-liquid-junction.description = Acts as a bridge for two crossing liquid tubes.

block.omaloon-liquid-valve.name = Liquid Valve
block.omaloon-liquid-valve.description = Equalizes fluid systems pressure to -15 pressure units. Jams when the pressure decreases too fast.

block.omaloon-liquid-gauge.name = Liquid Gauge
block.omaloon-liquid-gauge.description = Displays the amount of pressure inside it.

block.omaloon-liquid-bridge.name = Liquid Bridge
block.omaloon-liquid-bridge.description = Transports liquids over terrain or buildings.

Expand Down Expand Up @@ -327,23 +333,44 @@ block.omaloon-hammer-drill.description = When placed on ore, outputs items. Effi

## stats
category.omaloon-pressure = Pressure
stat.omaloon-consumepressure = Consume Pressure
stat.omaloon-minpressure = Min Pressure
stat.omaloon-maxpressure = Max Pressure

stat.omaloon-max-speed = Max Speed
stat.omaloon-min-speed = Min Speed
stat.omaloon-outputpressure = Output Pressure

air = Air

stat.omaloon-fluid-capacity = Fluid Capacity
stat.omaloon-fluid-capacity.format = @x@x@ Blocks

stat.omaloon-density = Density
stat.omaloon-viscosity = @% (\uC357 @)

stat.omaloon-pump-strength = Pump Strength
stat.omaloon-pressure-gradient = Pressure Gradient

stat.omaloon-min-pressure = Min Pressure
stat.omaloon-max-pressure = Max Pressure

stat.omaloon-pressureflow = Speed
stat.omaloon-pressurerange = Operating Range
stat.omaloon-pressurerange.format = from \uC357 @ pressure units to \uC357 @ pressure units.
stat.omaloon-pressure-range = Operating Range
stat.omaloon-pressure-range.format = \uC357 @ to @ Pressure Units.
stat.omaloon-optimal-pressure = Optimal Pressure
stat.omaloon-optimal-pressure.format = \uC357 @ Pressure Units (@%)

## ui units
unit.omaloon-pressuresecond = pressure units / second
unit.omaloon-pressureunits = pressure units
bar.air = Air
bar.pressure-liquid = {0} (\uC357 {1}/{2})
unit.omaloon-blocks-cubed = Blocks\u00B3

unit.omaloon-density-unit = Pressure Units / Blocks\u00B3
unit.omaloon-viscosity-unit = Viscosity Units

unit.omaloon-pressure-unit = Pressure Units
unit.omaloon-pressure-second = Pressure Units / Second


bar.air = Air:
bar.pressure = Pressure:
bar.pressure-liquid = ({0}: {1} / Air: {2})
bar.hail-shield-health = Individual Shelter
omaloon-source-negative = Negative

## abilities
ability.hailshield = Individual Shelter
Expand Down
Binary file added assets/sprites/blocks/crafting/glacium-boiler.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 added assets/sprites/blocks/liquids/filter-pump-arrow.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 added assets/sprites/blocks/liquids/filter-pump-filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/liquids/filter-pump-top.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 added assets/sprites/blocks/liquids/filter-pump.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/liquids/liquid-gauge-tiles.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 added assets/sprites/blocks/liquids/liquid-gauge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import arc.files.Fi
import arc.util.*
import arc.util.serialization.*
import de.undercouch.gradle.tasks.download.Download
Expand Down Expand Up @@ -262,4 +263,17 @@ project(":"){
classpath(files("$rootDir/run/Mindustry.jar"))
mainClass.set("mindustry.desktop.DesktopLauncher")
}

tasks.register<DefaultTask>("install"){
dependsOn("jar")
doLast{
val folder = Fi.get(OS.getAppDataDirectoryString("Mindustry")).child("mods")
folder.mkdirs()

val input = Fi.get("$rootDir/build/libs/${project.name}Desktop.jar")
folder.child(input.name()).delete()
input.copyTo(folder)
logger.lifecycle("Copied :jar output to $folder.")
}
}
}
74 changes: 59 additions & 15 deletions src/omaloon/content/OlFx.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,26 +182,70 @@ public class OlFx {
Draw.blend();
}),

pumpFront = new Effect(60f, e -> {
Draw.alpha(e.fout() / 5f);
flowOut = new Effect(60f, e -> {
Draw.color(e.color);
Draw.alpha(e.fout() / 5);
vec.trns(e.rotation, 4f).add(e.x, e.y);
randLenVectors(e.id, 3, 16f * e.fin(), e.rotation, 10f, (x, y) -> {
Fill.circle(vec.x + x, vec.y + y, 3f * e.fin());
Angles.randLenVectors(e.id, 3, 16 * e.fin(), e.rotation, 10, (x, y) -> {
Fill.circle(vec.x + x, vec.y + y, 3 * e.fin());
});
vec.trns(e.rotation, -4f).add(e.x, e.y);
Angles.randLenVectors(e.id + 2, 3, 16 * e.fin(), e.rotation + 180, 10, (x, y) -> {
Fill.circle(vec.x + x, vec.y + y, 3 * e.fin());
});
Draw.alpha(e.fout() / 7);
Angles.randLenVectors(e.id + 1, 3, 16 * e.fin(), e.rotation + 180, 20, (x, y) -> {
Fill.rect(vec.x + x, vec.y + y, 5 * e.fin(), e.fin(), vec.angleTo(vec.x + x, vec.y + y));
});
Draw.alpha(e.fout() / 7f);
randLenVectors(e.id/2, 3, 16f * e.fin(), e.rotation, 20f, (x, y) -> {
Fill.rect(vec.x + x, vec.y + y, 5f * e.fin(), e.fin(), vec.angleTo(vec.x + x, vec.y + y));
vec.trns(e.rotation, 4f).add(e.x, e.y);
Angles.randLenVectors(e.id + 3, 3, 16 * e.fin(), e.rotation, 20, (x, y) -> {
Fill.rect(vec.x + x, vec.y + y, 5 * e.fin(), e.fin(), vec.angleTo(vec.x + x, vec.y + y));
});
}),
pumpBack = new Effect(60f, e -> {
Draw.alpha(e.fin() / 5f);
vec.trns(e.rotation, 4).add(e.x, e.y);
randLenVectors(e.id, 3, 16f * e.fout(), e.rotation, 10f, (x, y) -> {
Fill.circle(vec.x + x, vec.y + y, 3f * e.fout());
flowIn = new Effect(60f, e -> {
Draw.color(e.color);
Draw.alpha(e.fin() / 5);
vec.trns(e.rotation, 4f).add(e.x, e.y);
Angles.randLenVectors(e.id, 3, 16 * e.fout(), e.rotation, 10, (x, y) -> {
Fill.circle(vec.x + x, vec.y + y, 3 * e.fout());
});
vec.trns(e.rotation, -4f).add(e.x, e.y);
Angles.randLenVectors(e.id + 2, 3, 16 * e.fout(), e.rotation + 180, 10, (x, y) -> {
Fill.circle(vec.x + x, vec.y + y, 3 * e.fout());
});
Draw.alpha(e.fin() / 7);
Angles.randLenVectors(e.id + 1, 3, 16 * e.fout(), e.rotation + 180, 20, (x, y) -> {
Fill.rect(vec.x + x, vec.y + y, 5 * e.fout(), e.fout(), vec.angleTo(vec.x + x, vec.y + y));
});
vec.trns(e.rotation, 4f).add(e.x, e.y);
Angles.randLenVectors(e.id + 3, 3, 16 * e.fout(), e.rotation, 20, (x, y) -> {
Fill.rect(vec.x + x, vec.y + y, 5 * e.fout(), e.fout(), vec.angleTo(vec.x + x, vec.y + y));
});
}),

pumpOut = new Effect(60f, e -> {
Draw.color(e.color);
Draw.alpha(e.fout() / 5);
vec.trns(e.rotation, 4f).add(e.x, e.y);
Angles.randLenVectors(e.id, 3, 16 * e.fin(), e.rotation, 10, (x, y) -> {
Fill.circle(vec.x + x, vec.y + y, 3 * e.fin());
});
Draw.alpha(e.fout() / 7);
vec.trns(e.rotation, 4f).add(e.x, e.y);
Angles.randLenVectors(e.id + 3, 3, 16 * e.fin(), e.rotation, 20, (x, y) -> {
Fill.rect(vec.x + x, vec.y + y, 5 * e.fin(), e.fin(), vec.angleTo(vec.x + x, vec.y + y));
});
}),
pumpIn = new Effect(60f, e -> {
Draw.color(e.color);
Draw.alpha(e.fin() / 5);
vec.trns(e.rotation, 4f).add(e.x, e.y);
Angles.randLenVectors(e.id, 3, 16 * e.fout(), e.rotation, 10, (x, y) -> {
Fill.circle(vec.x + x, vec.y + y, 3 * e.fout());
});
Draw.alpha(e.fin() / 7f);
randLenVectors(e.id/2, 3, 16f * e.fout(), e.rotation, 20f, (x, y) -> {
Fill.rect(vec.x + x, vec.y + y, 5f * e.fout(), e.fout(), vec.angleTo(vec.x + x, vec.y + y));
Draw.alpha(e.fin() / 7);
Angles.randLenVectors(e.id + 3, 3, 16 * e.fout(), e.rotation, 20, (x, y) -> {
Fill.rect(vec.x + x, vec.y + y, 5 * e.fout(), e.fout(), vec.angleTo(vec.x + x, vec.y + y));
});
}),

Expand Down
47 changes: 47 additions & 0 deletions src/omaloon/content/OlLiquids.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package omaloon.content;

import arc.*;
import arc.struct.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.game.*;
import mindustry.type.*;
import mindustry.world.meta.*;
import omaloon.type.liquid.*;
import omaloon.world.meta.*;

import static arc.graphics.Color.*;

Expand All @@ -12,6 +18,9 @@ public class OlLiquids {

end;

public static ObjectFloatMap<Liquid> densities = new ObjectFloatMap<>();
public static ObjectFloatMap<Liquid> viscosities = new ObjectFloatMap<>();

public static void load(){
glacium = new CrystalLiquid("glacium", valueOf("5e929d")){{
effect = OlStatusEffects.glacied;
Expand All @@ -36,6 +45,44 @@ public static void load(){
canStayOn.add(Liquids.water);
}};

addDensity(Liquids.water, 1000);
addViscosity(Liquids.water, 10);
addDensity(Liquids.slag, 1600);
addViscosity(Liquids.slag, 250);
addDensity(Liquids.oil, 700);
addViscosity(Liquids.oil, 50);
addDensity(Liquids.cryofluid, 200);
addViscosity(Liquids.cryofluid, 1.2f);
addDensity(glacium, 1300);
addViscosity(glacium, 13);
addDensity(tiredGlacium, 1300);
addViscosity(tiredGlacium, 13);

if (Core.settings.getBool("omaloon-display-liquid-stats", true)) Events.on(EventType.ContentInitEvent.class, e -> {
densities.each(map -> {
map.key.stats.add(OlStats.density, map.value, OlStats.densityUnit);
});
viscosities.each(map -> {
map.key.checkStats();
map.key.stats.remove(Stat.viscosity);
map.key.stats.add(Stat.viscosity, Core.bundle.get("stat.omaloon-viscosity"), map.key.viscosity * 100f ,Strings.autoFixed(map.value/60f, 2) + " " + OlStats.viscosityUnit.localized());
});
});
}

public static void addDensity(Liquid liquid, float density) {
densities.put(liquid, density);
}

public static void addViscosity(Liquid liquid, float viscosity) {
viscosities.put(liquid, viscosity);
}

public static float getDensity(@Nullable Liquid liquid) {
return densities.get(liquid, 8f);
}

public static float getViscosity(@Nullable Liquid liquid) {
return viscosities.get(liquid, 1f);
}
}
12 changes: 6 additions & 6 deletions src/omaloon/content/OlTechTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public static void load() {
});

node(hammerDrill, () -> {
node(liquidTube, () -> {
node(liquidJunction, () -> {
node(liquidBridge);
});
node(liquidPump, () -> {
node(liquidValve);
node(liquidPump, () -> {
node(liquidTube, () -> {
node(liquidJunction, () -> {
node(liquidBridge);
});
});
node(liquidGauge);
});

node(carborundumPress, with(new Research(smallShelter)), () -> {
Expand Down
47 changes: 42 additions & 5 deletions src/omaloon/content/blocks/OlCraftingBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import mindustry.content.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.meta.*;
import omaloon.content.*;
import omaloon.world.blocks.production.*;
import omaloon.world.consumers.*;

import static mindustry.type.ItemStack.*;

public class OlCraftingBlocks {
public static Block carborundumPress, graphitePress;
public static Block carborundumPress, graphitePress, glaciumBoiler;

public static void load() {
carborundumPress = new PressureCrafter("carborundum-press") {{
Expand All @@ -26,8 +27,17 @@ public static void load() {
craftEffect = OlFx.carborundumCraft;

consumeItems(with(Items.beryllium, 1, OlItems.cobalt, 1));
consume(new ConsumePressure(6f, false));
consume(new PressureEfficiencyRange(5f, 50f, 1.6f, false));
consume(new ConsumeFluid(null, 5) {{
startRange = 5f;
endRange = 50f;
efficiencyMultiplier = 1.6f;
curve = t -> Math.min(
9f/2f * (1f - t),
9f/7f * t
);
optimalPressure = 40f;
hasOptimalPressure = true;
}});

outputItems = with(OlItems.carborundum, 1);
}};
Expand All @@ -44,10 +54,37 @@ public static void load() {

craftEffect = Fx.pulverizeMedium;
consumeItem(Items.coal, 4);
consume(new ConsumePressure(8f, false));
consume(new PressureEfficiencyRange(10f, 50f, 1.5f, false));
consume(new ConsumeFluid(null, 8f) {{
startRange = 10f;
endRange = 50f;
efficiencyMultiplier = 1.5f;
curve = t -> Math.min(
8f * (1f - t),
8f/7f * t
);
optimalPressure = 45f;
hasOptimalPressure = true;
}});

outputItem = new ItemStack(Items.graphite, 2);
}};

glaciumBoiler = new PressureCrafter("glacium-boiler") {{
requirements(Category.crafting, BuildVisibility.sandboxOnly, with());
size = 2;

useVanillaLiquids = false;
ignoreLiquidFullness = true;
dumpExtraLiquid = true;

craftTime = 120f;

consumeItem(Items.coal, 1);
consume(new ConsumeFluid(OlLiquids.glacium, 1f/60f) {{
continuous = true;
}});

outputAir = 4f/6f;
}};
}
}
Loading