More achievement cleanup
This commit is contained in:
@@ -69,7 +69,7 @@ public class StatusEffects implements ContentList{
|
||||
init(() -> {
|
||||
trans(shocked, ((unit, time, newTime, result) -> {
|
||||
unit.damagePierce(14f);
|
||||
if(unit.team() == state.rules.waveTeam){
|
||||
if(unit.team == state.rules.waveTeam){
|
||||
Events.fire(Trigger.shock);
|
||||
}
|
||||
result.set(this, time);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
@@ -9,10 +10,12 @@ import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Teams.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.blocks.defense.Wall.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -104,6 +107,10 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
}
|
||||
|
||||
type.hitEntity(self(), other, health);
|
||||
|
||||
if(owner instanceof WallBuild && player != null && team != player.team() && other instanceof Unit unit && unit.dead){
|
||||
Events.fire(Trigger.phaseDeflectHit);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
@@ -8,6 +9,7 @@ import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
@@ -52,12 +54,14 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
if(Vars.net.client()){
|
||||
Vars.netClient.clearRemovedEntity(unit.id);
|
||||
}
|
||||
Events.fire(new PickupEvent(self(), unit));
|
||||
}
|
||||
|
||||
void pickup(Building tile){
|
||||
tile.tile.remove();
|
||||
payloads.add(new BuildPayload(tile));
|
||||
Fx.unitPickup.at(tile);
|
||||
Events.fire(new PickupEvent(self(), tile));
|
||||
}
|
||||
|
||||
boolean dropLastPayload(){
|
||||
|
||||
@@ -102,6 +102,14 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
public static class SchematicCreateEvent{
|
||||
public final Schematic schematic;
|
||||
|
||||
public SchematicCreateEvent(Schematic schematic){
|
||||
this.schematic = schematic;
|
||||
}
|
||||
}
|
||||
|
||||
public static class CommandIssueEvent{
|
||||
public final Building tile;
|
||||
public final UnitCommand command;
|
||||
@@ -193,6 +201,34 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
public static class PickupEvent{
|
||||
public final Unit carrier;
|
||||
public final @Nullable Unit unit;
|
||||
public final @Nullable Building build;
|
||||
|
||||
public PickupEvent(Unit carrier, Unit unit){
|
||||
this.carrier = carrier;
|
||||
this.unit = unit;
|
||||
this.build = null;
|
||||
}
|
||||
|
||||
public PickupEvent(Unit carrier, Building build){
|
||||
this.carrier = carrier;
|
||||
this.build = build;
|
||||
this.unit = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class UnitControlEvent{
|
||||
public final Player player;
|
||||
public final @Nullable Unit unit;
|
||||
|
||||
public UnitControlEvent(Player player, @Nullable Unit unit){
|
||||
this.player = player;
|
||||
this.unit = unit;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GameOverEvent{
|
||||
public final Team winner;
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public class Schematics implements Loadable{
|
||||
}
|
||||
|
||||
private void loadLoadouts(){
|
||||
Seq.with(Loadouts.basicShard, Loadouts.basicFoundation, Loadouts.basicNucleus).each(s -> checkLoadout(s,false));
|
||||
Seq.with(Loadouts.basicShard, Loadouts.basicFoundation, Loadouts.basicNucleus).each(s -> checkLoadout(s, false));
|
||||
}
|
||||
|
||||
public void overwrite(Schematic target, Schematic newSchematic){
|
||||
@@ -354,7 +354,7 @@ public class Schematics implements Loadable{
|
||||
for(int cy = y; cy <= y2; cy++){
|
||||
Building linked = world.build(cx, cy);
|
||||
|
||||
if(linked != null && linked.block.isVisible() && !(linked.block instanceof ConstructBlock)){
|
||||
if(linked != null && (linked.block.isVisible() || linked.block() instanceof CoreBlock) && !(linked.block instanceof ConstructBlock)){
|
||||
int top = linked.block.size/2;
|
||||
int bot = linked.block.size % 2 == 1 ? -linked.block.size/2 : -(linked.block.size - 1)/2;
|
||||
minx = Math.min(linked.tileX() + bot, minx);
|
||||
|
||||
@@ -326,7 +326,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
//clear player unit when they possess a core
|
||||
if((unit instanceof BlockUnitc && ((BlockUnitc)unit).tile() instanceof CoreBuild)){
|
||||
if(unit instanceof BlockUnitc block && block.tile() instanceof CoreBuild build){
|
||||
Fx.spawn.at(player);
|
||||
if(net.client()){
|
||||
control.input.controlledType = null;
|
||||
@@ -334,8 +334,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
player.clearUnit();
|
||||
player.deathTimer = 61f;
|
||||
((CoreBuild)((BlockUnitc)unit).tile()).requestSpawn(player);
|
||||
|
||||
build.requestSpawn(player);
|
||||
}else if(unit == null){ //just clear the unit (is this used?)
|
||||
player.clearUnit();
|
||||
//make sure it's AI controlled, so players can't overwrite each other
|
||||
@@ -349,6 +348,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
Fx.unitSpirit.at(player.x, player.y, 0f, unit);
|
||||
}
|
||||
}
|
||||
|
||||
Events.fire(new UnitControlEvent(player, unit));
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
@@ -543,6 +544,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
schematics.add(lastSchematic);
|
||||
ui.showInfoFade("@schematic.saved");
|
||||
ui.schematics.showInfo(lastSchematic);
|
||||
Events.fire(new SchematicCreateEvent(lastSchematic));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class CoreBlock extends StorageBlock{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.buildTime, 0, StatUnit.seconds);
|
||||
stats.remove(Stat.buildTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,13 +46,17 @@ public class Unloader extends Block{
|
||||
public class UnloaderBuild extends Building{
|
||||
public Item sortItem = null;
|
||||
public Building dumpingTo;
|
||||
public int offset = 0;
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(timer(timerUnload, speed / timeScale())){
|
||||
for(Building other : proximity){
|
||||
for(int i = 0; i < proximity.size; i++){
|
||||
int pos = (offset + i) % proximity.size;
|
||||
var other = proximity.get(pos);
|
||||
|
||||
if(other.interactable(team) && other.block.unloadable && other.block.hasItems
|
||||
&& ((sortItem == null && other.items.total() > 0) || (sortItem != null && other.items.has(sortItem)))){
|
||||
&& ((sortItem == null && other.items.total() > 0) || (sortItem != null && other.items.has(sortItem)))){
|
||||
//make sure the item can't be dumped back into this block
|
||||
dumpingTo = other;
|
||||
|
||||
@@ -70,6 +74,11 @@ public class Unloader extends Block{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(proximity.size > 0){
|
||||
offset ++;
|
||||
offset %= proximity.size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user