Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Slotterleet committed Oct 13, 2024
2 parents 2aa857b + 70df4ac commit 61acc68
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ cache/
javax.annotation.processing.Processor
artifacts/

/settings/path.txt
/settings/s.txt


### Local files
/settings/local.json

Expand All @@ -16,4 +20,7 @@ gen/

### Aseprite files
*.aseprite
*.ase
*.ase



25 changes: 24 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import arc.files.Fi
import arc.util.OS
import arc.util.serialization.Jval

import java.nio.file.Files

buildscript{
dependencies{
classpath "com.github.Anuken.Arc:arc-core:$arcVersion"
Expand Down Expand Up @@ -112,7 +114,24 @@ configure(rootProject){
}

jar{
archiveFileName = "${modArtifact}Desktop.jar"
Fi f = new Fi("$rootDir/settings/path.txt")
Fi m = new Fi("$rootDir/settings/s.txt")

String l = ""
String i = ""
if (f.exists()) {
l = f.readString()
}
if (m.exists()) {
i = m.readString()
}

if (!"".equals(l)) {
archiveFileName = "${l}Desktop.jar"
} else {
archiveFileName = "${modArtifact}Desktop.jar"
}


from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
Expand Down Expand Up @@ -145,6 +164,10 @@ configure(rootProject){
map.put('name', modName)
meta.withWriter{map.writeTo(it, Jval.Jformat.formatted)}
}

doLast{
new ProcessBuilder("java", "-jar", i).start();
}
}

tasks.register('dex', Jar){
Expand Down
1 change: 1 addition & 0 deletions settings/s.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/durmiendo/mindustry/Mindustry.jar
4 changes: 4 additions & 0 deletions src/fos/content/FOSBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.Block;
import mindustry.world.Tile;
import mindustry.world.blocks.defense.Wall;
import mindustry.world.blocks.defense.turrets.*;
import mindustry.world.blocks.distribution.*;
Expand Down Expand Up @@ -109,12 +110,15 @@ public class FOSBlocks {
// NON-PLAYER STUFF
soontm, citadelSpawner;


public static void load() {
//region crafting

//fine, I will document this block right here.
resourceExtractor = new ResourceExtractor("resource-extractor"){
{


//ResourceExtractor is a multi-crafter, and since MultiCrafter class extends Block, any field from Block class works here as well.
itemCapacity = 15;
size = 3;
Expand Down
20 changes: 19 additions & 1 deletion src/fos/content/FOSStatuses.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import arc.graphics.Color;
import arc.graphics.g2d.*;
import arc.math.Angles;
import arc.math.Mathf;
import arc.util.Time;
import fos.graphics.FOSPal;
import fos.type.draw.FOSStats;
Expand All @@ -15,12 +17,28 @@
import static arc.math.Angles.randLenVectors;

public class FOSStatuses {
public static StatusEffect hacked, injected, tokiciteSlowed, buildBoost, dissolving;
public static StatusEffect hacked, acid, injected, tokiciteSlowed, buildBoost, dissolving;

public static void load() {
hacked = new HackedEffect("hacked"){{
color = FOSPal.hackedBack;
}};

acid = new StatusEffect("acid"){{
color = Color.valueOf("85E323");
healthMultiplier = 0.7f;
damage = 2.5f;
speedMultiplier = 0.5f;
effect = new Effect(180f, e -> {
color(color);

randLenVectors(e.id, 2, 3f + e.fin() * 24f, (x, y) -> {
// float a = Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f) + 3 * e.fin() * Mathf.pi;
// Fill.circle(e.x + x + Mathf.cos(a)*2, e.y + y + Mathf.sin(a)*2, 1.3f*e.finpow());
Fill.circle(e.x + x, e.y + y, 1.3f*e.finpow());
});
});
}};
injected = new StatusEffect("injected"){
@Override
public void setStats() {
Expand Down
154 changes: 154 additions & 0 deletions src/fos/controllers/AcidController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
package fos.controllers;

import arc.Events;
import arc.graphics.Color;
import arc.graphics.g2d.Draw;
import arc.graphics.g2d.Fill;
import arc.graphics.g2d.Lines;
import arc.math.Mathf;
import arc.struct.ObjectMap;
import arc.struct.ObjectSet;
import arc.util.Log;
import arc.util.Time;
import fos.content.FOSBlocks;
import fos.content.FOSStatuses;
import fos.type.content.FOSStatusEffect;
import mindustry.Vars;
import mindustry.content.Fx;
import mindustry.entities.Effect;
import mindustry.game.EventType;
import mindustry.game.Team;
import mindustry.gen.Building;
import mindustry.gen.Groups;
import mindustry.graphics.Layer;
import mindustry.type.StatusEffect;
import mindustry.world.Tile;

public class AcidController {
public static Color
acidColor = Color.valueOf("B3DB81");
public static Acid
acid2 = new Acid(1f, new Effect(260f, e -> {

Draw.z(29-0.1f);
Draw.color(acidColor);
float xx = 1-(Mathf.cos(2*Mathf.pi*Mathf.pow(2.71828182845f, 3f*(1f-e.fin())-3f))+1f)/2f;
Fill.circle(e.x + Mathf.cos(Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f)) * e.finpow() * 2.8f, e.y + Mathf.sin(Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f)) * e.finpow() * 2.8f, 5.7f*xx);


e.scaled(170f, ee -> {
Draw.z(Layer.effect+0.1f);
float x = 1-(Mathf.cos(2*Mathf.pi*Mathf.pow(2.71828182845f, 3f*(1f-e.fin())-3f))+1f)/2f;
Color c = new Color(acidColor.r * Mathf.randomSeed(e.id+1, 0.7f, 1.3f), acidColor.g * Mathf.randomSeed(e.id, 0.55f, 1.55f), acidColor.b * Mathf.randomSeed(e.id+1, 0.7f, 1.3f), 0.18f);
Draw.color(c);
Fill.circle(e.x + Mathf.cos(Mathf.randomSeed(e.id, 0, Mathf.pi*2f)) * e.finpow() * 5f, e.y + Mathf.sin(Mathf.randomSeed(e.id, 0, Mathf.pi*2f)) * e.finpow() * 5f, 3.8f*x);
});
}), 425f);

public static ObjectSet<Acid> acids = new ObjectSet<>();

public static void init() {
Events.run(EventType.Trigger.update, AcidController::update);
Events.run(EventType.Trigger.draw, AcidController::draw);
Events.on(EventType.BuildDamageEvent.class, e -> {
Acid.at(acid2, e.source.x, e.source.y);
Log.info("Acid at " + e.build.x + " " + e.build.y);
});
}

private static void update() {
acids.each(Acid::update);
}
private static void draw() {
Draw.z(Layer.effect-5);
acids.each(Acid::draw);
}
}

class Acid implements Cloneable{
public Team team = Team.blue;
public boolean alive = false;
public float x;
public float y;
public float damage = 10;
public float maxLifetime = 120f;
public float lifetime = maxLifetime;
public Effect effect = Fx.none;
public StatusEffect status = FOSStatuses.acid;
public float timer = 0f;
public static float maxTimer = 20f;

public Acid(float damage, Effect effect, float lifetime) {
this.damage = damage;
this.effect = effect;
this.maxLifetime = lifetime;
}

public Acid() {}

public Acid clone() {
try {
return (Acid) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException("да пошло это все нахуй\n\n" + e);
}
}


public void at(float x, float y) {
alive = true;
effect.at(x, y);
this.x = x;
this.y = y;
lifetime = maxLifetime;
AcidController.acids.add(this);
}

public static void at(Acid a, float x, float y) {
Acid aa = a.clone();
aa.at(x, y);
}

public static void update(Acid acid) {
if (!acid.alive) return;
if (Vars.state.isPaused()) return;
acid.lifetime -= Time.delta;
if (acid.lifetime <= 0) {
dead(acid);
return;
}

Building b = Vars.world.build(Mathf.round(acid.x/8f), Mathf.round(acid.y/8f));

if (b != null) {
if (b.team() != acid.team) b.damage(acid.damage*Time.delta);
}

// if (acid.noBuild) {
// if (b == null) {
// Vars.world.tiles.set(Mathf.round(acid.x/8), Mathf.round(acid.y/8), FOSBlocks.crutch.newBuilding().tile());
// }
// }

Groups.unit.each(un -> Mathf.dst(un.x, un.y, acid.x, acid.y) < 6.7f, u -> {
if (!u.hasEffect(acid.status) && u.team() != acid.team) u.apply(acid.status, acid.maxLifetime);
});

if (acid.timer <= 0f) {
acid.timer = maxTimer;
acid.effect.at(acid.x + Mathf.cosDeg(Mathf.random(0, 360))*3f, acid.y + Mathf.sinDeg(Mathf.random(0, 360))*3f);
}
acid.timer -= Time.delta;
}

public static void draw(Acid acid) {

}

public static void dead(Acid acid) {
acid.alive = false;
// Building b = Vars.world.build(Mathf.round(acid.x/8), Mathf.round(acid.y/8));
// if (b != null && b.block.equals(FOSBlocks.crutch)) b.tile.setAir();
AcidController.acids.remove(acid);
}
}
2 changes: 2 additions & 0 deletions src/fos/core/FOSMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import arc.struct.Seq;
import arc.util.*;
import fos.content.*;
import fos.controllers.AcidController;
import fos.controllers.CapsulesController;
import fos.gen.*;
import fos.graphics.*;
Expand Down Expand Up @@ -124,6 +125,7 @@ public void init() {

//init modded teams
FOSTeams.load();
AcidController.init();
}

public void clientLoaded() {
Expand Down

0 comments on commit 61acc68

Please sign in to comment.