Direct core item drops
This commit is contained in:
@@ -35,7 +35,7 @@ public class Vars{
|
|||||||
//time between waves in frames (on normal mode)
|
//time between waves in frames (on normal mode)
|
||||||
public static final float wavespace = 60 * 60 * 1.5f;
|
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
|
//set ridiculously high for now
|
||||||
public static final float coreBuildRange = 999999f;
|
public static final float coreBuildRange = 999999f;
|
||||||
//team of the player by default
|
//team of the player by default
|
||||||
|
|||||||
@@ -1,30 +1,43 @@
|
|||||||
package io.anuke.mindustry.entities.units;
|
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.mindustry.type.Item;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class UnitDrops{
|
public class UnitDrops{
|
||||||
private static final int maxItems = 200;
|
|
||||||
private static Item[] dropTable;
|
private static Item[] dropTable;
|
||||||
|
|
||||||
public static void dropItems(BaseUnit unit){
|
public static void dropItems(BaseUnit unit){
|
||||||
//just don't drop anything for now
|
//items only dropped in waves for enemy team
|
||||||
/*
|
if(unit.getTeam() != Vars.waveTeam || Vars.state.mode.disableWaves){
|
||||||
if(Vars.itemGroup.size() > maxItems || unit.getTeam() != Team.red){
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TileEntity core = unit.getClosestEnemyCore();
|
||||||
|
|
||||||
|
if(core == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dropTable == null){
|
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(int i = 0; i < 3; i++){
|
||||||
for(Item item : dropTable){
|
for(Item item : dropTable){
|
||||||
|
//only drop unlocked items
|
||||||
|
if(!Vars.headless && !Vars.control.database().isUnlocked(item)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(Mathf.chance(0.03)){
|
if(Mathf.chance(0.03)){
|
||||||
int amount = Mathf.random(20, 40);
|
int amount = Mathf.random(20, 40);
|
||||||
ItemDrop.create(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f),
|
Call.transferItemTo(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f), core.tile);
|
||||||
unit.getVelocity().x + Mathf.range(3f), unit.getVelocity().y + Mathf.range(3f));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.world.blocks.distribution;
|
package io.anuke.mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.utils.ObjectSet;
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
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.annotations.Annotations.Remote;
|
||||||
import io.anuke.mindustry.content.bullets.TurretBullets;
|
import io.anuke.mindustry.content.bullets.TurretBullets;
|
||||||
import io.anuke.mindustry.content.fx.BlockFx;
|
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.content.fx.ShootFx;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
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;
|
reload = 1f;
|
||||||
Effects.shake(shake, shake, this);
|
Effects.shake(shake, shake, this);
|
||||||
Effects.effect(recieveEffect, bullet);
|
Effects.effect(recieveEffect, bullet);
|
||||||
|
|||||||
Reference in New Issue
Block a user