mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-05 13:08:20 +07:00
Circular sector maps
This commit is contained in:
parent
da2cc292c3
commit
53996d8a8d
@ -254,7 +254,7 @@ project(":core"){
|
||||
compile arcModule("extensions:freetype")
|
||||
compile arcModule("extensions:g3d")
|
||||
compile arcModule("extensions:arcnet")
|
||||
compile "org.mozilla:rhino:1.7.11"
|
||||
compile "org.mozilla:rhino-runtime:1.7.12"
|
||||
if(localArc() && debugged()) compile arcModule("extensions:recorder")
|
||||
|
||||
compileOnly project(":annotations")
|
||||
|
@ -7,6 +7,7 @@ import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
public class UnitTypes implements ContentList{
|
||||
//TODO reimplement
|
||||
public static UnitType
|
||||
wraith, ghoul, revenant, lich, reaper,
|
||||
crawler, titan, fortress, eruptor, chaosArray, eradicator;
|
||||
@ -104,32 +105,16 @@ public class UnitTypes implements ContentList{
|
||||
buildSpeed = 0.4f;
|
||||
engineOffset = 6.5f;
|
||||
}};
|
||||
|
||||
|
||||
/*
|
||||
dagger = new UnitDef("dagger", GroundUnit::new){{
|
||||
maxVelocity = 1.1f;
|
||||
speed = 0.2f;
|
||||
drag = 0.4f;
|
||||
hitsize = 8f;
|
||||
mass = 1.75f;
|
||||
health = 130;
|
||||
weapon = new Weapon("chain-blaster"){{
|
||||
length = 1.5f;
|
||||
reload = 28f;
|
||||
alternate = true;
|
||||
ejectEffect = Fx.shellEjectSmall;
|
||||
bullet = Bullets.standardCopper;
|
||||
}};
|
||||
}};
|
||||
|
||||
crawler = new UnitDef("crawler", GroundUnit::new){{
|
||||
crawler = new UnitType("crawler", GroundUnit::new){{
|
||||
maxVelocity = 1.27f;
|
||||
speed = 0.285f;
|
||||
drag = 0.4f;
|
||||
hitsize = 8f;
|
||||
mass = 1.75f;
|
||||
health = 120;
|
||||
weapon = new Weapon(){{
|
||||
weapons.add(new Weapon(){{
|
||||
reload = 12f;
|
||||
ejectEffect = Fx.none;
|
||||
shootSound = Sounds.explosion;
|
||||
@ -142,10 +127,10 @@ public class UnitTypes implements ContentList{
|
||||
splashDamage = 30f;
|
||||
killShooter = true;
|
||||
}};
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
titan = new UnitDef("titan", GroundUnit::new){{
|
||||
titan = new UnitType("titan", GroundUnit::new){{
|
||||
maxVelocity = 0.8f;
|
||||
speed = 0.22f;
|
||||
drag = 0.4f;
|
||||
@ -155,7 +140,7 @@ public class UnitTypes implements ContentList{
|
||||
rotatespeed = 0.1f;
|
||||
health = 460;
|
||||
immunities.add(StatusEffects.burning);
|
||||
weapon = new Weapon("flamethrower"){{
|
||||
weapons.add(new Weapon("flamethrower"){{
|
||||
shootSound = Sounds.flame;
|
||||
length = 1f;
|
||||
reload = 14f;
|
||||
@ -163,10 +148,10 @@ public class UnitTypes implements ContentList{
|
||||
recoil = 1f;
|
||||
ejectEffect = Fx.none;
|
||||
bullet = Bullets.basicFlame;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
fortress = new UnitDef("fortress", GroundUnit::new){{
|
||||
fortress = new UnitType("fortress", GroundUnit::new){{
|
||||
maxVelocity = 0.78f;
|
||||
speed = 0.15f;
|
||||
drag = 0.4f;
|
||||
@ -175,7 +160,7 @@ public class UnitTypes implements ContentList{
|
||||
rotatespeed = 0.06f;
|
||||
targetAir = false;
|
||||
health = 750;
|
||||
weapon = new Weapon("artillery"){{
|
||||
weapons.add(new Weapon("artillery"){{
|
||||
length = 1f;
|
||||
reload = 60f;
|
||||
width = 10f;
|
||||
@ -185,10 +170,10 @@ public class UnitTypes implements ContentList{
|
||||
ejectEffect = Fx.shellEjectMedium;
|
||||
bullet = Bullets.artilleryUnit;
|
||||
shootSound = Sounds.artillery;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
eruptor = new UnitDef("eruptor", GroundUnit::new){{
|
||||
eruptor = new UnitType("eruptor", GroundUnit::new){{
|
||||
maxVelocity = 0.81f;
|
||||
speed = 0.16f;
|
||||
drag = 0.4f;
|
||||
@ -198,7 +183,7 @@ public class UnitTypes implements ContentList{
|
||||
targetAir = false;
|
||||
health = 600;
|
||||
immunities = ObjectSet.with(StatusEffects.burning, StatusEffects.melting);
|
||||
weapon = new Weapon("eruption"){{
|
||||
weapons.add(new Weapon("eruption"){{
|
||||
length = 3f;
|
||||
reload = 10f;
|
||||
alternate = true;
|
||||
@ -207,10 +192,10 @@ public class UnitTypes implements ContentList{
|
||||
recoil = 1f;
|
||||
width = 7f;
|
||||
shootSound = Sounds.flame;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
chaosArray = new UnitDef("chaos-array", GroundUnit::new){{
|
||||
chaosArray = new UnitType("chaos-array", GroundUnit::new){{
|
||||
maxVelocity = 0.68f;
|
||||
speed = 0.12f;
|
||||
drag = 0.4f;
|
||||
@ -218,7 +203,7 @@ public class UnitTypes implements ContentList{
|
||||
hitsize = 20f;
|
||||
rotatespeed = 0.06f;
|
||||
health = 3000;
|
||||
weapon = new Weapon("chaos"){{
|
||||
weapons.add(new Weapon("chaos"){{
|
||||
length = 8f;
|
||||
reload = 50f;
|
||||
width = 17f;
|
||||
@ -231,10 +216,10 @@ public class UnitTypes implements ContentList{
|
||||
ejectEffect = Fx.shellEjectMedium;
|
||||
bullet = Bullets.flakSurge;
|
||||
shootSound = Sounds.shootBig;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
eradicator = new UnitDef("eradicator", GroundUnit::new){{
|
||||
eradicator = new UnitType("eradicator", GroundUnit::new){{
|
||||
maxVelocity = 0.68f;
|
||||
speed = 0.12f;
|
||||
drag = 0.4f;
|
||||
@ -242,7 +227,7 @@ public class UnitTypes implements ContentList{
|
||||
hitsize = 20f;
|
||||
rotatespeed = 0.06f;
|
||||
health = 9000;
|
||||
weapon = new Weapon("eradication"){{
|
||||
weapons.add(new Weapon("eradication"){{
|
||||
length = 13f;
|
||||
reload = 30f;
|
||||
width = 22f;
|
||||
@ -256,10 +241,10 @@ public class UnitTypes implements ContentList{
|
||||
ejectEffect = Fx.shellEjectMedium;
|
||||
bullet = Bullets.standardThoriumBig;
|
||||
shootSound = Sounds.shootBig;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
wraith = new UnitDef("wraith", FlyingUnit::new){{
|
||||
wraith = new UnitType("wraith", FlyingUnit::new){{
|
||||
speed = 0.3f;
|
||||
maxVelocity = 1.9f;
|
||||
drag = 0.01f;
|
||||
@ -268,17 +253,17 @@ public class UnitTypes implements ContentList{
|
||||
health = 75;
|
||||
engineOffset = 5.5f;
|
||||
range = 140f;
|
||||
weapon = new Weapon(){{
|
||||
weapons.add(new Weapon(){{
|
||||
length = 1.5f;
|
||||
reload = 28f;
|
||||
alternate = true;
|
||||
ejectEffect = Fx.shellEjectSmall;
|
||||
bullet = Bullets.standardCopper;
|
||||
shootSound = Sounds.shoot;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
ghoul = new UnitDef("ghoul", FlyingUnit::new){{
|
||||
ghoul = new UnitType("ghoul", FlyingUnit::new){{
|
||||
health = 220;
|
||||
speed = 0.2f;
|
||||
maxVelocity = 1.4f;
|
||||
@ -288,7 +273,7 @@ public class UnitTypes implements ContentList{
|
||||
targetAir = false;
|
||||
engineOffset = 7.8f;
|
||||
range = 140f;
|
||||
weapon = new Weapon(){{
|
||||
weapons.add(new Weapon(){{
|
||||
length = 0f;
|
||||
width = 2f;
|
||||
reload = 12f;
|
||||
@ -299,10 +284,10 @@ public class UnitTypes implements ContentList{
|
||||
ignoreRotation = true;
|
||||
bullet = Bullets.bombExplosive;
|
||||
shootSound = Sounds.none;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
revenant = new UnitDef("revenant", HoverUnit::new){{
|
||||
revenant = new UnitType("revenant", HoverUnit::new){{
|
||||
health = 1000;
|
||||
mass = 5f;
|
||||
hitsize = 20f;
|
||||
@ -312,13 +297,13 @@ public class UnitTypes implements ContentList{
|
||||
range = 80f;
|
||||
shootCone = 40f;
|
||||
flying = true;
|
||||
rotateWeapon = true;
|
||||
//rotateWeapons = true;
|
||||
engineOffset = 12f;
|
||||
engineSize = 3f;
|
||||
rotatespeed = 0.01f;
|
||||
attackLength = 90f;
|
||||
baseRotateSpeed = 0.06f;
|
||||
weapon = new Weapon("revenant-missiles"){{
|
||||
weapons.add(new Weapon("revenant-missiles"){{
|
||||
length = 3f;
|
||||
reload = 70f;
|
||||
width = 10f;
|
||||
@ -330,10 +315,10 @@ public class UnitTypes implements ContentList{
|
||||
spacing = 1f;
|
||||
shootSound = Sounds.missile;
|
||||
bullet = Bullets.missileRevenant;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
lich = new UnitDef("lich", HoverUnit::new){{
|
||||
lich = new UnitType("lich", HoverUnit::new){{
|
||||
health = 6000;
|
||||
mass = 20f;
|
||||
hitsize = 40f;
|
||||
@ -343,13 +328,13 @@ public class UnitTypes implements ContentList{
|
||||
range = 80f;
|
||||
shootCone = 20f;
|
||||
flying = true;
|
||||
rotateWeapon = true;
|
||||
//rotateWeapons = true;
|
||||
engineOffset = 21;
|
||||
engineSize = 5.3f;
|
||||
rotatespeed = 0.01f;
|
||||
attackLength = 90f;
|
||||
baseRotateSpeed = 0.04f;
|
||||
weapon = new Weapon("lich-missiles"){{
|
||||
weapons.add(new Weapon("lich-missiles"){{
|
||||
length = 4f;
|
||||
reload = 160f;
|
||||
width = 22f;
|
||||
@ -363,10 +348,10 @@ public class UnitTypes implements ContentList{
|
||||
spacing = 1f;
|
||||
bullet = Bullets.missileRevenant;
|
||||
shootSound = Sounds.artillery;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
reaper = new UnitDef("reaper", HoverUnit::new){{
|
||||
reaper = new UnitType("reaper", HoverUnit::new){{
|
||||
health = 11000;
|
||||
mass = 30f;
|
||||
hitsize = 56f;
|
||||
@ -376,12 +361,12 @@ public class UnitTypes implements ContentList{
|
||||
range = 80f;
|
||||
shootCone = 30f;
|
||||
flying = true;
|
||||
rotateWeapon = true;
|
||||
//rotateWeapons = true;
|
||||
engineOffset = 40;
|
||||
engineSize = 7.3f;
|
||||
rotatespeed = 0.01f;
|
||||
baseRotateSpeed = 0.04f;
|
||||
weapon = new Weapon("reaper-gun"){{
|
||||
weapons.add(new Weapon("reaper-gun"){{
|
||||
length = 3f;
|
||||
reload = 10f;
|
||||
width = 32f;
|
||||
@ -405,12 +390,12 @@ public class UnitTypes implements ContentList{
|
||||
}
|
||||
};
|
||||
shootSound = Sounds.shootBig;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
|
||||
/*
|
||||
vanguard = new UnitDef("vanguard-ship"){
|
||||
vanguard = new UnitType("vanguard-ship"){
|
||||
float healRange = 60f;
|
||||
float healReload = 200f;
|
||||
float healPercent = 10f;
|
||||
@ -428,7 +413,7 @@ public class UnitTypes implements ContentList{
|
||||
engineColor = Pal.lightTrail;
|
||||
cellTrnsY = 1f;
|
||||
buildSpeed = 1.2f;
|
||||
weapon = new Weapon("vanguard-blaster"){{
|
||||
weapons.add(new Weapon("vanguard-blaster"){{
|
||||
length = 1.5f;
|
||||
reload = 30f;
|
||||
alternate = true;
|
||||
@ -446,8 +431,8 @@ public class UnitTypes implements ContentList{
|
||||
lifetime = 40f;
|
||||
shootEffect = Fx.shootHealYellow;
|
||||
smokeEffect = hitEffect = despawnEffect = Fx.hitYellowLaser;
|
||||
}};
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -468,7 +453,7 @@ public class UnitTypes implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
alpha = new UnitDef("alpha-mech", false){
|
||||
alpha = new UnitType("alpha-mech", false){
|
||||
{
|
||||
drillTier = -1;
|
||||
speed = 0.5f;
|
||||
@ -481,7 +466,7 @@ public class UnitTypes implements ContentList{
|
||||
weaponOffsetY = -1;
|
||||
engineColor = Pal.heal;
|
||||
|
||||
weapon = new Weapon("shockgun"){{
|
||||
weapons.add(new Weapon("shockgun"){{
|
||||
shake = 2f;
|
||||
length = 0.5f;
|
||||
reload = 70f;
|
||||
@ -497,8 +482,8 @@ public class UnitTypes implements ContentList{
|
||||
sideWidth = 1f;
|
||||
sideLength = 70f;
|
||||
colors = new Color[]{Pal.heal.cpy().a(0.4f), Pal.heal, Color.white};
|
||||
}};
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -508,7 +493,7 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
};
|
||||
|
||||
delta = new UnitDef("delta-mech", false){
|
||||
delta = new UnitType("delta-mech", false){
|
||||
{
|
||||
drillPower = 1;
|
||||
mineSpeed = 1.5f;
|
||||
@ -521,7 +506,7 @@ public class UnitTypes implements ContentList{
|
||||
health = 250f;
|
||||
weaponOffsetX = 4f;
|
||||
|
||||
weapon = new Weapon("flamethrower"){{
|
||||
weapons.add(new Weapon("flamethrower"){{
|
||||
length = 1.5f;
|
||||
reload = 30f;
|
||||
width = 4f;
|
||||
@ -533,12 +518,12 @@ public class UnitTypes implements ContentList{
|
||||
damage = 5;
|
||||
lightningLength = 10;
|
||||
lightningColor = Pal.lightFlame;
|
||||
}};
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
tau = new UnitDef("tau-mech", false){
|
||||
tau = new UnitType("tau-mech", false){
|
||||
float healRange = 60f;
|
||||
float healAmount = 10f;
|
||||
float healReload = 160f;
|
||||
@ -559,7 +544,7 @@ public class UnitTypes implements ContentList{
|
||||
buildSpeed = 1.6f;
|
||||
engineColor = Pal.heal;
|
||||
|
||||
weapon = new Weapon("heal-blaster"){{
|
||||
weapons.add(new Weapon("heal-blaster"){{
|
||||
length = 1.5f;
|
||||
reload = 24f;
|
||||
alternate = false;
|
||||
@ -591,7 +576,7 @@ public class UnitTypes implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
omega = new UnitDef("omega-mech", false){
|
||||
omega = new UnitType("omega-mech", false){
|
||||
protected TextureRegion armorRegion;
|
||||
|
||||
{
|
||||
@ -607,7 +592,7 @@ public class UnitTypes implements ContentList{
|
||||
engineColor = Color.valueOf("feb380");
|
||||
health = 350f;
|
||||
buildSpeed = 1.5f;
|
||||
weapon = new Weapon("swarmer"){{
|
||||
weapons.add(new Weapon("swarmer"){{
|
||||
length = 1.5f;
|
||||
recoil = 4f;
|
||||
reload = 38f;
|
||||
@ -663,7 +648,7 @@ public class UnitTypes implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
dart = new UnitDef("dart-ship"){
|
||||
dart = new UnitType("dart-ship"){
|
||||
float effectRange = 60f;
|
||||
float effectReload = 60f * 5;
|
||||
float effectDuration = 60f * 10f;
|
||||
@ -680,7 +665,7 @@ public class UnitTypes implements ContentList{
|
||||
engineColor = Pal.lightTrail;
|
||||
cellTrnsY = 1f;
|
||||
buildSpeed = 1.1f;
|
||||
weapon = new Weapon("blaster"){{
|
||||
weapons.add(new Weapon("blaster"){{
|
||||
length = 1.5f;
|
||||
reload = 15f;
|
||||
alternate = true;
|
||||
@ -709,7 +694,7 @@ public class UnitTypes implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
javelin = new UnitDef("javelin-ship"){
|
||||
javelin = new UnitType("javelin-ship"){
|
||||
float minV = 3.6f;
|
||||
float maxV = 6f;
|
||||
TextureRegion shield;
|
||||
@ -723,7 +708,7 @@ public class UnitTypes implements ContentList{
|
||||
health = 170f;
|
||||
engineColor = Color.valueOf("d3ddff");
|
||||
cellTrnsY = 1f;
|
||||
weapon = new Weapon("missiles"){{
|
||||
weapons.add(new Weapon("missiles"){{
|
||||
length = 1.5f;
|
||||
reload = 70f;
|
||||
shots = 4;
|
||||
@ -774,7 +759,7 @@ public class UnitTypes implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
trident = new UnitDef("trident-ship"){
|
||||
trident = new UnitType("trident-ship"){
|
||||
{
|
||||
flying = true;
|
||||
drillPower = 2;
|
||||
@ -787,7 +772,7 @@ public class UnitTypes implements ContentList{
|
||||
engineColor = Color.valueOf("84f491");
|
||||
cellTrnsY = 1f;
|
||||
buildSpeed = 2.5f;
|
||||
weapon = new Weapon("bomber"){{
|
||||
weapons.add(new Weapon("bomber"){{
|
||||
length = 0f;
|
||||
width = 2f;
|
||||
reload = 25f;
|
||||
@ -806,8 +791,8 @@ public class UnitTypes implements ContentList{
|
||||
shootEffect = Fx.none;
|
||||
smokeEffect = Fx.none;
|
||||
shootSound = Sounds.artillery;
|
||||
}};
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -816,7 +801,7 @@ public class UnitTypes implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
glaive = new UnitDef("glaive-ship"){
|
||||
glaive = new UnitType("glaive-ship"){
|
||||
{
|
||||
flying = true;
|
||||
drillPower = 4;
|
||||
@ -830,7 +815,7 @@ public class UnitTypes implements ContentList{
|
||||
cellTrnsY = 1f;
|
||||
buildSpeed = 1.2f;
|
||||
|
||||
weapon = new Weapon("bomber"){{
|
||||
weapons.add(new Weapon("bomber"){{
|
||||
length = 1.5f;
|
||||
reload = 13f;
|
||||
alternate = true;
|
||||
|
@ -195,6 +195,7 @@ public class World{
|
||||
}
|
||||
|
||||
public void loadSector(Sector sector){
|
||||
state.rules.sector = sector;
|
||||
int size = (int)(sector.rect.radius * 2500);
|
||||
|
||||
loadGenerator(size, size, tiles -> {
|
||||
@ -206,7 +207,7 @@ public class World{
|
||||
sector.planet.generator.generate(position, gen);
|
||||
tiles.set(x, y, new Tile(x, y, gen.floor, gen.overlay, gen.block));
|
||||
});
|
||||
sector.planet.generator.decorate(tiles);
|
||||
sector.planet.generator.decorate(tiles, sector);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,14 @@
|
||||
package mindustry.graphics;
|
||||
|
||||
import arc.*;
|
||||
import arc.struct.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.Texture.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.graphics.gl.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.noise.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.Teams.*;
|
||||
@ -75,15 +76,11 @@ public class BlockRenderer implements Disposable{
|
||||
for(int x = 0; x < world.width(); x++){
|
||||
for(int y = 0; y < world.height(); y++){
|
||||
Tile tile = world.rawTile(x, y);
|
||||
int edgeBlend = 2;
|
||||
float rot = tile.rotation();
|
||||
boolean fillable = (tile.block().solid && tile.block().fillsTile && !tile.block().synthetic());
|
||||
int edgeDst = Math.min(x, Math.min(y, Math.min(Math.abs(x - (world.width() - 1)), Math.abs(y - (world.height() - 1)))));
|
||||
if(edgeDst <= edgeBlend){
|
||||
rot = Math.max((edgeBlend - edgeDst) * (4f / edgeBlend), fillable ? rot : 0);
|
||||
}
|
||||
if(rot > 0 && (fillable || edgeDst <= edgeBlend)){
|
||||
Draw.color(0f, 0f, 0f, Math.min((rot + 0.5f) / 4f, 1f));
|
||||
|
||||
float darkness = getDarkness(x, y);
|
||||
|
||||
if(darkness > 0){
|
||||
Draw.color(0f, 0f, 0f, Math.min((darkness + 0.5f) / 4f, 1f));
|
||||
Fill.rect(tile.x + 0.5f, tile.y + 0.5f, 1, 1);
|
||||
}
|
||||
}
|
||||
@ -108,6 +105,33 @@ public class BlockRenderer implements Disposable{
|
||||
});
|
||||
}
|
||||
|
||||
public float getDarkness(int x, int y){
|
||||
int edgeBlend = 2;
|
||||
|
||||
float dark = 0;
|
||||
int edgeDst = Math.min(x, Math.min(y, Math.min(Math.abs(x - (world.width() - 1)), Math.abs(y - (world.height() - 1)))));
|
||||
if(edgeDst <= edgeBlend){
|
||||
dark = Math.max((edgeBlend - edgeDst) * (4f / edgeBlend), dark);
|
||||
}
|
||||
|
||||
//TODO tweak noise and radius
|
||||
if(world.isCampaign()){
|
||||
int circleBlend = 14;
|
||||
float rawDst = Mathf.dst(x, y, world.width() / 2, world.height() / 2) + Noise.nnoise(x, y, 7f, 8f) + Noise.nnoise(x, y, 20f, 25f);
|
||||
int circleDst = (int)(rawDst - (world.width() / 2 - circleBlend));
|
||||
if(circleDst > 0){
|
||||
dark = Math.max(circleDst / 1.4f, dark);
|
||||
}
|
||||
}
|
||||
|
||||
Tile tile = world.rawTile(x, y);
|
||||
if(tile.block().solid && tile.block().fillsTile && !tile.block().synthetic()){
|
||||
dark = Math.max(dark, tile.rotation());
|
||||
}
|
||||
|
||||
return dark;
|
||||
}
|
||||
|
||||
public void drawFog(){
|
||||
float ww = world.width() * tilesize, wh = world.height() * tilesize;
|
||||
float x = camera.position.x + tilesize / 2f, y = camera.position.y + tilesize / 2f;
|
||||
|
@ -1,19 +1,19 @@
|
||||
package mindustry.graphics;
|
||||
|
||||
import arc.*;
|
||||
import arc.struct.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.Pixmap.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.pooling.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.io.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
@ -161,7 +161,10 @@ public class MinimapRenderer implements Disposable{
|
||||
if(bc != 0){
|
||||
return bc;
|
||||
}
|
||||
return Tmp.c1.set(MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.team())).mul(tile.block().cacheLayer == CacheLayer.walls ? 1f - tile.rotation() / 4f : 1f).rgba();
|
||||
Color color = Tmp.c1.set(MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.team()));
|
||||
color.mul(1f - Mathf.clamp(renderer.blocks.getDarkness(tile.x, tile.y) / 4f));
|
||||
|
||||
return color.rgba();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,7 +122,7 @@ public class PlanetRenderer implements PlanetGenerator{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorate(Tiles tiles){
|
||||
public void decorate(Tiles tiles, Sector sec){
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,12 @@ package mindustry.maps.planet;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.math.geom.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public interface PlanetGenerator{
|
||||
float getHeight(Vec3 position);
|
||||
Color getColor(Vec3 position);
|
||||
void generate(Vec3 position, TileGen tile);
|
||||
void decorate(Tiles tiles);
|
||||
void decorate(Tiles tiles, Sector sec);
|
||||
}
|
||||
|
@ -6,14 +6,19 @@ import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.noise.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
//TODO refactor into generic planet class
|
||||
public class TestPlanetGenerator implements PlanetGenerator{
|
||||
Simplex noise = new Simplex();
|
||||
RidgedPerlin rid = new RidgedPerlin(1, 2);
|
||||
float scl = 5f;
|
||||
Sector sector;
|
||||
Tiles tiles;
|
||||
|
||||
//TODO generate array from planet image later
|
||||
Block[][] arr = {
|
||||
@ -59,12 +64,19 @@ public class TestPlanetGenerator implements PlanetGenerator{
|
||||
tile.block = tile.floor.asFloor().wall;
|
||||
|
||||
if(noise.octaveNoise3D(5, 0.6, 8.0, position.x, position.y, position.z) > 0.65){
|
||||
//tile.block = Blocks.air;
|
||||
}
|
||||
|
||||
if(rid.getValue(position.x, position.y, position.z, 22) > 0.34){
|
||||
tile.block = Blocks.air;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorate(Tiles tiles){
|
||||
public void decorate(Tiles tiles, Sector sec){
|
||||
this.tiles = tiles;
|
||||
this.sector = sec;
|
||||
|
||||
//OvergrowthGenerator generator = new OvergrowthGenerator(tiles.width, tiles.height);
|
||||
//generator.init(Loadouts.basicNucleus);
|
||||
//generator.generate(tiles);
|
||||
@ -101,14 +113,40 @@ public class TestPlanetGenerator implements PlanetGenerator{
|
||||
}
|
||||
});
|
||||
|
||||
//flush results.
|
||||
tiles.each((x, y) -> read.set(x, y, write.get(x, y)));
|
||||
//flush results
|
||||
read.set(write);
|
||||
}
|
||||
|
||||
tiles.each((x, y) -> tiles.get(x, y).setBlock(!write.get(x, y) ? Blocks.air : tiles.get(x, y).floor().wall));
|
||||
tiles.each((x, y) -> tiles.get(x, y).setBlock(!read.get(x, y) ? Blocks.air : tiles.get(x, y).floor().wall));
|
||||
distort(0.01f, 8f);
|
||||
|
||||
tiles.get(tiles.width /2, tiles.height /2).setBlock(Blocks.coreShard, Team.sharded);
|
||||
}
|
||||
|
||||
void distort(float scl, float mag){
|
||||
short[] blocks = new short[tiles.width * tiles.height];
|
||||
short[] floors = new short[blocks.length];
|
||||
|
||||
tiles.each((x, y) -> {
|
||||
int idx = y*tiles.width + x;
|
||||
float cx = x + noise(x, y, scl, mag) - mag / 2f, cy = y + noise(x, y + 152f, scl, mag) - mag / 2f;
|
||||
Tile other = tiles.getn(Mathf.clamp((int)cx, 0, tiles.width-1), Mathf.clamp((int)cy, 0, tiles.height-1));
|
||||
blocks[idx] = other.block().id;
|
||||
floors[idx] = other.floor().id;
|
||||
});
|
||||
|
||||
for(int i = 0; i < blocks.length; i++){
|
||||
Tile tile = tiles.geti(i);
|
||||
tile.setFloor(Vars.content.block(floors[i]).asFloor());
|
||||
tile.setBlock(Vars.content.block(blocks[i]));
|
||||
}
|
||||
}
|
||||
|
||||
protected float noise(float x, float y, float scl, float mag){
|
||||
Vec3 v = sector.rect.project(x / tiles.width, y / tiles.height);
|
||||
return (float)noise.octaveNoise3D(1f, 0f, 1f / scl, v.x, v.y, v.z) * mag;
|
||||
}
|
||||
|
||||
Block getBlock(Vec3 position){
|
||||
float height = rawHeight(position);
|
||||
position = Tmp.v33.set(position).scl(scl);
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=d20c0312e740a9845a358fc4571926ad784c0bbc
|
||||
archash=415c435dc59e9248fdef8362582220d18f9f8e17
|
||||
|
Loading…
Reference in New Issue
Block a user