mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-19 03:03:59 +07:00
Fixed unit pads / Added chat log
This commit is contained in:
parent
d031351bc8
commit
a01f64080d
Binary file not shown.
Before Width: | Height: | Size: 143 B After Width: | Height: | Size: 239 B |
Binary file not shown.
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
@ -5,6 +5,7 @@ import io.anuke.annotations.Annotations.Remote;
|
|||||||
import io.anuke.annotations.Annotations.Variant;
|
import io.anuke.annotations.Annotations.Variant;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
|
import io.anuke.ucore.util.Log;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.maxTextLength;
|
import static io.anuke.mindustry.Vars.maxTextLength;
|
||||||
import static io.anuke.mindustry.Vars.playerGroup;
|
import static io.anuke.mindustry.Vars.playerGroup;
|
||||||
@ -17,6 +18,8 @@ public class NetEvents{
|
|||||||
throw new ValidateException(player, "Player has sent a message above the text limit.");
|
throw new ValidateException(player, "Player has sent a message above the text limit.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.info("&y{0}: &lb{1}", (player.name == null ? "" : player.name), message);
|
||||||
|
|
||||||
if(Vars.ui != null){
|
if(Vars.ui != null){
|
||||||
Vars.ui.chatfrag.addMessage(message, player == null ? null : colorizeName(player.id, player.name));
|
Vars.ui.chatfrag.addMessage(message, player == null ? null : colorizeName(player.id, player.name));
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import io.anuke.mindustry.graphics.Shaders;
|
|||||||
import io.anuke.mindustry.type.Mech;
|
import io.anuke.mindustry.type.Mech;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.world.consumers.ConsumePowerExact;
|
||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
import io.anuke.mindustry.world.meta.BlockStat;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Graphics;
|
import io.anuke.ucore.core.Graphics;
|
||||||
@ -48,7 +49,7 @@ public class MechFactory extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
consumes.power(powerCapacity * 0.8f);
|
consumes.add(new ConsumePowerExact(powerCapacity * 0.8f));
|
||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import io.anuke.ucore.core.Timers;
|
|||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
|
|
||||||
public class ConsumePower extends Consume{
|
public class ConsumePower extends Consume{
|
||||||
private final float use;
|
protected final float use;
|
||||||
|
|
||||||
public ConsumePower(float use){
|
public ConsumePower(float use){
|
||||||
this.use = use;
|
this.use = use;
|
||||||
@ -40,7 +40,7 @@ public class ConsumePower extends Consume{
|
|||||||
stats.add(BlockStat.powerUse, use * 60f, StatUnit.powerSecond);
|
stats.add(BlockStat.powerUse, use * 60f, StatUnit.powerSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
float use(Block block){
|
protected float use(Block block){
|
||||||
return Math.min(use * Timers.delta(), block.powerCapacity);
|
return Math.min(use * Timers.delta(), block.powerCapacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package io.anuke.mindustry.world.consumers;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.world.Block;
|
||||||
|
|
||||||
|
public class ConsumePowerExact extends ConsumePower{
|
||||||
|
|
||||||
|
public ConsumePowerExact(float use){
|
||||||
|
super(use);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float use(Block block){
|
||||||
|
return this.use;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user