More multiplayer fixes
This commit is contained in:
@@ -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, () -> {}));
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user