Merge remote-tracking branch 'upstream/master' into wall-stats
This commit is contained in:
@@ -14,6 +14,8 @@ import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.campaign.*;
|
||||
import mindustry.world.blocks.defense.*;
|
||||
import mindustry.world.blocks.defense.turrets.*;
|
||||
import mindustry.world.blocks.defense.turrets.PointDefenseTurret;
|
||||
import mindustry.world.blocks.defense.turrets.TractorBeamTurret;
|
||||
import mindustry.world.blocks.distribution.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
import mindustry.world.blocks.experimental.*;
|
||||
@@ -1186,7 +1188,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.power, with(Items.lead, 100, Items.silicon, 75, Items.phasefabric, 25, Items.plastanium, 75, Items.thorium, 50));
|
||||
size = 2;
|
||||
powerProduction = 4.5f;
|
||||
itemDuration = 60 * 15f;
|
||||
itemDuration = 60 * 18f;
|
||||
}};
|
||||
|
||||
solarPanel = new SolarGenerator("solar-panel"){{
|
||||
@@ -1355,7 +1357,7 @@ public class Blocks implements ContentList{
|
||||
size = 5;
|
||||
|
||||
unitCapModifier = 20;
|
||||
researchCostMultiplier = 0.06f;
|
||||
researchCostMultiplier = 0.05f;
|
||||
}};
|
||||
|
||||
vault = new StorageBlock("vault"){{
|
||||
@@ -1644,11 +1646,20 @@ public class Blocks implements ContentList{
|
||||
|
||||
float brange = range + 10f;
|
||||
|
||||
ammo(Items.thorium, new ShrapnelBulletType(){{
|
||||
ammo(
|
||||
Items.thorium, new ShrapnelBulletType(){{
|
||||
length = brange;
|
||||
damage = 105f;
|
||||
ammoMultiplier = 6f;
|
||||
}});
|
||||
ammoMultiplier = 5f;
|
||||
}},
|
||||
Items.titanium, new ShrapnelBulletType(){{
|
||||
length = brange;
|
||||
damage = 66f;
|
||||
ammoMultiplier = 4f;
|
||||
width = 17f;
|
||||
reloadMultiplier = 1.3f;
|
||||
}}
|
||||
);
|
||||
}};
|
||||
|
||||
ripple = new ItemTurret("ripple"){{
|
||||
@@ -1914,7 +1925,7 @@ public class Blocks implements ContentList{
|
||||
new UnitType[]{UnitTypes.antumbra, UnitTypes.eclipse},
|
||||
new UnitType[]{UnitTypes.arkyid, UnitTypes.toxopid},
|
||||
new UnitType[]{UnitTypes.scepter, UnitTypes.reign},
|
||||
new UnitType[] {UnitTypes.sei, UnitTypes.omura},
|
||||
new UnitType[]{UnitTypes.sei, UnitTypes.omura},
|
||||
new UnitType[]{UnitTypes.quad, UnitTypes.oct},
|
||||
new UnitType[]{UnitTypes.vela, UnitTypes.corvus}
|
||||
);
|
||||
|
||||
@@ -1293,6 +1293,14 @@ public class Fx{
|
||||
});
|
||||
}),
|
||||
|
||||
coreBurn = new Effect(23, e -> {
|
||||
randLenVectors(e.id, 5, e.fin() * 9f, (x, y) -> {
|
||||
float len = e.fout() * 4f;
|
||||
color(Pal.accent, Color.gray, e.fin());
|
||||
Fill.circle(e.x + x, e.y + y, len/2f);
|
||||
});
|
||||
}),
|
||||
|
||||
plasticburn = new Effect(40, e -> {
|
||||
randLenVectors(e.id, 5, 3f + e.fin() * 5f, (x, y) -> {
|
||||
color(Color.valueOf("e9ead3"), Color.gray, e.fin());
|
||||
|
||||
@@ -10,6 +10,7 @@ import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -897,6 +898,7 @@ public class UnitTypes implements ContentList{
|
||||
range = 140f;
|
||||
faceTarget = false;
|
||||
armor = 4f;
|
||||
targetFlag = BlockFlag.factory;
|
||||
|
||||
weapons.add(new Weapon(){{
|
||||
minShootVelocity = 0.75f;
|
||||
@@ -977,6 +979,7 @@ public class UnitTypes implements ContentList{
|
||||
engineOffset = 21;
|
||||
engineSize = 5.3f;
|
||||
hitSize = 56f;
|
||||
targetFlag = BlockFlag.battery;
|
||||
|
||||
BulletType missiles = new MissileBulletType(2.7f, 10){{
|
||||
width = 8f;
|
||||
@@ -1051,6 +1054,7 @@ public class UnitTypes implements ContentList{
|
||||
hitSize = 58f;
|
||||
destructibleWreck = false;
|
||||
armor = 13f;
|
||||
targetFlag = BlockFlag.reactor;
|
||||
|
||||
BulletType fragBullet = new FlakBulletType(4f, 5){{
|
||||
shootEffect = Fx.shootBig;
|
||||
@@ -1196,7 +1200,6 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
mineTier = 3;
|
||||
health = 500;
|
||||
armor = 2f;
|
||||
armor = 5f;
|
||||
speed = 1.8f;
|
||||
accel = 0.06f;
|
||||
@@ -1246,6 +1249,7 @@ public class UnitTypes implements ContentList{
|
||||
buildSpeed = 2.5f;
|
||||
range = 140f;
|
||||
targetAir = false;
|
||||
targetFlag = BlockFlag.battery;
|
||||
|
||||
ammoType = AmmoTypes.powerHigh;
|
||||
|
||||
@@ -1650,11 +1654,11 @@ public class UnitTypes implements ContentList{
|
||||
mineTier = 1;
|
||||
buildSpeed = 0.5f;
|
||||
drag = 0.05f;
|
||||
speed = 2.8f;
|
||||
speed = 3f;
|
||||
rotateSpeed = 15f;
|
||||
accel = 0.1f;
|
||||
itemCapacity = 30;
|
||||
health = 120f;
|
||||
health = 150f;
|
||||
engineOffset = 6f;
|
||||
hitSize = 8f;
|
||||
commandLimit = 3;
|
||||
@@ -1665,13 +1669,13 @@ public class UnitTypes implements ContentList{
|
||||
y = 1f;
|
||||
top = false;
|
||||
|
||||
bullet = new BasicBulletType(2.5f, 9){{
|
||||
bullet = new BasicBulletType(2.5f, 10){{
|
||||
width = 7f;
|
||||
height = 9f;
|
||||
lifetime = 60f;
|
||||
shootEffect = Fx.shootSmall;
|
||||
smokeEffect = Fx.shootSmallSmoke;
|
||||
tileDamageMultiplier = 0.09f;
|
||||
tileDamageMultiplier = 0.03f;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
@@ -1685,11 +1689,11 @@ public class UnitTypes implements ContentList{
|
||||
mineTier = 1;
|
||||
buildSpeed = 0.75f;
|
||||
drag = 0.05f;
|
||||
speed = 3f;
|
||||
speed = 3.3f;
|
||||
rotateSpeed = 17f;
|
||||
accel = 0.1f;
|
||||
itemCapacity = 50;
|
||||
health = 150f;
|
||||
health = 170f;
|
||||
engineOffset = 6f;
|
||||
hitSize = 9f;
|
||||
rotateShooting = false;
|
||||
@@ -1706,13 +1710,13 @@ public class UnitTypes implements ContentList{
|
||||
shotDelay = 4f;
|
||||
spacing = 0f;
|
||||
|
||||
bullet = new BasicBulletType(3f, 9){{
|
||||
bullet = new BasicBulletType(3f, 10){{
|
||||
width = 7f;
|
||||
height = 9f;
|
||||
lifetime = 60f;
|
||||
shootEffect = Fx.shootSmall;
|
||||
smokeEffect = Fx.shootSmallSmoke;
|
||||
tileDamageMultiplier = 0.1f;
|
||||
tileDamageMultiplier = 0.03f;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
@@ -1726,11 +1730,11 @@ public class UnitTypes implements ContentList{
|
||||
mineTier = 2;
|
||||
buildSpeed = 1f;
|
||||
drag = 0.05f;
|
||||
speed = 3.5f;
|
||||
speed = 3.55f;
|
||||
rotateSpeed = 19f;
|
||||
accel = 0.11f;
|
||||
itemCapacity = 70;
|
||||
health = 190f;
|
||||
health = 220f;
|
||||
engineOffset = 6f;
|
||||
hitSize = 10f;
|
||||
commandLimit = 7;
|
||||
@@ -1745,13 +1749,13 @@ public class UnitTypes implements ContentList{
|
||||
inaccuracy = 3f;
|
||||
shotDelay = 3f;
|
||||
|
||||
bullet = new BasicBulletType(3.5f, 9){{
|
||||
bullet = new BasicBulletType(3.5f, 10){{
|
||||
width = 6.5f;
|
||||
height = 11f;
|
||||
lifetime = 70f;
|
||||
shootEffect = Fx.shootSmall;
|
||||
smokeEffect = Fx.shootSmallSmoke;
|
||||
tileDamageMultiplier = 0.1f;
|
||||
tileDamageMultiplier = 0.03f;
|
||||
homingPower = 0.04f;
|
||||
}};
|
||||
}});
|
||||
|
||||
@@ -1,339 +1,89 @@
|
||||
package mindustry.content;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.Texture.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.type.weather.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Weathers implements ContentList{
|
||||
public static Weather
|
||||
rain,
|
||||
snow,
|
||||
sandstorm,
|
||||
sporestorm;
|
||||
sporestorm,
|
||||
fog;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
snow = new Weather("snow"){
|
||||
TextureRegion region;
|
||||
float yspeed = 2f, xspeed = 0.25f, padding = 16f, size = 12f, density = 1200f;
|
||||
snow = new ParticleWeather("snow"){{
|
||||
sizeMax = 13f;
|
||||
sizeMin = 2.6f;
|
||||
density = 1200f;
|
||||
attrs.set(Attribute.light, -0.15f);
|
||||
}};
|
||||
|
||||
{
|
||||
attrs.set(Attribute.light, -0.15f);
|
||||
}
|
||||
rain = new RainWeather("rain"){{
|
||||
attrs.set(Attribute.light, -0.2f);
|
||||
attrs.set(Attribute.water, 0.2f);
|
||||
status = StatusEffects.wet;
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
sandstorm = new ParticleWeather("sandstorm"){{
|
||||
color = noiseColor = Color.valueOf("f7cba4");
|
||||
drawNoise = true;
|
||||
useWindVector = true;
|
||||
sizeMax = 140f;
|
||||
sizeMin = 70f;
|
||||
minAlpha = 0f;
|
||||
maxAlpha = 0.2f;
|
||||
density = 1500f;
|
||||
baseSpeed = 6.1f;
|
||||
attrs.set(Attribute.light, -0.1f);
|
||||
attrs.set(Attribute.water, -0.1f);
|
||||
opacityMultiplier = 0.8f;
|
||||
force = 0.1f;
|
||||
}};
|
||||
|
||||
region = Core.atlas.find("circle-shadow");
|
||||
}
|
||||
sporestorm = new ParticleWeather("sporestorm"){{
|
||||
color = noiseColor = Color.valueOf("7457ce");
|
||||
particleRegion = "circle";
|
||||
drawNoise = true;
|
||||
statusGround = false;
|
||||
useWindVector = true;
|
||||
sizeMax = 5f;
|
||||
sizeMin = 2.5f;
|
||||
minAlpha = 0.1f;
|
||||
maxAlpha = 0.8f;
|
||||
density = 2000f;
|
||||
baseSpeed = 4.3f;
|
||||
attrs.set(Attribute.spores, 1f);
|
||||
attrs.set(Attribute.light, -0.15f);
|
||||
status = StatusEffects.sporeSlowed;
|
||||
opacityMultiplier = 0.85f;
|
||||
force = 0.1f;
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void drawOver(WeatherState state){
|
||||
rand.setSeed(0);
|
||||
Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale());
|
||||
Tmp.r1.grow(padding);
|
||||
Core.camera.bounds(Tmp.r2);
|
||||
int total = (int)(Tmp.r1.area() / density * state.intensity());
|
||||
|
||||
for(int i = 0; i < total; i++){
|
||||
float scl = rand.random(0.5f, 1f);
|
||||
float scl2 = rand.random(0.5f, 1f);
|
||||
float sscl = rand.random(0.2f, 1f);
|
||||
float x = (rand.random(0f, world.unitWidth()) + Time.time() * xspeed * scl2);
|
||||
float y = (rand.random(0f, world.unitHeight()) - Time.time() * yspeed * scl);
|
||||
|
||||
x += Mathf.sin(y, rand.random(30f, 80f), rand.random(1f, 7f));
|
||||
|
||||
x -= Tmp.r1.x;
|
||||
y -= Tmp.r1.y;
|
||||
x = Mathf.mod(x, Tmp.r1.width);
|
||||
y = Mathf.mod(y, Tmp.r1.height);
|
||||
x += Tmp.r1.x;
|
||||
y += Tmp.r1.y;
|
||||
|
||||
if(Tmp.r3.setCentered(x, y, size * sscl).overlaps(Tmp.r2)){
|
||||
Draw.rect(region, x, y, size * sscl, size * sscl);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
rain = new Weather("rain"){
|
||||
float yspeed = 5f, xspeed = 1.5f, padding = 16f, size = 40f, density = 1200f;
|
||||
TextureRegion[] splashes = new TextureRegion[12];
|
||||
|
||||
{
|
||||
attrs.set(Attribute.light, -0.2f);
|
||||
attrs.set(Attribute.water, 0.2f);
|
||||
status = StatusEffects.wet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
|
||||
for(int i = 0; i < splashes.length; i++){
|
||||
splashes[i] = Core.atlas.find("splash-" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawOver(WeatherState state){
|
||||
Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale());
|
||||
Tmp.r1.grow(padding);
|
||||
Core.camera.bounds(Tmp.r2);
|
||||
int total = (int)(Tmp.r1.area() / density * state.intensity());
|
||||
Lines.stroke(0.75f);
|
||||
float alpha = Draw.getColor().a;
|
||||
Draw.color(Color.royal, Color.white, 0.3f);
|
||||
|
||||
for(int i = 0; i < total; i++){
|
||||
float scl = rand.random(0.5f, 1f);
|
||||
float scl2 = rand.random(0.5f, 1f);
|
||||
float sscl = rand.random(0.2f, 1f);
|
||||
float x = (rand.random(0f, world.unitWidth()) + Time.time() * xspeed * scl2);
|
||||
float y = (rand.random(0f, world.unitHeight()) - Time.time() * yspeed * scl);
|
||||
float tint = rand.random(1f) * alpha;
|
||||
|
||||
x -= Tmp.r1.x;
|
||||
y -= Tmp.r1.y;
|
||||
x = Mathf.mod(x, Tmp.r1.width);
|
||||
y = Mathf.mod(y, Tmp.r1.height);
|
||||
x += Tmp.r1.x;
|
||||
y += Tmp.r1.y;
|
||||
|
||||
if(Tmp.r3.setCentered(x, y, size * sscl).overlaps(Tmp.r2)){
|
||||
Draw.alpha(tint);
|
||||
Lines.lineAngle(x, y, Angles.angle(xspeed * scl2, - yspeed * scl), size*sscl/2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawUnder(WeatherState state){
|
||||
Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale());
|
||||
Tmp.r1.grow(padding);
|
||||
Core.camera.bounds(Tmp.r2);
|
||||
int total = (int)(Tmp.r1.area() / density * state.intensity()) / 2;
|
||||
Lines.stroke(0.75f);
|
||||
|
||||
float t = Time.time() / 22f;
|
||||
|
||||
for(int i = 0; i < total; i++){
|
||||
float offset = rand.random(0f, 1f);
|
||||
float time = t + offset;
|
||||
|
||||
int pos = (int)((time));
|
||||
float life = time % 1f;
|
||||
float x = (rand.random(0f, world.unitWidth()) + pos*953);
|
||||
float y = (rand.random(0f, world.unitHeight()) - pos*453);
|
||||
|
||||
x -= Tmp.r1.x;
|
||||
y -= Tmp.r1.y;
|
||||
x = Mathf.mod(x, Tmp.r1.width);
|
||||
y = Mathf.mod(y, Tmp.r1.height);
|
||||
x += Tmp.r1.x;
|
||||
y += Tmp.r1.y;
|
||||
|
||||
if(Tmp.r3.setCentered(x, y, life * 4f).overlaps(Tmp.r2)){
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
if(tile != null && tile.floor().liquidDrop == Liquids.water){
|
||||
Draw.color(Tmp.c1.set(tile.floor().mapColor).mul(1.5f).a(state.opacity()));
|
||||
Draw.rect(splashes[(int)(life * (splashes.length - 1))], x, y);
|
||||
}else if(tile != null && tile.floor().liquidDrop == null && !tile.floor().solid){
|
||||
Draw.color(Color.royal, Color.white, 0.3f);
|
||||
Draw.alpha(Mathf.slope(life) * state.opacity());
|
||||
|
||||
float space = 45f;
|
||||
for(int j : new int[]{-1, 1}){
|
||||
Tmp.v1.trns(90f + j*space, 1f + 5f * life);
|
||||
Lines.lineAngle(x + Tmp.v1.x, y + Tmp.v1.y, 90f + j*space, 3f * (1f - life));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
sandstorm = new Weather("sandstorm"){
|
||||
TextureRegion region;
|
||||
float size = 140f, padding = size, invDensity = 1500f, baseSpeed = 6.1f;
|
||||
float force = 0.4f * 0;
|
||||
Color color = Color.valueOf("f7cba4");
|
||||
Texture noise;
|
||||
|
||||
{
|
||||
attrs.set(Attribute.light, -0.1f);
|
||||
opacityMultiplier = 0.8f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
region = Core.atlas.find("circle-shadow");
|
||||
noise = new Texture("sprites/noiseAlpha.png");
|
||||
noise.setWrap(TextureWrap.repeat);
|
||||
noise.setFilter(TextureFilter.linear);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(){
|
||||
noise.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(WeatherState state){
|
||||
float speed = force * state.intensity;
|
||||
float windx = state.windVector.x * speed, windy = state.windVector.y * speed;
|
||||
|
||||
for(Unit unit : Groups.unit){
|
||||
unit.impulse(windx, windy);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawOver(WeatherState state){
|
||||
Draw.tint(color);
|
||||
float speed = baseSpeed * state.intensity;
|
||||
float windx = state.windVector.x * speed, windy = state.windVector.y * speed;
|
||||
|
||||
float scale = 1f / 2000f;
|
||||
float scroll = Time.time() * scale;
|
||||
Tmp.tr1.texture = noise;
|
||||
Core.camera.bounds(Tmp.r1);
|
||||
Tmp.tr1.set(Tmp.r1.x*scale, Tmp.r1.y*scale, (Tmp.r1.x + Tmp.r1.width)*scale, (Tmp.r1.y + Tmp.r1.height)*scale);
|
||||
Tmp.tr1.scroll(-windx * scroll, windy * scroll);
|
||||
Draw.rect(Tmp.tr1, Core.camera.position.x, Core.camera.position.y, Core.camera.width, -Core.camera.height);
|
||||
|
||||
rand.setSeed(0);
|
||||
Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale());
|
||||
Tmp.r1.grow(padding);
|
||||
Core.camera.bounds(Tmp.r2);
|
||||
int total = (int)(Tmp.r1.area() / invDensity * state.intensity());
|
||||
Draw.tint(color);
|
||||
float baseAlpha = Draw.getColor().a;
|
||||
|
||||
for(int i = 0; i < total; i++){
|
||||
float scl = rand.random(0.5f, 1f);
|
||||
float scl2 = rand.random(0.5f, 1f);
|
||||
float sscl = rand.random(0.5f, 1f);
|
||||
float x = (rand.random(0f, world.unitWidth()) + Time.time() * windx * scl2);
|
||||
float y = (rand.random(0f, world.unitHeight()) + Time.time() * windy * scl);
|
||||
float alpha = rand.random(0.2f);
|
||||
|
||||
x += Mathf.sin(y, rand.random(30f, 80f), rand.random(1f, 7f));
|
||||
|
||||
x -= Tmp.r1.x;
|
||||
y -= Tmp.r1.y;
|
||||
x = Mathf.mod(x, Tmp.r1.width);
|
||||
y = Mathf.mod(y, Tmp.r1.height);
|
||||
x += Tmp.r1.x;
|
||||
y += Tmp.r1.y;
|
||||
|
||||
if(Tmp.r3.setCentered(x, y, size * sscl).overlaps(Tmp.r2)){
|
||||
Draw.alpha(alpha * baseAlpha);
|
||||
Draw.rect(region, x, y, size * sscl, size * sscl);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
sporestorm = new Weather("sporestorm"){
|
||||
TextureRegion region;
|
||||
float size = 5f, padding = size, invDensity = 2000f, baseSpeed = 4.3f, force = 0.28f * 0;
|
||||
Color color = Color.valueOf("7457ce");
|
||||
Texture noise;
|
||||
|
||||
{
|
||||
attrs.set(Attribute.spores, 1f);
|
||||
attrs.set(Attribute.light, -0.15f);
|
||||
status = StatusEffects.sporeSlowed;
|
||||
statusGround = false;
|
||||
opacityMultiplier = 0.85f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
region = Core.atlas.find("circle-shadow");
|
||||
noise = new Texture("sprites/noiseAlpha.png");
|
||||
noise.setWrap(TextureWrap.repeat);
|
||||
noise.setFilter(TextureFilter.linear);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(WeatherState state){
|
||||
float speed = force * state.intensity;
|
||||
float windx = state.windVector.x * speed, windy = state.windVector.y * speed;
|
||||
|
||||
for(Unit unit : Groups.unit){
|
||||
unit.impulse(windx, windy);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(){
|
||||
noise.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawOver(WeatherState state){
|
||||
Draw.alpha(state.opacity * 0.8f);
|
||||
Draw.tint(color);
|
||||
|
||||
float speed = baseSpeed * state.intensity;
|
||||
float windx = state.windVector.x * speed, windy = state.windVector.y * speed;
|
||||
|
||||
float scale = 1f / 2000f;
|
||||
float scroll = Time.time() * scale;
|
||||
Tmp.tr1.texture = noise;
|
||||
Core.camera.bounds(Tmp.r1);
|
||||
Tmp.tr1.set(Tmp.r1.x*scale, Tmp.r1.y*scale, (Tmp.r1.x + Tmp.r1.width)*scale, (Tmp.r1.y + Tmp.r1.height)*scale);
|
||||
Tmp.tr1.scroll(-windx * scroll, windy * scroll);
|
||||
Draw.rect(Tmp.tr1, Core.camera.position.x, Core.camera.position.y, Core.camera.width, -Core.camera.height);
|
||||
|
||||
rand.setSeed(0);
|
||||
Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale());
|
||||
Tmp.r1.grow(padding);
|
||||
Core.camera.bounds(Tmp.r2);
|
||||
int total = (int)(Tmp.r1.area() / invDensity * state.intensity());
|
||||
Draw.tint(color);
|
||||
float baseAlpha = state.opacity;
|
||||
Draw.alpha(baseAlpha);
|
||||
|
||||
for(int i = 0; i < total; i++){
|
||||
float scl = rand.random(0.5f, 1f);
|
||||
float scl2 = rand.random(0.5f, 1f);
|
||||
float sscl = rand.random(0.5f, 1f);
|
||||
float x = (rand.random(0f, world.unitWidth()) + Time.time() * windx * scl2);
|
||||
float y = (rand.random(0f, world.unitHeight()) + Time.time() * windy * scl);
|
||||
float alpha = rand.random(0.1f, 0.8f);
|
||||
|
||||
x += Mathf.sin(y, rand.random(30f, 80f), rand.random(1f, 7f));
|
||||
|
||||
x -= Tmp.r1.x;
|
||||
y -= Tmp.r1.y;
|
||||
x = Mathf.mod(x, Tmp.r1.width);
|
||||
y = Mathf.mod(y, Tmp.r1.height);
|
||||
x += Tmp.r1.x;
|
||||
y += Tmp.r1.y;
|
||||
|
||||
if(Tmp.r3.setCentered(x, y, size * sscl).overlaps(Tmp.r2)){
|
||||
Draw.alpha(alpha * baseAlpha);
|
||||
Fill.circle(x, y, size * sscl / 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
fog = new ParticleWeather("fog"){{
|
||||
duration = 15f * Time.toMinutes;
|
||||
noiseLayers = 3;
|
||||
noiseLayerSclM = 0.8f;
|
||||
noiseLayerAlphaM = 0.7f;
|
||||
noiseLayerSpeedM = 2f;
|
||||
noiseLayerSclM = 0.6f;
|
||||
baseSpeed = 0.05f;
|
||||
color = noiseColor = Color.grays(0.4f);
|
||||
noiseScale = 1100f;
|
||||
noisePath = "fog";
|
||||
drawParticles = false;
|
||||
drawNoise = true;
|
||||
useWindVector = false;
|
||||
xspeed = 1f;
|
||||
yspeed = 0.01f;
|
||||
attrs.set(Attribute.light, -0.3f);
|
||||
attrs.set(Attribute.water, 0.05f);
|
||||
opacityMultiplier = 0.47f;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user