Fixed pad shader/disconnect bugs
|
Before Width: | Height: | Size: 153 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 4.1 KiB |
@@ -32,7 +32,7 @@ void main() {
|
|||||||
vec2 coord = t / v;
|
vec2 coord = t / v;
|
||||||
vec4 c = texture2D(u_texture, t);
|
vec4 c = texture2D(u_texture, t);
|
||||||
|
|
||||||
if(cont(t, v) ){
|
if(cont(t, v)){
|
||||||
gl_FragColor = u_color;
|
gl_FragColor = u_color;
|
||||||
}else{
|
}else{
|
||||||
gl_FragColor = vec4(0.0);
|
gl_FragColor = vec4(0.0);
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ precision mediump float;
|
|||||||
precision mediump int;
|
precision mediump int;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define step 3.0
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
|
|
||||||
uniform float u_time;
|
uniform float u_time;
|
||||||
@@ -15,27 +17,39 @@ uniform vec2 u_texsize;
|
|||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
float rand(vec2 co){
|
|
||||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool id(vec4 v){
|
bool id(vec4 v){
|
||||||
return v.a > 0.1;
|
return v.a > 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool id(vec2 coords, vec4 base){
|
||||||
|
vec4 target = texture2D(u_texture, coords);
|
||||||
|
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cont(vec2 T, vec2 v){
|
||||||
|
vec4 base = texture2D(u_texture, T);
|
||||||
|
return base.a > 0.1 &&
|
||||||
|
(id(T + vec2(0, step) * v, base) || id(T + vec2(0, -step) * v, base) ||
|
||||||
|
id(T + vec2(step, 0) * v, base) || id(T + vec2(-step, 0) * v, base) ||
|
||||||
|
id(T + vec2(step, step) * v, base) || id(T + vec2(-step, -step) * v, base) ||
|
||||||
|
id(T + vec2(step, -step) * v, base) || id(T + vec2(-step, step) * v, base));
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec2 coords = (v_texCoord.xy - u_uv) / (u_uv2 - u_uv);
|
vec2 coords = (v_texCoord.xy - u_uv) / (u_uv2 - u_uv);
|
||||||
vec2 t = v_texCoord.xy;
|
vec2 t = v_texCoord.xy;
|
||||||
|
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||||
|
|
||||||
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
||||||
|
bool outl = cont(t, v);
|
||||||
if(1.0-abs(coords.x - 0.5)*2.0 < 1.0-u_progress){
|
|
||||||
|
if(1.0-abs(coords.x - 0.5)*2.0 < 1.0-u_progress && !outl){
|
||||||
c = vec4(0.0);
|
c = vec4(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c.a > 0.01){
|
if(c.a > 0.01){
|
||||||
float f = abs(sin(coords.x*2.0 + u_time));
|
float f = abs(sin(coords.x*2.0 + u_time));
|
||||||
if(f > 0.9 )
|
if(f > 0.9 || outl)
|
||||||
f = 1.0;
|
f = 1.0;
|
||||||
else
|
else
|
||||||
f = 0.0;
|
f = 0.0;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@@ -52,7 +52,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class NetServer implements ApplicationListener{
|
public class NetServer implements ApplicationListener{
|
||||||
public final static int maxSnapshotSize = 430;
|
public final static int maxSnapshotSize = 430;
|
||||||
private final static float serverSyncTime = 40, kickDuration = 30 * 1000;
|
private final static float serverSyncTime = 4, kickDuration = 30 * 1000;
|
||||||
private final static Vector2 vector = new Vector2();
|
private final static Vector2 vector = new Vector2();
|
||||||
private final static Rectangle viewport = new Rectangle();
|
private final static Rectangle viewport = new Rectangle();
|
||||||
private final static Array<Entity> returnArray = new Array<>();
|
private final static Array<Entity> returnArray = new Array<>();
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isFlying()){
|
if(isFlying()){
|
||||||
|
drownTime = 0f;
|
||||||
move(velocity.x * Time.delta(), velocity.y * Time.delta());
|
move(velocity.x * Time.delta(), velocity.y * Time.delta());
|
||||||
}else{
|
}else{
|
||||||
boolean onLiquid = floor.isLiquid;
|
boolean onLiquid = floor.isLiquid;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class MechPad extends Block{
|
|||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.server)
|
@Remote(targets = Loc.both, called = Loc.server)
|
||||||
public static void onMechFactoryTap(Player player, Tile tile){
|
public static void onMechFactoryTap(Player player, Tile tile){
|
||||||
if(player == null || !checkValidTap(tile, player) || !(tile.block() instanceof MechPad)) return;
|
if(player == null || !(tile.block() instanceof MechPad) || !checkValidTap(tile, player)) return;
|
||||||
|
|
||||||
MechFactoryEntity entity = tile.entity();
|
MechFactoryEntity entity = tile.entity();
|
||||||
MechPad pad = (MechPad)tile.block();
|
MechPad pad = (MechPad)tile.block();
|
||||||
@@ -153,11 +153,10 @@ public class MechPad extends Block{
|
|||||||
|
|
||||||
Shaders.build.region = region;
|
Shaders.build.region = region;
|
||||||
Shaders.build.progress = entity.progress;
|
Shaders.build.progress = entity.progress;
|
||||||
Shaders.build.time = -entity.time / 4f;
|
Shaders.build.time = -entity.time / 5f;
|
||||||
Shaders.build.color.set(Pal.accent);
|
Shaders.build.color.set(Pal.accent);
|
||||||
|
|
||||||
Draw.shader(Shaders.build, false);
|
Draw.shader(Shaders.build);
|
||||||
Shaders.build.apply();
|
|
||||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||||
Draw.shader();
|
Draw.shader();
|
||||||
|
|
||||||
|
|||||||
@@ -120,8 +120,7 @@ public class UnitFactory extends Block{
|
|||||||
Shaders.build.color.a = entity.speedScl;
|
Shaders.build.color.a = entity.speedScl;
|
||||||
Shaders.build.time = -entity.time / 10f;
|
Shaders.build.time = -entity.time / 10f;
|
||||||
|
|
||||||
Draw.shader(Shaders.build, false);
|
Draw.shader(Shaders.build);
|
||||||
Shaders.build.apply();
|
|
||||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||||
Draw.shader();
|
Draw.shader();
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class PowerModule extends BlockModule{
|
|||||||
for(int i = 0; i < links.size; i++){
|
for(int i = 0; i < links.size; i++){
|
||||||
stream.writeInt(links.get(i));
|
stream.writeInt(links.get(i));
|
||||||
}
|
}
|
||||||
|
stream.writeFloat(satisfaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -32,5 +33,6 @@ public class PowerModule extends BlockModule{
|
|||||||
for(int i = 0; i < amount; i++){
|
for(int i = 0; i < amount; i++){
|
||||||
links.add(stream.readInt());
|
links.add(stream.readInt());
|
||||||
}
|
}
|
||||||
|
satisfaction = stream.readFloat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||