Bugfixes
This commit is contained in:
@@ -7,7 +7,6 @@ import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
@@ -19,6 +18,8 @@ import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class LaunchPad extends Block{
|
||||
public final int timerLaunch = timers++;
|
||||
/** Time inbetween launches. */
|
||||
@@ -54,7 +55,7 @@ public class LaunchPad extends Block{
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
if(!Vars.state.isCampaign()) return;
|
||||
if(!state.isCampaign()) return;
|
||||
|
||||
if(lightRegion.found()){
|
||||
Draw.color(lightColor);
|
||||
@@ -91,7 +92,7 @@ public class LaunchPad extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(!Vars.state.isCampaign()) return;
|
||||
if(!state.isCampaign()) return;
|
||||
|
||||
//launch when full and base conditions are met
|
||||
if(items.total() >= itemCapacity && efficiency() >= 1f && timer(timerLaunch, launchTime / timeScale)){
|
||||
@@ -175,12 +176,23 @@ public class LaunchPad extends Block{
|
||||
public void remove(){
|
||||
|
||||
//actually launch the items upon removal
|
||||
if(team() == Vars.state.rules.defaultTeam){
|
||||
if(team() == state.rules.defaultTeam && state.secinfo.origin != null){
|
||||
Seq<ItemStack> dest = state.secinfo.origin.getRecievedItems();
|
||||
|
||||
for(ItemStack stack : stacks){
|
||||
//TODO where do the items go?
|
||||
//Vars.data.addItem(stack.item, stack.amount);
|
||||
ItemStack sto = dest.find(i -> i.item == stack.item);
|
||||
if(sto != null){
|
||||
sto.amount += stack.amount;
|
||||
}else{
|
||||
dest.add(stack);
|
||||
}
|
||||
|
||||
//update export
|
||||
state.secinfo.handleItemExport(stack);
|
||||
Events.fire(new LaunchItemEvent(stack));
|
||||
}
|
||||
|
||||
state.secinfo.origin.setRecievedItems(dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user