Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

This commit is contained in:
Anuken
2021-09-16 10:23:31 -04:00
12 changed files with 43 additions and 22 deletions

4
.gitignore vendored
View File

@@ -162,3 +162,7 @@ gradle-app.setting
.DS_Store .DS_Store
Thumbs.db Thumbs.db
android/libs/ android/libs/
# ignored due to frequent branch conflicts.
core/assets/logicids.dat
core/assets/icons/icons.properties

View File

@@ -15,11 +15,16 @@ const float shinefalloff = 4.0;
const float shinelen = 0.2; const float shinelen = 0.2;
void main(){ void main(){
vec3 norc = u_ambientColor * (diffuse + vec3(clamp((dot(a_normal, u_lightdir) + 1.0) / 2.0, 0.0, 1.0))); vec3 specular = vec3(0, 0, 0);
float shinedot = max((-dot(u_camdir, a_normal) - (1.0 - shinelen)) / shinelen, 0.0);
float albedo = (1.0 - a_color.a) * pow(shinedot, shinefalloff);
vec4 baseCol = vec4(a_color.rgb, 1.0);
v_col = mix(baseCol * vec4(norc, 1.0), vec4(1.0), albedo * norc.r); vec3 lightReflect = normalize(reflect(a_normal, u_lightdir));
float specularFactor = dot(u_camdir, lightReflect);
if(specularFactor > 0){
specular = vec3(1.0f * pow(specularFactor, 32f)) * (1f-a_color.a); //specular power = 32
}
vec3 norc = (u_ambientColor + specular) * (diffuse + vec3(clamp((dot(a_normal, u_lightdir) + 1.0) / 2.0, 0.0, 1.0)));
v_col = vec4(a_color.rgb, 1.0) * vec4(norc, 1.0);
gl_Position = u_proj * u_trans * a_position; gl_Position = u_proj * u_trans * a_position;
} }

View File

