Minor status effect/liquid bugfixes

This commit is contained in:
Anuken
2018-04-08 10:36:49 -04:00
parent 98ec2dcf44
commit 86d5803b63
11 changed files with 27 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Sat Apr 07 23:21:47 EDT 2018 #Sun Apr 08 10:33:47 EDT 2018
version=release version=release
androidBuildCode=870 androidBuildCode=870
name=Mindustry name=Mindustry

View File

@@ -102,7 +102,7 @@ public class StatusEffects {
Effects.effect(EnvironmentFx.oily, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f)); Effects.effect(EnvironmentFx.oily, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
} }
unit.velocity.scl(1.001f); unit.velocity.scl(0.6f);
} }
@Override @Override

View File

@@ -38,7 +38,7 @@ public class Blocks {
deepwater = new Floor("deepwater") {{ deepwater = new Floor("deepwater") {{
liquidColor = Color.valueOf("546bb3"); liquidColor = Color.valueOf("546bb3");
speedMultiplier = 0.3f; speedMultiplier = 0.2f;
variants = 0; variants = 0;
liquidDrop = Liquids.water; liquidDrop = Liquids.water;
liquid = true; liquid = true;

View File

@@ -266,7 +266,7 @@ public class BlockFx {
bubble = new Effect(20, e -> { bubble = new Effect(20, e -> {
Draw.color(Hue.shift(Tmp.c1.set(e.color), 2, 0.1f)); Draw.color(Hue.shift(Tmp.c1.set(e.color), 2, 0.1f));
Lines.stroke(e.fout() + 0.2f); Lines.stroke(e.fout() + 0.2f);
Angles.randLenVectors(e.id, 3, 11f, (x, y) -> { Angles.randLenVectors(e.id, 2, 8f, (x, y) -> {
Lines.circle(e.x + x, e.y + y, 1f + e.fin() * 3f); Lines.circle(e.x + x, e.y + y, 1f + e.fin() * 3f);
}); });
Draw.reset(); Draw.reset();

View File

@@ -2,7 +2,9 @@ package io.anuke.mindustry.core;
import io.anuke.mindustry.content.*; import io.anuke.mindustry.content.*;
import io.anuke.mindustry.content.blocks.*; import io.anuke.mindustry.content.blocks.*;
import io.anuke.mindustry.entities.StatusEffect;
import io.anuke.mindustry.entities.units.UnitType; import io.anuke.mindustry.entities.units.UnitType;
import io.anuke.mindustry.resource.AmmoType;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.resource.Mech; import io.anuke.mindustry.resource.Mech;
@@ -56,9 +58,9 @@ public class ContentLoader {
} }
Log.info("--- CONTENT INFO ---"); Log.info("--- CONTENT INFO ---");
Log.info("Blocks loaded: {0}\nItems loaded: {1}\nLiquids loaded: {2}\nUpgrades loaded: {3}\nUnits loaded: {4}", Log.info("Blocks loaded: {0}\nItems loaded: {1}\nLiquids loaded: {2}\nUpgrades loaded: {3}\nUnits loaded: {4}\nAmmo types loaded: {5}\nStatus effects loaded: {6}",
Block.getAllBlocks().size, Item.getAllItems().size, Liquid.getAllLiquids().size, Block.getAllBlocks().size, Item.getAllItems().size, Liquid.getAllLiquids().size,
Mech.getAllUpgrades().size, UnitType.getAllTypes().size); Mech.getAllUpgrades().size, UnitType.getAllTypes().size, AmmoType.getAllTypes().size, StatusEffect.getAllEffects().size);
Log.info("-------------------"); Log.info("-------------------");
} }

View File

@@ -105,8 +105,8 @@ public class Player extends Unit{
@Override @Override
public void onDeath(){ public void onDeath(){
super.onDeath();
dead = true; dead = true;
drownTime = 0f;
if(Net.active()){ if(Net.active()){
NetEvents.handleUnitDeath(this); NetEvents.handleUnitDeath(this);
} }
@@ -193,8 +193,6 @@ public class Player extends Unit{
public void update(){ public void update(){
hitTime = Math.max(0f, hitTime - Timers.delta()); hitTime = Math.max(0f, hitTime - Timers.delta());
status.update(this);
if(!isLocal){ if(!isLocal){
interpolate(); interpolate();
return; return;
@@ -265,7 +263,7 @@ public class Player extends Unit{
velocity.add(movement); velocity.add(movement);
updateVelocity(0.4f, speed); updateVelocityStatus(0.4f, speed);
if(!movement.isZero()){ if(!movement.isZero()){
walktime += Timers.delta() * velocity.len()*(1f/0.5f)/speed * getFloorOn().speedMultiplier; walktime += Timers.delta() * velocity.len()*(1f/0.5f)/speed * getFloorOn().speedMultiplier;

View File

@@ -28,6 +28,11 @@ public class StatusController {
} }
} }
public void clear(){
current = StatusEffects.none;
time = 0f;
}
public void update(Unit unit){ public void update(Unit unit){
time = Math.max(time - Timers.delta(), 0); time = Math.max(time - Timers.delta(), 0);

View File

@@ -34,16 +34,24 @@ public abstract class Unit extends SyncEntity {
return other instanceof Bullet && state.teams.areEnemies((((Bullet) other).team), team); return other instanceof Bullet && state.teams.areEnemies((((Bullet) other).team), team);
} }
@Override
public void onDeath() {
drownTime = 0f;
status.clear();
}
public Floor getFloorOn(){ public Floor getFloorOn(){
Tile tile = world.tileWorld(x, y); Tile tile = world.tileWorld(x, y);
return (Floor)(tile == null || (!(tile.floor() instanceof Floor)) ? Blocks.defaultFloor : tile.floor()); return (Floor)(tile == null || (!(tile.floor() instanceof Floor)) ? Blocks.defaultFloor : tile.floor());
} }
public void updateVelocity(float drag, float maxVelocity){ public void updateVelocityStatus(float drag, float maxVelocity){
Floor floor = getFloorOn(); Floor floor = getFloorOn();
velocity.limit(maxVelocity); velocity.limit(maxVelocity);
status.update(this);
if(isFlying()) { if(isFlying()) {
x += velocity.x / getMass(); x += velocity.x / getMass();
y += velocity.y / getMass(); y += velocity.y / getMass();

View File

@@ -79,6 +79,7 @@ public class BaseUnit extends Unit {
@Override @Override
public void onDeath(){ public void onDeath(){
super.onDeath();
type.onDeath(this); type.onDeath(this);
} }

View File

@@ -72,11 +72,7 @@ public abstract class UnitType {
updateTargeting(unit); updateTargeting(unit);
//TODO logic unit.updateVelocityStatus(drag, maxVelocity);
unit.status.update(unit);
unit.updateVelocity(drag, maxVelocity);
if(unit.target != null) behavior(unit); if(unit.target != null) behavior(unit);

View File

@@ -12,7 +12,6 @@ import io.anuke.mindustry.io.MapTileData.TileDataMarker;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.ColorMapper; import io.anuke.mindustry.world.ColorMapper;
import io.anuke.mindustry.world.ColorMapper.BlockPair; import io.anuke.mindustry.world.ColorMapper.BlockPair;
import io.anuke.ucore.util.Log;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
@@ -142,7 +141,7 @@ public class MapIO {
String name = stream.readUTF(); String name = stream.readUTF();
Block block = Block.getByName(name); Block block = Block.getByName(name);
if(block == null){ if(block == null){
Log.info("Map load info: No block with name {0} found.", name); //Log.info("Map load info: No block with name {0} found.", name);
block = Blocks.air; block = Blocks.air;
} }
map.put(id, block.id); map.put(id, block.id);