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

@@ -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));
}
unit.velocity.scl(1.001f);
unit.velocity.scl(0.6f);
}
@Override

View File

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

View File

@@ -266,7 +266,7 @@ public class BlockFx {
bubble = new Effect(20, e -> {
Draw.color(Hue.shift(Tmp.c1.set(e.color), 2, 0.1f));
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);
});
Draw.reset();

View File

@@ -2,7 +2,9 @@ package io.anuke.mindustry.core;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.content.blocks.*;
import io.anuke.mindustry.entities.StatusEffect;
import io.anuke.mindustry.entities.units.UnitType;
import io.anuke.mindustry.resource.AmmoType;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.resource.Mech;
@@ -56,9 +58,9 @@ public class ContentLoader {
}
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,
Mech.getAllUpgrades().size, UnitType.getAllTypes().size);
Mech.getAllUpgrades().size, UnitType.getAllTypes().size, AmmoType.getAllTypes().size, StatusEffect.getAllEffects().size);
Log.info("-------------------");
}

View File

@@ -105,8 +105,8 @@ public class Player extends Unit{
@Override
public void onDeath(){
super.onDeath();
dead = true;
drownTime = 0f;
if(Net.active()){
NetEvents.handleUnitDeath(this);
}
@@ -193,8 +193,6 @@ public class Player extends Unit{
public void update(){
hitTime = Math.max(0f, hitTime - Timers.delta());
status.update(this);
if(!isLocal){
interpolate();
return;
@@ -265,7 +263,7 @@ public class Player extends Unit{
velocity.add(movement);
updateVelocity(0.4f, speed);
updateVelocityStatus(0.4f, speed);
if(!movement.isZero()){
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){
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);
}
@Override
public void onDeath() {
drownTime = 0f;
status.clear();
}
public Floor getFloorOn(){
Tile tile = world.tileWorld(x, y);
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();
velocity.limit(maxVelocity);
status.update(this);
if(isFlying()) {
x += velocity.x / getMass();
y += velocity.y / getMass();

View File

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

View File

@@ -72,11 +72,7 @@ public abstract class UnitType {
updateTargeting(unit);
//TODO logic
unit.status.update(unit);
unit.updateVelocity(drag, maxVelocity);
unit.updateVelocityStatus(drag, maxVelocity);
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.ColorMapper;
import io.anuke.mindustry.world.ColorMapper.BlockPair;
import io.anuke.ucore.util.Log;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -142,7 +141,7 @@ public class MapIO {
String name = stream.readUTF();
Block block = Block.getByName(name);
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;
}
map.put(id, block.id);