mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-15 15:20:57 -08:00
Bugfixes
This commit is contained in:
parent
0cc5945331
commit
2526224820
8 changed files with 24 additions and 203 deletions
|
|
@ -17,7 +17,7 @@ public class StatusEffects implements ContentList{
|
|||
none = new StatusEffect("none");
|
||||
|
||||
burning = new StatusEffect("burning"){{
|
||||
damage = 0.08f; //over 10 seconds, this would be 48 damage
|
||||
damage = 0.12f; //over 8 seconds, this would be 60 damage
|
||||
effect = Fx.burning;
|
||||
|
||||
init(() -> {
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ public class NetClient implements ApplicationListener{
|
|||
|
||||
Unit unit = player.dead() ? Nulls.unit : player.unit();
|
||||
|
||||
Call.clientShapshot(lastSent++,
|
||||
Call.clientSnapshot(lastSent++,
|
||||
player.dead(),
|
||||
unit.x, unit.y,
|
||||
player.unit().aimX(), player.unit().aimY(),
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ public class NetServer implements ApplicationListener{
|
|||
}
|
||||
|
||||
@Remote(targets = Loc.client, unreliable = true)
|
||||
public static void clientShapshot(
|
||||
public static void clientSnapshot(
|
||||
Player player,
|
||||
int snapshotID,
|
||||
boolean dead,
|
||||
|
|
@ -556,6 +556,10 @@ public class NetServer implements ApplicationListener{
|
|||
shooting = false;
|
||||
}
|
||||
|
||||
if(!player.dead() && (player.unit().type().flying || !player.unit().type().canBoost)){
|
||||
boosting = false;
|
||||
}
|
||||
|
||||
//TODO these need to be assigned elsewhere
|
||||
player.mouseX = pointerX;
|
||||
player.mouseY = pointerY;
|
||||
|
|
@ -607,7 +611,7 @@ public class NetServer implements ApplicationListener{
|
|||
|
||||
unit.vel.set(xVelocity, yVelocity).limit(unit.type().speed);
|
||||
long elapsed = Time.timeSinceMillis(con.lastReceivedClientTime);
|
||||
float maxSpeed = player.unit().type().speed;
|
||||
float maxSpeed = (boosting ? player.unit().type().boostMultiplier : 1f) * player.unit().type().speed;
|
||||
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.1f;
|
||||
|
||||
if(con.lastUnit != unit){
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public abstract class BulletType extends Content{
|
|||
/** Status effect applied on hit. */
|
||||
public StatusEffect status = StatusEffects.none;
|
||||
/** Intensity of applied status effect in terms of duration. */
|
||||
public float statusDuration = 60 * 10f;
|
||||
public float statusDuration = 60 * 8f;
|
||||
/** Whether this bullet type collides with tiles. */
|
||||
public boolean collidesTiles = true;
|
||||
/** Whether this bullet type collides with tiles that are of the same team. */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class LiquidBulletType extends BulletType{
|
|||
}
|
||||
|
||||
lifetime = 74f;
|
||||
statusDuration = 90f;
|
||||
statusDuration = 60f * 2f;
|
||||
despawnEffect = Fx.none;
|
||||
hitEffect = Fx.hitLiquid;
|
||||
smokeEffect = Fx.none;
|
||||
|
|
|
|||
|
|
@ -224,13 +224,17 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
Core.app.post(() -> Events.fire(new TapConfigEvent(tile, player, value)));
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
public static void unitControl(Player player, @Nullable Unit unit){
|
||||
//clear player unit when they possess a core
|
||||
if((unit instanceof BlockUnitc && ((BlockUnitc)unit).tile() instanceof CoreBuild)){
|
||||
Fx.spawn.at(player);
|
||||
if(net.client()){
|
||||
control.input.controlledType = null;
|
||||
}
|
||||
|
||||
player.clearUnit();
|
||||
player.deathTimer(60f); //for instant respawn
|
||||
player.deathTimer = 61f;
|
||||
}else if(unit == null){ //just clear the unit (is this used?)
|
||||
player.clearUnit();
|
||||
//make sure it's AI controlled, so players can't overwrite each other
|
||||
|
|
@ -243,14 +247,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
}
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
public static void unitClear(Player player){
|
||||
//no free core teleports?
|
||||
if(!player.dead() && player.unit().spawnedByCore) return;
|
||||
|
||||
Fx.spawn.at(player);
|
||||
player.clearUnit();
|
||||
player.deathTimer(60f); //for instant respawn
|
||||
player.deathTimer = 61f; //for instant respawn
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
|
|
@ -903,7 +907,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
}
|
||||
|
||||
public boolean canShoot(){
|
||||
return block == null && !onConfigurable() && !isDroppingItem() && !(player.builder().updateBuilding() && player.builder().isBuilding());
|
||||
return block == null && !onConfigurable() && !isDroppingItem() && !(player.builder().updateBuilding() && player.builder().isBuilding()) &&
|
||||
!(player.unit() instanceof Mechc && player.unit().isFlying());
|
||||
}
|
||||
|
||||
public boolean onConfigurable(){
|
||||
|
|
@ -1076,192 +1081,4 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
public int x, y, rotation;
|
||||
public boolean last;
|
||||
}
|
||||
|
||||
//TODO implement all of this!
|
||||
/*
|
||||
protected void updateKeyboard(){
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
boolean canMove = !Core.scene.hasKeyboard() || ui.minimapfrag.shown();
|
||||
|
||||
isBoosting = Core.input.keyDown(Binding.dash) && !mech.flying;
|
||||
|
||||
//if player is in solid block
|
||||
if(tile != null && tile.solid()){
|
||||
isBoosting = true;
|
||||
}
|
||||
|
||||
float speed = isBoosting && !mech.flying ? mech.boostSpeed : mech.speed;
|
||||
|
||||
if(mech.flying){
|
||||
//prevent strafing backwards, have a penalty for doing so
|
||||
float penalty = 0.2f; //when going 180 degrees backwards, reduce speed to 0.2x
|
||||
speed *= Mathf.lerp(1f, penalty, Angles.angleDist(rotation, velocity.angle()) / 180f);
|
||||
}
|
||||
|
||||
movement.setZero();
|
||||
|
||||
float xa = Core.input.axis(Binding.move_x);
|
||||
float ya = Core.input.axis(Binding.move_y);
|
||||
if(!(Core.scene.getKeyboardFocus() instanceof TextField)){
|
||||
movement.y += ya * speed;
|
||||
movement.x += xa * speed;
|
||||
}
|
||||
|
||||
if(Core.input.keyDown(Binding.mouse_move)){
|
||||
movement.x += Mathf.clamp((Core.input.mouseX() - Core.graphics.getWidth() / 2f) * 0.005f, -1, 1) * speed;
|
||||
movement.y += Mathf.clamp((Core.input.mouseY() - Core.graphics.getHeight() / 2f) * 0.005f, -1, 1) * speed;
|
||||
}
|
||||
|
||||
Vec2 vec = Core.input.mouseWorld(control.input.getMouseX(), control.input.getMouseY());
|
||||
pointerX = vec.x;
|
||||
pointerY = vec.y;
|
||||
updateShooting();
|
||||
|
||||
movement.limit(speed).scl(Time.delta());
|
||||
|
||||
if(canMove){
|
||||
velocity.add(movement.x, movement.y);
|
||||
}else{
|
||||
isShooting = false;
|
||||
}
|
||||
float prex = x, prey = y;
|
||||
updateVelocityStatus();
|
||||
moved = dst(prex, prey) > 0.001f;
|
||||
|
||||
if(canMove){
|
||||
float baseLerp = mech.getRotationAlpha(this);
|
||||
if(!isShooting() || !mech.faceTarget){
|
||||
if(!movement.isZero()){
|
||||
rotation = Mathf.slerpDelta(rotation, mech.flying ? velocity.angle() : movement.angle(), 0.13f * baseLerp);
|
||||
}
|
||||
}else{
|
||||
float angle = control.input.mouseAngle(x, y);
|
||||
this.rotation = Mathf.slerpDelta(this.rotation, angle, 0.1f * baseLerp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateShooting(){
|
||||
if(!state.isEditor() && isShooting() && mech.canShoot(this)){
|
||||
weapons.update(this);
|
||||
//if(!mech.turnCursor){
|
||||
//shoot forward ignoring cursor
|
||||
//mech.weapon.update(this, x + Angles.trnsx(rotation, mech.weapon.targetDistance), y + Angles.trnsy(rotation, mech.weapon.targetDistance));
|
||||
//}else{
|
||||
//mech.weapon.update(this, pointerX, pointerY);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateTouch(){
|
||||
if(Units.invalidateTarget(target, this) &&
|
||||
!(target instanceof Building && ((Building)target).damaged() && target.isValid() && target.team() == team && mech.canHeal && dst(target) < mech.range && !(((Building)target).block instanceof BuildBlock))){
|
||||
target = null;
|
||||
}
|
||||
|
||||
if(state.isEditor()){
|
||||
target = null;
|
||||
}
|
||||
|
||||
float targetX = Core.camera.position.x, targetY = Core.camera.position.y;
|
||||
float attractDst = 15f;
|
||||
float speed = isBoosting && !mech.flying ? mech.boostSpeed : mech.speed;
|
||||
|
||||
if(moveTarget != null && !moveTarget.dead()){
|
||||
targetX = moveTarget.getX();
|
||||
targetY = moveTarget.getY();
|
||||
boolean tapping = moveTarget instanceof Building && moveTarget.team() == team;
|
||||
attractDst = 0f;
|
||||
|
||||
if(tapping){
|
||||
velocity.setAngle(angleTo(moveTarget));
|
||||
}
|
||||
|
||||
if(dst(moveTarget) <= 2f * Time.delta()){
|
||||
if(tapping && !dead()){
|
||||
Tile tile = ((Building)moveTarget).tile;
|
||||
tile.tapped(this);
|
||||
}
|
||||
|
||||
moveTarget = null;
|
||||
}
|
||||
}else{
|
||||
moveTarget = null;
|
||||
}
|
||||
|
||||
movement.set((targetX - x) / Time.delta(), (targetY - y) / Time.delta()).limit(speed);
|
||||
movement.setAngle(Mathf.slerp(movement.angle(), velocity.angle(), 0.05f));
|
||||
|
||||
if(dst(targetX, targetY) < attractDst){
|
||||
movement.setZero();
|
||||
}
|
||||
|
||||
float expansion = 3f;
|
||||
|
||||
hitbox(rect);
|
||||
rect.x -= expansion;
|
||||
rect.y -= expansion;
|
||||
rect.width += expansion * 2f;
|
||||
rect.height += expansion * 2f;
|
||||
|
||||
isBoosting = collisions.overlapsTile(rect) || dst(targetX, targetY) > 85f;
|
||||
|
||||
velocity.add(movement.scl(Time.delta()));
|
||||
|
||||
if(velocity.len() <= 0.2f && mech.flying){
|
||||
rotation += Mathf.sin(Time.time() + id * 99, 10f, 1f);
|
||||
}else if(target == null){
|
||||
rotation = Mathf.slerpDelta(rotation, velocity.angle(), velocity.len() / 10f);
|
||||
}
|
||||
|
||||
float lx = x, ly = y;
|
||||
updateVelocityStatus();
|
||||
moved = dst(lx, ly) > 0.001f;
|
||||
|
||||
if(mech.flying){
|
||||
//hovering effect
|
||||
x += Mathf.sin(Time.time() + id * 999, 25f, 0.08f);
|
||||
y += Mathf.cos(Time.time() + id * 999, 25f, 0.08f);
|
||||
}
|
||||
|
||||
//update shooting if not building, not mining and there's ammo left
|
||||
if(!isBuilding() && mineTile() == null){
|
||||
|
||||
//autofire
|
||||
if(target == null){
|
||||
isShooting = false;
|
||||
if(Core.settings.getBool("autotarget")){
|
||||
target = Units.closestTarget(team, x, y, mech.range, u -> u.team() != Team.derelict, u -> u.team() != Team.derelict);
|
||||
|
||||
if(mech.canHeal && target == null){
|
||||
target = Geometry.findClosest(x, y, indexer.getDamaged(Team.sharded));
|
||||
if(target != null && dst(target) > mech.range){
|
||||
target = null;
|
||||
}else if(target != null){
|
||||
target = ((Tile)target).entity;
|
||||
}
|
||||
}
|
||||
|
||||
if(target != null){
|
||||
mineTile(null);
|
||||
}
|
||||
}
|
||||
}else if(target.isValid() || (target instanceof Building && ((Building)target).damaged() && target.team() == team && mech.canHeal && dst(target) < mech.range)){
|
||||
//rotate toward and shoot the target
|
||||
if(mech.faceTarget){
|
||||
rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.2f);
|
||||
}
|
||||
|
||||
Vec2 intercept = Predict.intercept(this, target, getWeapon().bullet.speed);
|
||||
|
||||
pointerX = intercept.x;
|
||||
pointerY = intercept.y;
|
||||
|
||||
updateShooting();
|
||||
isShooting = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -895,7 +895,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||
|
||||
player.mouseX = intercept.x;
|
||||
player.mouseY = intercept.y;
|
||||
player.shooting = true;
|
||||
player.shooting = !boosted;
|
||||
|
||||
unit.aim(player.mouseX, player.mouseY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ public enum UnaryOp{
|
|||
abs("abs", Math::abs),
|
||||
log("log", Math::log),
|
||||
log10("log10", Math::log10),
|
||||
sin("sin", Math::sin),
|
||||
cos("cos", Math::cos),
|
||||
tan("tan", Math::tan),
|
||||
sin("sin", d -> Math.sin(d * 0.017453292519943295D)),
|
||||
cos("cos", d -> Math.cos(d * 0.017453292519943295D)),
|
||||
tan("tan", d -> Math.tan(d * 0.017453292519943295D)),
|
||||
floor("floor", Math::floor),
|
||||
ceil("ceil", Math::ceil),
|
||||
sqrt("sqrt", Math::sqrt),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue