Fixed 1-character names being valid / Fixed collideLine with tiles

This commit is contained in:
Anuken 2018-08-17 20:21:49 -04:00
parent f8d6797fc2
commit 20021c5b31
5 changed files with 28 additions and 30 deletions

View File

@ -87,7 +87,7 @@ text.server.kicked.serverOutdated=Outdated server! Ask the host to update!
text.server.kicked.banned=You are banned on this server.
text.server.kicked.recentKick=You have been kicked recently.\nWait before connecting again.
text.server.kicked.nameInUse=There is someone with that name\nalready on this server.
text.server.kicked.nameEmpty=Your name must contain at least one character or number.
text.server.kicked.nameEmpty=Your chosen name is invalid.
text.server.kicked.idInUse=You are already on this server! Connecting with two accounts is not permitted.
text.server.kicked.customClient=This server does not support custom builds. Download an official version.
text.host.info=The [accent]host[] button hosts a server on port [scarlet]6567[]. \nAnybody on the same [LIGHT_GRAY]wifi or local network[] should be able to see your server in their server list.\n\nIf you want people to be able to connect from anywhere by IP, [accent]port forwarding[] is required.\n\n[LIGHT_GRAY]Note: If someone is experiencing trouble connecting to your LAN game, make sure you have allowed Mindustry access to your local network in your firewall settings.

View File

@ -473,6 +473,9 @@ public class NetServer extends Module{
}
String fixName(String name){
if(name.equals("[") || name.equals("]")){
return "";
}
for(int i = 0; i < name.length(); i++){
if(name.charAt(i) == '[' && i != name.length() - 1 && name.charAt(i + 1) != '[' && (i == 0 || name.charAt(i - 1) != '[')){

View File

@ -363,6 +363,10 @@ public class World extends Module{
return null;
}
public void raycastEachWorld(float x0, float y0, float x1, float y1, Raycaster cons){
raycastEach(toTile(x0), toTile(y0), toTile(x1), toTile(y1), cons);
}
public void raycastEach(int x0f, int y0f, int x1, int y1, Raycaster cons){
int x0 = x0f;
int y0 = y0f;

View File

@ -6,6 +6,7 @@ import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.content.fx.ExplosionFx;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.game.Team;
@ -15,7 +16,6 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.impl.SolidEntity;
import io.anuke.ucore.function.Consumer;
import io.anuke.ucore.function.Predicate;
import io.anuke.ucore.util.Mathf;
@ -84,8 +84,17 @@ public class Damage{
* Damages entities in a line.
* Only enemies of the specified team are damaged.
*/
public static void collideLine(SolidEntity hitter, Team team, Effect effect, float x, float y, float angle, float length){
public static void collideLine(Bullet hitter, Team team, Effect effect, float x, float y, float angle, float length){
tr.trns(angle, length);
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
Tile tile = world.tile(cx, cy);
if(tile != null && tile.entity != null && tile.entity.collide(hitter)){
tile.entity.collision(hitter);
Effects.effect(effect, tile.worldx(), tile.worldy());
}
return false;
});
rect.setPosition(x, y).setSize(tr.x, tr.y);
float x2 = tr.x + x, y2 = tr.y + y;

View File

@ -13,41 +13,23 @@ public abstract class BulletType extends BaseBulletType<Bullet> implements Conte
private static Array<BulletType> types = new Array<>();
public final int id;
/**
* Knockback in velocity.
*/
/**Knockback in velocity.*/
public float knockback;
/**
* Whether this bullet hits tiles.
*/
/**Whether this bullet hits tiles.*/
public boolean hitTiles = true;
/**
* Status effect applied on hit.
*/
/**Status effect applied on hit.*/
public StatusEffect status = StatusEffects.none;
/**
* Intensity of applied status effect in terms of duration.
*/
/**Intensity of applied status effect in terms of duration.*/
public float statusIntensity = 0.5f;
/**
* What fraction of armor is pierced, 0-1
*/
/**What fraction of armor is pierced, 0-1*/
public float armorPierce = 0f;
/**
* Whether to sync this bullet to clients.
*/
/**Whether to sync this bullet to clients.*/
public boolean syncable;
/**
* Whether this bullet type collides with tiles.
*/
/**Whether this bullet type collides with tiles.*/
public boolean collidesTiles = true;
/**
* Whether this bullet types collides with anything at all.
*/
/**Whether this bullet types collides with anything at all.*/
public boolean collides = true;
/**
* Whether velocity is inherited from the shooter.
*/
/**Whether velocity is inherited from the shooter.*/
public boolean keepVelocity = true;
public BulletType(float speed, float damage){