BaseShield for testing

This commit is contained in:
Anuken
2022-02-07 13:04:02 -05:00
parent c1bd5ae9c7
commit f0a4753180
16 changed files with 101 additions and 51 deletions

View File

@@ -65,8 +65,6 @@ public class Vars implements Loadable{
public static final String ghApi = "https://api.github.com";
/** URL for discord invite. */
public static final String discordURL = "https://discord.gg/mindustry";
/** URL for sending crash reports to. Currently offline. */
public static final String crashReportURL = "http://192.99.169.18/report";
/** URL the links to the wiki's modding guide.*/
public static final String modGuideURL = "https://mindustrygame.github.io/wiki/modding/1-modding/";
/** URL to the JSON file containing all the BE servers. Only queried in BE. */

View File

@@ -86,6 +86,8 @@ public class Blocks{
//defense - erekir
buildTower,
regenProjector, barrierProjector,
//campaign only
shieldProjector,
//transport
conveyor, titaniumConveyor, plastaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router,
@@ -1713,8 +1715,9 @@ public class Blocks{
}});
}};
//TODO implement
if(false)
barrierProjector = new DirectionalForceProjector("barrier-projector"){{
//TODO
requirements(Category.effect, with(Items.surgeAlloy, 100, Items.silicon, 125));
size = 3;
width = 50f;
@@ -1726,6 +1729,16 @@ public class Blocks{
consumes.power(4f);
}};
//TODO 5x5??
shieldProjector = new BaseShield("shield-projector"){{
category = Category.effect;
buildVisibility = BuildVisibility.editorOnly;
size = 3;
consumes.power(5f);
}};
//endregion
//region distribution
@@ -2231,7 +2244,7 @@ public class Blocks{
//TODO rename
chemicalCombustionChamber = new ConsumeGenerator("chemical-combustion-chamber"){{
requirements(Category.power, with(Items.graphite, 40, Items.tungsten, 40, Items.oxide, 40f, Items.silicon, 30));
powerProduction = 8f;
powerProduction = 9f;
consumes.liquids(LiquidStack.with(Liquids.ozone, 1f / 60f, Liquids.arkycite, 20f / 60f));
size = 3;
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawPistons(){{
@@ -2255,7 +2268,7 @@ public class Blocks{
pyrolysisGenerator = new ConsumeGenerator("pyrolysis-generator"){{
//TODO requirements
requirements(Category.power, with(Items.graphite, 50, Items.carbide, 50, Items.oxide, 60f, Items.silicon, 50));
powerProduction = 16f;
powerProduction = 18f;
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawPistons(){{
sinMag = 2.75f;

View File

@@ -1553,6 +1553,15 @@ public class Fx{
}
}),
circleColorSpark = new Effect(21f, e -> {
color(Color.white, e.color, e.fin());
stroke(e.fout() * 1.1f + 0.5f);
randLenVectors(e.id, 9, 27f * e.fin(), 9f, (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 5f + 0.5f);
});
}),
colorSpark = new Effect(21f, e -> {
color(Color.white, e.color, e.fin());
stroke(e.fout() * 1.1f + 0.5f);

View File

@@ -3185,54 +3185,51 @@ public class UnitTypes{
envDisabled = 0;
lowAltitude = false;
flying = true;
mineWalls = true;
targetAir = false;
mineFloor = false;
mineHardnessScaling = false;
mineSpeed = 5f;
flying = true;
mineSpeed = 4f;
mineTier = 4;
buildSpeed = 1.4f;
drag = 0.06f;
speed = 2.8f;
rotateSpeed = 5f;
accel = 0.11f;
buildSpeed = 1.1f;
drag = 0.08f;
speed = 6.5f;
rotateSpeed = 8f;
accel = 0.09f;
itemCapacity = 90;
health = 600f;
health = 500f;
armor = 2f;
hitSize = 18f;
buildBeamOffset = 10f;
engineSize = 0;
payloadCapacity = Mathf.sqr(2f) * tilePayload;
hitSize = 11f;
engineOffset = 15 / 4f;
engineSize = 4;
setEnginesMirror(
new UnitEngine(34 / 4f, 31 / 4f, 3f, 45f),
new UnitEngine(35 / 4f, -38 / 4f, 3f, 315f)
new UnitEngine(23 / 4f, 4 / 4f, 2.4f, 315f)
);
weapons.add(new Weapon("incite-weapon"){{
reload = 30f;
x = 4f;
y = 6.25f;
shootY = 5.75f;
recoil = 2f;
top = false;
layerOffset = -0.01f;
weapons.add(new RepairBeamWeapon(){{
reload = 25f;
x = 0f;
y = 6.5f;
rotate = false;
shootY = 0f;
beamWidth = 0.7f;
repairSpeed = 0.3f;
aimDst = 0f;
shootCone = 15f;
fractionRepair = true;
mirror = false;
bullet = new BasicBulletType(5f, 15){{
width = 7f;
height = 12f;
shootEffect = Fx.sparkShoot;
smokeEffect = Fx.shootBigSmoke;
pierceCap = 2;
pierce = true;
pierceBuilding = true;
hitColor = backColor = trailColor = Pal.bulletYellowBack;
frontColor = Color.white;
trailWidth = 1.5f;
trailLength = 7;
hitEffect = despawnEffect = Fx.hitBulletColor;
targetUnits = false;
targetBuildings = true;
autoTarget = false;
controllable = true;
laserColor = Pal.accent;
healColor = Pal.accent;
bullet = new BulletType(){{
maxRange = 60f;
}};
}});
}};

View File

@@ -30,7 +30,10 @@ public class BaseGenerator{
private Seq<Tile> cores;
public static Block getDifficultyWall(int size, float difficulty){
Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == size && !b.insulated && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == size
&& !b.insulated && b.buildVisibility == BuildVisibility.shown
&& !(b instanceof Door)
&& !(Structs.contains(b.requirements, i -> state.rules.hiddenBuildItems.contains(i.item))));
wallsSmall.sort(b -> b.buildCost);
return wallsSmall.getFrac(difficulty * 0.91f);
}

View File

@@ -5,7 +5,7 @@ import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.graphics.*;
@@ -15,7 +15,7 @@ import static mindustry.Vars.*;
public class BaseShield extends Block{
//TODO game rule? or field? should vary by base.
//public float radius = 400f;
public float radius = 200f;
protected static BaseShieldBuild paramBuild;
//protected static Effect paramEffect;
@@ -35,20 +35,41 @@ public class BaseShield extends Block{
float overlapDst = (unit.hitSize/2f + paramBuild.radius()) - unit.dst(paramBuild);
if(overlapDst > 0){
if(overlapDst > unit.hitSize){
if(overlapDst > unit.hitSize * 1.5f){
//instakill units that are stuck inside the shield (TODO or maybe damage them instead?)
unit.kill();
}else{
unit.move(Tmp.v1.set(unit).sub(paramBuild).setLength(overlapDst));
//stop
unit.vel.setZero();
//get out
unit.move(Tmp.v1.set(unit).sub(paramBuild).setLength(overlapDst + 0.01f));
if(Mathf.chanceDelta(0.12f * Time.delta)){
Fx.circleColorSpark.at(unit.x, unit.y, paramBuild.team.color);
}
}
}
};
public BaseShield(String name){
super(name);
hasPower = true;
update = solid = true;
}
@Override
public void init(){
super.init();
clipSize = Math.max(clipSize, radius * 2f + 8f);
}
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, radius, player.team().color);
}
public class BaseShieldBuild extends Building{
@@ -60,17 +81,26 @@ public class BaseShield extends Block{
//TODO smooth radius
float radius = radius();
broken = efficiency() <= 0.0001f;
if(radius > 0 && !broken){
paramBuild = this;
//paramEffect = absorbEffect;
Groups.bullet.intersect(x - radius, y - radius, radius * 2f, radius * 2f, bulletConsumer);
Units.nearbyEnemies(team,x ,y, radius, unitConsumer);
Units.nearbyEnemies(team, x, y, radius + 10f, unitConsumer);
}
}
public float radius(){
//TODO bad rule?
return Vars.state.rules.enemyCoreBuildRadius;
return radius * efficiency();
}
@Override
public void drawSelect(){
super.drawSelect();
Drawf.dashCircle(x, y, radius, team.color);
}
@Override

View File

@@ -446,7 +446,6 @@ public class UnitAssembler extends PayloadBlock{
public boolean checkSolid(Vec2 v, boolean same){
var output = unit();
//TODO CHECK TO MAKE SURE IT'S NOT THE SAME UNIT
float hsize = output.hitSize * 1.4f;
return !output.flying && (collisions.overlapsTile(Tmp.r1.setCentered(v.x, v.y, output.hitSize), EntityCollisions::solid) ||
(!same ? Units.anyEntities(v.x, v.y, hsize) : Units.anyEntities(v.x - hsize/2f, v.y - hsize/2f, hsize, hsize, u -> u.type != output && u.isGrounded())));