Skip to content

Commit

Permalink
turret?
Browse files Browse the repository at this point in the history
  • Loading branch information
Nezerit6 committed Jun 3, 2024
1 parent b7dabb3 commit 7be9f63
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 17 deletions.
Binary file added assets/sounds/bigLaserShoot.ogg
Binary file not shown.
Binary file added assets/sprites/blocks/power/magnesiumNode-heat.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/power/magnesiumNode.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.
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.
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/turrets/StormBringer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions src/sta/Starry.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
package sta;

import arc.*;
import arc.util.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.mod.*;
import mindustry.ui.dialogs.*;
import sta.content.StarryBlocks;
import sta.content.StarryItems;
import sta.content.StarryPlanets;
import sta.content.StarrySounds;

public class Starry extends Mod{

Expand All @@ -35,9 +30,9 @@ public Starry(){
public void loadContent(){
Log.info("Loading some example content.");

StarrySounds.load();
StarryItems.load();
StarryBlocks.load();
StarryPlanets.load();
}

}
}
113 changes: 104 additions & 9 deletions src/sta/content/StarryBlocks.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
package sta.content;

import arc.graphics.Color;
import arc.util.Tmp;
import mindustry.content.Fx;
import mindustry.content.Items;
import mindustry.content.Liquids;
import mindustry.content.StatusEffects;
import mindustry.entities.bullet.BasicBulletType;
import mindustry.entities.Effect;
import mindustry.entities.Units;
import mindustry.entities.bullet.*;
import mindustry.entities.effect.MultiEffect;
import mindustry.entities.part.DrawPart;
import mindustry.entities.part.RegionPart;
import mindustry.gen.Sounds;
import mindustry.gen.Unit;
import mindustry.graphics.Pal;
import mindustry.type.Category;
import mindustry.type.ItemStack;
import mindustry.world.Block;
import mindustry.world.blocks.defense.turrets.ItemTurret;
import mindustry.world.blocks.defense.turrets.PowerTurret;
import mindustry.world.blocks.environment.Floor;
import mindustry.world.blocks.environment.OreBlock;
import mindustry.world.blocks.environment.StaticWall;
import mindustry.world.blocks.production.Drill;
import mindustry.world.draw.DrawTurret;
import sta.world.blocks.power.MagnesiumNode;

import static mindustry.type.ItemStack.with;

