More multiplayer fixes

This commit is contained in:
Anuken
2018-06-25 19:25:26 -04:00
parent f61f8a36f8
commit d89c33fbe8
8 changed files with 61 additions and 81 deletions

View File

@@ -41,16 +41,19 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{
@Remote(in = In.entities, called = Loc.server, unreliable = true)
public static void transferItemEffect(Item item, float x, float y, Unit to){
if(to == null) return;
create(item, x, y, to, () -> {});
}
@Remote(in = In.entities, called = Loc.server, unreliable = true)
public static void transferItemToUnit(Item item, float x, float y, Unit to){
if(to == null) return;
create(item, x, y, to, () -> to.inventory.addItem(item, 1));
}
@Remote(in = In.entities, called = Loc.server)
public static void transferItemTo(Item item, int amount, float x, float y, Tile tile){
if(tile == null) return;
for (int i = 0; i < Mathf.clamp(amount/3, 1, 8); i++) {
Timers.run(i*3, () -> create(item, x, y, tile, () -> {}));
}

View File

@@ -1,6 +1,7 @@
package io.anuke.mindustry.entities.traits;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.TimeUtils;
import io.anuke.mindustry.net.Interpolator;
import io.anuke.ucore.entities.trait.Entity;
@@ -24,8 +25,8 @@ public interface SyncTrait extends Entity, TypeTrait {
if(getInterpolator() != null) {
getInterpolator().target.set(x, y);
getInterpolator().last.set(x, y);
getInterpolator().spacing = 1f;
getInterpolator().time = 0f;
getInterpolator().updateSpacing = 16;
getInterpolator().lastUpdated = TimeUtils.millis();
}
}