@@ -141,7 +141,7 @@ public class Blocks implements ContentList{
statusDuration = 120f; statusDuration = 120f;
drownTime = 200f; drownTime = 200f;
cacheLayer = CacheLayer.water; cacheLayer = CacheLayer.water;
albedo = 0.5f; albedo = 0.9f;
}}; }};
water = new Floor("shallow-water"){{ water = new Floor("shallow-water"){{
@@ -152,7 +152,7 @@ public class Blocks implements ContentList{
liquidDrop = Liquids.water; liquidDrop = Liquids.water;
isLiquid = true; isLiquid = true;
cacheLayer = CacheLayer.water; cacheLayer = CacheLayer.water;
albedo = 0.5f; albedo = 0.9f;
}}; }};
taintedWater = new Floor("tainted-water"){{ taintedWater = new Floor("tainted-water"){{
@@ -163,7 +163,7 @@ public class Blocks implements ContentList{
liquidDrop = Liquids.water; liquidDrop = Liquids.water;
isLiquid = true; isLiquid = true;
cacheLayer = CacheLayer.water; cacheLayer = CacheLayer.water;
albedo = 0.5f; albedo = 0.9f;
attributes.set(Attribute.spores, 0.15f); attributes.set(Attribute.spores, 0.15f);
}}; }};
@@ -176,27 +176,27 @@ public class Blocks implements ContentList{
liquidDrop = Liquids.water; liquidDrop = Liquids.water;
isLiquid = true; isLiquid = true;
cacheLayer = CacheLayer.water; cacheLayer = CacheLayer.water;
albedo = 0.5f; albedo = 0.9f;
attributes.set(Attribute.spores, 0.15f); attributes.set(Attribute.spores, 0.15f);
}}; }};
darksandTaintedWater = new ShallowLiquid("darksand-tainted-water"){{ darksandTaintedWater = new ShallowLiquid("darksand-tainted-water"){{
speedMultiplier = 0.75f; speedMultiplier = 0.75f;
statusDuration = 60f; statusDuration = 60f;
albedo = 0.5f; albedo = 0.9f;
attributes.set(Attribute.spores, 0.1f); attributes.set(Attribute.spores, 0.1f);
}}; }};
sandWater = new ShallowLiquid("sand-water"){{ sandWater = new ShallowLiquid("sand-water"){{
speedMultiplier = 0.8f; speedMultiplier = 0.8f;
statusDuration = 50f; statusDuration = 50f;
albedo = 0.5f; albedo = 0.9f;
}}; }};
darksandWater = new ShallowLiquid("darksand-water"){{ darksandWater = new ShallowLiquid("darksand-water"){{
speedMultiplier = 0.8f; speedMultiplier = 0.8f;
statusDuration = 50f; statusDuration = 50f;
albedo = 0.5f; albedo = 0.9f;
}}; }};
tar = new Floor("tar"){{ tar = new Floor("tar"){{
@@ -289,7 +289,6 @@ public class Blocks implements ContentList{
statusDuration = 30f; statusDuration = 30f;
attributes.set(Attribute.water, 1f); attributes.set(Attribute.water, 1f);
cacheLayer = CacheLayer.mud; cacheLayer = CacheLayer.mud;
albedo = 0.35f;
walkSound = Sounds.mud; walkSound = Sounds.mud;
walkSoundVolume = 0.08f; walkSoundVolume = 0.08f;
walkSoundPitchMin = 0.4f; walkSoundPitchMin = 0.4f;
@@ -361,18 +360,21 @@ public class Blocks implements ContentList{
snow = new Floor("snow"){{ snow = new Floor("snow"){{
attributes.set(Attribute.water, 0.2f); attributes.set(Attribute.water, 0.2f);
albedo = 0.7f;
}}; }};
ice = new Floor("ice"){{ ice = new Floor("ice"){{
dragMultiplier = 0.35f; dragMultiplier = 0.35f;
speedMultiplier = 0.9f; speedMultiplier = 0.9f;
attributes.set(Attribute.water, 0.4f); attributes.set(Attribute.water, 0.4f);
albedo = 0.65f;
}}; }};
iceSnow = new Floor("ice-snow"){{ iceSnow = new Floor("ice-snow"){{
dragMultiplier = 0.6f; dragMultiplier = 0.6f;
variants = 3; variants = 3;
attributes.set(Attribute.water, 0.3f); attributes.set(Attribute.water, 0.3f);
albedo = 0.6f;
}}; }};
shale = new Floor("shale"){{ shale = new Floor("shale"){{

View File

@@ -1910,7 +1910,7 @@ public class Fx{
color(e.color); color(e.color);
stroke(3f * e.fout()); stroke(3f * e.fout());
Lines.poly(e.x, e.y, 6, e.rotation + e.fin()); Lines.poly(e.x, e.y, 6, e.rotation + e.fin());
}), }).followParent(true),
coreLandDust = new Effect(100f, e -> { coreLandDust = new Effect(100f, e -> {
color(e.color, e.fout(0.1f)); color(e.color, e.fout(0.1f));

View File

@@ -76,6 +76,10 @@ public class Effect{
create(this, pos.getX(), pos.getY(), 0, Color.white, null); create(this, pos.getX(), pos.getY(), 0, Color.white, null);
} }
public void at(Position pos, boolean parentize){
create(this, pos.getX(), pos.getY(), 0, Color.white, parentize ? pos : null);
}
public void at(Position pos, float rotation){ public void at(Position pos, float rotation){
create(this, pos.getX(), pos.getY(), rotation, Color.white, null); create(this, pos.getX(), pos.getY(), rotation, Color.white, null);
} }

View File

@@ -38,7 +38,7 @@ public class ForceFieldAbility extends Ability{
if(paramUnit.shield <= trait.damage()){ if(paramUnit.shield <= trait.damage()){
paramUnit.shield -= paramField.cooldown * paramField.regen; paramUnit.shield -= paramField.cooldown * paramField.regen;
Fx.shieldBreak.at(paramUnit.x, paramUnit.y, paramField.radius, paramUnit.team.color); Fx.shieldBreak.at(paramUnit.x, paramUnit.y, paramField.radius, paramUnit.team.color, paramUnit);
} }
paramUnit.shield -= trait.damage(); paramUnit.shield -= trait.damage();

View File

@@ -34,6 +34,7 @@ public class MoveLightningAbility extends Ability{
public float bulletAngle = 0f, bulletSpread = 0f; public float bulletAngle = 0f, bulletSpread = 0f;
public Effect shootEffect = Fx.sparkShoot; public Effect shootEffect = Fx.sparkShoot;
public boolean parentizeEffects;
public Sound shootSound = Sounds.spark; public Sound shootSound = Sounds.spark;
protected float side = 1f; protected float side = 1f;
@@ -67,7 +68,7 @@ public class MoveLightningAbility extends Ability{
if(Mathf.chance(Time.delta * chance * scl)){ if(Mathf.chance(Time.delta * chance * scl)){
float x = unit.x + Angles.trnsx(unit.rotation, offset, width * side), y = unit.y + Angles.trnsy(unit.rotation, offset, width * side); float x = unit.x + Angles.trnsx(unit.rotation, offset, width * side), y = unit.y + Angles.trnsy(unit.rotation, offset, width * side);
shootEffect.at(x, y, unit.rotation, color); shootEffect.at(x, y, unit.rotation, color, parentizeEffects ? unit : null);
shootSound.at(unit); shootSound.at(unit);
if(length > 0){ if(length > 0){

View File

@@ -9,6 +9,7 @@ public class RepairFieldAbility extends Ability{
public float amount = 1, reload = 100, range = 60; public float amount = 1, reload = 100, range = 60;
public Effect healEffect = Fx.heal; public Effect healEffect = Fx.heal;
public Effect activeEffect = Fx.healWaveDynamic; public Effect activeEffect = Fx.healWaveDynamic;
public boolean parentizeEffects = false;
protected float timer; protected float timer;
protected boolean wasHealed = false; protected boolean wasHealed = false;
@@ -30,7 +31,7 @@ public class RepairFieldAbility extends Ability{
Units.nearby(unit.team, unit.x, unit.y, range, other -> { Units.nearby(unit.team, unit.x, unit.y, range, other -> {
if(other.damaged()){ if(other.damaged()){
healEffect.at(other); healEffect.at(other, parentizeEffects);
wasHealed = true; wasHealed = true;
} }
other.heal(amount); other.heal(amount);

View File

@@ -9,6 +9,7 @@ public class ShieldRegenFieldAbility extends Ability{
public float amount = 1, max = 100f, reload = 100, range = 60; public float amount = 1, max = 100f, reload = 100, range = 60;
public Effect applyEffect = Fx.shieldApply; public Effect applyEffect = Fx.shieldApply;
public Effect activeEffect = Fx.shieldWave; public Effect activeEffect = Fx.shieldWave;
public boolean parentizeEffects;
protected float timer; protected float timer;
protected boolean applied = false; protected boolean applied = false;
@@ -33,7 +34,7 @@ public class ShieldRegenFieldAbility extends Ability{
if(other.shield < max){ if(other.shield < max){
other.shield = Math.max(other.shield + amount, max); other.shield = Math.max(other.shield + amount, max);
other.shieldAlpha = 1f; //TODO may not be necessary other.shieldAlpha = 1f; //TODO may not be necessary
applyEffect.at(unit.x, unit.y, unit.team.color); applyEffect.at(unit.x, unit.y, 0f, unit.team.color, parentizeEffects ? other : null);
applied = true; applied = true;
} }
}); });

View File

@@ -10,8 +10,9 @@ import mindustry.type.*;
public class StatusFieldAbility extends Ability{ public class StatusFieldAbility extends Ability{
public StatusEffect effect; public StatusEffect effect;
public float duration = 60, reload = 100, range = 20; public float duration = 60, reload = 100, range = 20;
public Effect applyEffect = Fx.heal; public Effect applyEffect = Fx.none;
public Effect activeEffect = Fx.overdriveWave; public Effect activeEffect = Fx.overdriveWave;
public boolean parentizeEffects;
protected float timer; protected float timer;
@@ -36,9 +37,10 @@ public class StatusFieldAbility extends Ability{
if(timer >= reload){ if(timer >= reload){
Units.nearby(unit.team, unit.x, unit.y, range, other -> { Units.nearby(unit.team, unit.x, unit.y, range, other -> {
other.apply(effect, duration); other.apply(effect, duration);
applyEffect.at(other, parentizeEffects);
}); });
activeEffect.at(unit); activeEffect.at(unit, parentizeEffects);
timer = 0f; timer = 0f;
} }

View File

@@ -18,6 +18,7 @@ public class UnitSpawnAbility extends Ability{
public UnitType unit; public UnitType unit;
public float spawnTime = 60f, spawnX, spawnY; public float spawnTime = 60f, spawnX, spawnY;
public Effect spawnEffect = Fx.spawn; public Effect spawnEffect = Fx.spawn;
public boolean parentizeEffects;
protected float timer; protected float timer;
@@ -37,7 +38,7 @@ public class UnitSpawnAbility extends Ability{
if(timer >= spawnTime && Units.canCreate(unit.team, this.unit)){ if(timer >= spawnTime && Units.canCreate(unit.team, this.unit)){
float x = unit.x + Angles.trnsx(unit.rotation, spawnY, spawnX), y = unit.y + Angles.trnsy(unit.rotation, spawnY, spawnX); float x = unit.x + Angles.trnsx(unit.rotation, spawnY, spawnX), y = unit.y + Angles.trnsy(unit.rotation, spawnY, spawnX);
spawnEffect.at(x, y); spawnEffect.at(x, y, 0f, parentizeEffects ? unit : null);
Unit u = this.unit.create(unit.team); Unit u = this.unit.create(unit.team);
u.set(x, y); u.set(x, y);
u.rotation = unit.rotation; u.rotation = unit.rotation;

View File

@@ -11,4 +11,4 @@ android.useAndroidX=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
http.socketTimeout=80000 http.socketTimeout=80000
http.connectionTimeout=80000 http.connectionTimeout=80000
archash=43f8f93e80779f91fad622acfae70cdc300edecf archash=e2eead82168c1a143e345bc5f78e2d72078f4657