Fixed item drop duplicates, invincible players
This commit is contained in:
@@ -199,7 +199,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public void damage(float amount){
|
||||
CallEntity.onPlayerDamage(this, calculateDamage(amount));
|
||||
|
||||
if(health <= 0 && !dead && isLocal){
|
||||
if(health <= 0 && !dead){
|
||||
CallEntity.onPlayerDeath(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
|
||||
return drop;
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, in = In.entities)
|
||||
public static void createItemDrop(Item item, int amount, float x, float y, float velocityX, float velocityY){
|
||||
public static void create(Item item, int amount, float x, float y, float velocityX, float velocityY){
|
||||
create(item, amount, x, y, 0).getVelocity().set(velocityX, velocityY);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.entities.units;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.gen.CallEntity;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class UnitDrops {
|
||||
for(Item item : dropTable){
|
||||
if(Mathf.chance(0.2)){
|
||||
int amount = Mathf.random(1, 5);
|
||||
CallEntity.createItemDrop(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f),
|
||||
ItemDrop.create(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f),
|
||||
unit.getVelocity().x + Mathf.range(3f), unit.getVelocity().y + Mathf.range(3f));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user