Direct core item drops

This commit is contained in:
Anuken 2018-09-16 14:39:30 -04:00
parent 21f8e89ba4
commit 5e7ca0374c
3 changed files with 34 additions and 9 deletions

View File

@ -35,7 +35,7 @@ public class Vars{
//time between waves in frames (on normal mode)
public static final float wavespace = 60 * 60 * 1.5f;
public static final float mineTransferRange = 300f;
public static final float mineTransferRange = 310f;
//set ridiculously high for now
public static final float coreBuildRange = 999999f;
//team of the player by default

View File

@ -1,30 +1,43 @@
package io.anuke.mindustry.entities.units;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.type.Item;
import io.anuke.ucore.util.Mathf;
public class UnitDrops{
private static final int maxItems = 200;
private static Item[] dropTable;
public static void dropItems(BaseUnit unit){
//just don't drop anything for now
/*
if(Vars.itemGroup.size() > maxItems || unit.getTeam() != Team.red){
//items only dropped in waves for enemy team
if(unit.getTeam() != Vars.waveTeam || Vars.state.mode.disableWaves){
return;
}
TileEntity core = unit.getClosestEnemyCore();
if(core == null){
return;
}
if(dropTable == null){
dropTable = new Item[]{Items.densealloy, Items.lead, Items.copper};
dropTable = new Item[]{Items.densealloy, Items.silicon, Items.lead, Items.copper};
}
for(int i = 0; i < 3; i++){
for(Item item : dropTable){
//only drop unlocked items
if(!Vars.headless && !Vars.control.database().isUnlocked(item)){
continue;
}
if(Mathf.chance(0.03)){
int amount = Mathf.random(20, 40);
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));
Call.transferItemTo(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f), core.tile);
}
}
}*/
}
}
}

View File

@ -1,5 +1,6 @@
package io.anuke.mindustry.world.blocks.distribution;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.ObjectSet;
import com.badlogic.gdx.utils.Pool.Poolable;
@ -7,6 +8,7 @@ import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.content.fx.EnvironmentFx;
import io.anuke.mindustry.content.fx.ShootFx;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;
@ -282,6 +284,16 @@ public class MassDriver extends Block{
}
}
//drop all items remaining on the ground
for(int i = 0; i < data.items.length; i++){
int amountDropped = Mathf.random(0, data.items[i]);
if(amountDropped > 0){
float angle = Mathf.range(180f);
float vs = Mathf.random(0f, 4f);
Effects.effect(EnvironmentFx.dropItem, Color.WHITE, bullet.x, bullet.y, angle, content.item(i));
}
}
reload = 1f;
Effects.shake(shake, shake, this);
Effects.effect(recieveEffect, bullet);