mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-20 12:47:37 +07:00
Added message for last accessed player of block
This commit is contained in:
@ -575,6 +575,7 @@ info.title = Info
|
||||
error.title = [scarlet]An error has occured
|
||||
error.crashtitle = An error has occured
|
||||
unit.nobuild = [scarlet]Unit can't build
|
||||
lastaccessed = [lightgray]Last Accessed: {0}
|
||||
blocks.input = Input
|
||||
blocks.output = Output
|
||||
blocks.booster = Booster
|
||||
|
@ -28,7 +28,7 @@ public class SuicideAI extends GroundAI{
|
||||
|
||||
boolean rotate = false, shoot = false, moveToTarget = false;
|
||||
|
||||
if(!Units.invalidateTarget(target, unit, unit.range())){
|
||||
if(!Units.invalidateTarget(target, unit, unit.range()) && unit.hasWeapons()){
|
||||
rotate = true;
|
||||
shoot = unit.within(target, unit.type().weapons.first().bullet.range() +
|
||||
(target instanceof Building ? ((Building)target).block.size * Vars.tilesize / 2f : ((Hitboxc)target).hitSize() / 2f));
|
||||
@ -38,7 +38,11 @@ public class SuicideAI extends GroundAI{
|
||||
}
|
||||
|
||||
//do not move toward walls or transport blocks
|
||||
if(!(target instanceof Building build && (build.block.group == BlockGroup.walls || build.block.group == BlockGroup.liquids || build.block.group == BlockGroup.transportation))){
|
||||
if(!(target instanceof Building build && (
|
||||
build.block.group == BlockGroup.walls ||
|
||||
build.block.group == BlockGroup.liquids ||
|
||||
build.block.group == BlockGroup.transportation
|
||||
))){
|
||||
blockedByBlock = false;
|
||||
|
||||
//raycast for target
|
||||
|
@ -994,7 +994,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
router = new Router("router"){{
|
||||
requirements(Category.distribution, with(Items.copper, 3));
|
||||
buildCostMultiplier = 2f;
|
||||
buildCostMultiplier = 4f;
|
||||
}};
|
||||
|
||||
distributor = new Router("distributor"){{
|
||||
|
@ -57,6 +57,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
transient int rotation;
|
||||
transient boolean enabled = true;
|
||||
transient float enabledControlTime;
|
||||
transient String lastAccessed;
|
||||
|
||||
PowerModule power;
|
||||
ItemModule items;
|
||||
@ -879,6 +880,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
//null is of type void.class; anonymous classes use their superclass.
|
||||
Class<?> type = value == null ? void.class : value.getClass().isAnonymousClass() ? value.getClass().getSuperclass() : value.getClass();
|
||||
|
||||
if(builder != null && builder.isPlayer()){
|
||||
lastAccessed = builder.getPlayer().name;
|
||||
}
|
||||
|
||||
if(block.configurations.containsKey(type)){
|
||||
block.configurations.get(type).get(this, value);
|
||||
}
|
||||
@ -1043,6 +1048,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
}
|
||||
}
|
||||
|
||||
if(net.active() && lastAccessed != null){
|
||||
table.row();
|
||||
table.add(Core.bundle.format("lastaccessed", lastAccessed)).growX().wrap().left();
|
||||
}
|
||||
|
||||
table.marginBottom(-5);
|
||||
}
|
||||
}
|
||||
|
@ -86,10 +86,10 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(payload instanceof BuildPayload){
|
||||
return dropBlock((BuildPayload)payload);
|
||||
}else if(payload instanceof UnitPayload){
|
||||
return dropUnit((UnitPayload)payload);
|
||||
if(payload instanceof BuildPayload b){
|
||||
return dropBlock(b);
|
||||
}else if(payload instanceof UnitPayload p){
|
||||
return dropUnit(p);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -126,6 +126,8 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
int rot = (int)((rotation + 45f) / 90f) % 4;
|
||||
payload.place(on, rot);
|
||||
|
||||
if(isPlayer()) payload.build.lastAccessed = getPlayer().name;
|
||||
|
||||
Fx.unitDrop.at(tile);
|
||||
Fx.placeBlock.at(on.drawx(), on.drawy(), on.block().size);
|
||||
return true;
|
||||
|
@ -10,7 +10,6 @@ import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
@ -257,7 +256,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true, unreliable = true)
|
||||
public static void rotateBlock(Player player, Building tile, boolean direction){
|
||||
public static void rotateBlock(@Nullable Player player, Building tile, boolean direction){
|
||||
if(tile == null) return;
|
||||
|
||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||
@ -265,6 +264,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
throw new ValidateException(player, "Player cannot rotate a block.");
|
||||
}
|
||||
|
||||
if(player != null) tile.lastAccessed = player.name;
|
||||
tile.rotation = Mathf.mod(tile.rotation + Mathf.sign(direction), 4);
|
||||
tile.updateProximity();
|
||||
tile.noSleep();
|
||||
|
@ -58,7 +58,7 @@ public class ConstructBlock extends Block{
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void constructFinish(Tile tile, Block block, Unit builder, byte rotation, Team team, Object config){
|
||||
public static void constructFinish(Tile tile, Block block, @Nullable Unit builder, byte rotation, Team team, Object config){
|
||||
if(tile == null) return;
|
||||
|
||||
float healthf = tile.build == null ? 1f : tile.build.healthf();
|
||||
@ -76,6 +76,10 @@ public class ConstructBlock extends Block{
|
||||
if(prev != null && prev.size > 0){
|
||||
tile.build.overwrote(prev);
|
||||
}
|
||||
|
||||
if(builder != null && builder.isPlayer()){
|
||||
tile.build.lastAccessed = builder.getPlayer().name;
|
||||
}
|
||||
}
|
||||
|
||||
//last builder was this local client player, call placed()
|
||||
|
Reference in New Issue
Block a user