Expand All @@ -29,10 +35,10 @@ public class StarryBlocks {
cobaltOre, darkgrass, darkmossWall, dehydrate, dune, dunecliffWall, hematiteOre, iridiumOre, lightmossWall, pinkgrass, pinkstone,

//turrets
chire, basedTurret,
chire, basedTurret, stormBringer, test,

//production
cobaltDrill;
cobaltDrill, magnesiumNode;

public static void load() {

Expand Down Expand Up @@ -76,14 +82,17 @@ public static void load() {
pinkstone = new Floor("pinkstone"){{
}};

chire = new ItemTurret("chire"){{
/*chire = new ItemTurret("chire"){{
requirements(Category.turret, with(StarryItems.cobalt, 24));
reload = 3;
ammo(
StarryItems.cobalt, new BasicBulletType(3.4f,11){{
StarryItems.cobalt, new BasicBulletType(10.0f,4){{
width = 6;
height = 8;
lifetime = 60;
ammoPerShot = 2;
collidesTeam = true;
collidesGround = true;
}}
);
Expand Down Expand Up @@ -113,13 +122,13 @@ StarryItems.cobalt, new BasicBulletType(3.4f,11){{
coolant = consumeCoolant(0.1f);
researchCostMultiplier = 0.10f;
}};
}};*/

basedTurret = new ItemTurret("BasedTurret") {{
requirements(Category.turret, with(Items.copper, 110, Items.lead, 65, Items.titanium, 35, Items.silicon, 20));
health = 430;
rotateSpeed = 4.2f;
recoil = 1f;
recoil = 3f;
size = 2;
range = 205;
reload = 90f;
Expand All @@ -128,7 +137,7 @@ StarryItems.cobalt, new BasicBulletType(3.4f,11){{
inaccuracy = 3;
liquidCapacity = 70;
squareSprite = false;
shootSound = Sounds.laser;
shootSound = StarrySounds.bigLaserShoot;
shootEffect = Fx.none;
smokeEffect = StarryFx.laserSparks;
moveWhileCharging = false;
Expand Down Expand Up @@ -194,6 +203,80 @@ Items.silicon, new BasicBulletType(15.6f, 47){{
}};
}};

stormBringer = new PowerTurret("StormBringer"){{
requirements(Category.turret, with(StarryItems.cobalt, 1));
size = 2;
range = 130;
recoil = 2f;
reload = 420f;
health = 600;
inaccuracy = 14;
rotateSpeed = 7;

//accurateDelay = false;
shoot.shots = 32;
shoot.shotDelay = 4;
shoot.firstShotDelay = 15f;

shootEffect = Fx.sparkShoot;
shootSound = Sounds.lasershoot;

consumePower(1.4f);
coolant = consumeCoolant(0.2f);

shootType = new LaserBoltBulletType(6, 13){{
knockback = 0.3f;
lifetime = 20f;
backColor = Pal.heal;
frontColor = Color.white;
status = StatusEffects.corroded;
statusDuration = 240f;
smokeEffect = Fx.none;
hitEffect = despawnEffect = Fx.hitLaser;
hitColor = trailColor = Pal.heal;
trailLength = 2;
trailWidth = 1.8f;
}};

drawer = new DrawTurret("based-") {{
parts.addAll(
new RegionPart("-side"){{
progress = PartProgress.warmup;
mirror = true;
under = false;
moveY = 4.5f;
moves.add(new PartMove(PartProgress.heat, 0f, -4.5f, 0f));
}}
);
}};
}};

/*regeneratingBlaster = new ItemTurret("regeneratingBlaster"){{
requirements(Category.turret, with(StarryItems.cobalt, 24));
size = 1;
recoil = 1;
reload = 39;
range = 110;
health = 150;
inaccuracy = 0;
rotateSpeed = 13.4f;
shootSound = Sounds.lasershoot;
consumePower(1.4f);
researchCostMultiplier = 0.10f;
ammo(
StarryItems.cobalt, new HealBulletType(5.3f,60f){{
lifetime = 24;
ammoPerShot = 2;
}}
);
drawer = new DrawTurret("based-");
}};*/

cobaltDrill = new Drill("cobalt-drill"){{
requirements(Category.production, with(StarryItems.cobalt, 18));
tier = 1;
Expand All @@ -206,5 +289,17 @@ Items.silicon, new BasicBulletType(15.6f, 47){{
consumeLiquid(Liquids.water, 0.05f).boost();
}};

magnesiumNode = new MagnesiumNode("magnesiumNode"){{
requirements(Category.power, with(StarryItems.hematite, 10));
health = 65;
baseExplosiveness = 1;
laserRange = 5;
outputsPower = true;
//laserColor1 = Color.black;
//laserColor2 = Color.valueOf("5c5e9e");

maxNodes = 5;
//consumePowerBuffered(750f);
}};
}
}
10 changes: 10 additions & 0 deletions src/sta/content/StarryFx.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import arc.graphics.Color;
import arc.graphics.g2d.Fill;
import arc.graphics.g2d.Lines;
import arc.math.Mathf;
import mindustry.entities.Effect;
import mindustry.graphics.Pal;
Expand Down Expand Up @@ -29,5 +30,14 @@ public class StarryFx {
randLenVectors(e.id, 12, 0.4f + 37f * e.fout(), e.rotation, 360f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fslope() * 0.05f + 0.87f);
});
}),

powerSparks = new Effect(11f, e -> {
color(Color.white, e.color, e.fin());
stroke(e.fout() * 1.1f + 0.5f);
randLenVectors(e.id, 5, 15f * e.fin(), e.rotation, 360f, (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 2f + 0.5f);
});
});

}
36 changes: 36 additions & 0 deletions src/sta/content/StarrySounds.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package sta.content;

import arc.Core;
import arc.assets.AssetDescriptor;
import arc.assets.loaders.SoundLoader;
import arc.audio.Sound;
import mindustry.Vars;

public class StarrySounds {
public static Sound placeholder,

shortCircuit = new Sound(),

bigLaserShoot = new Sound(),

charge = new Sound();

protected static Sound loadSound(String fileName) {
String name = "sounds/" + fileName;
String path = Vars.tree.get(name + ".ogg").exists() ? name + ".ogg" : name + ".mp3";

Sound sound = new Sound();

AssetDescriptor<?> desc = Core.assets.load(path, Sound.class, new SoundLoader.SoundParameter(sound));
desc.errored = Throwable::printStackTrace;

return sound;
}
public static void load() {
if (Vars.headless) return;

shortCircuit = loadSound("shortCircuit");
bigLaserShoot = loadSound("bigLaserShoot");
charge = loadSound("charge");
}
}

0 comments on commit 7be9f63

Please sign in to comment.