Added all dummy ammo types, added ItemType class

This commit is contained in:
Anuken
2018-05-25 11:45:47 -04:00
parent 570226a051
commit 908a569413
9 changed files with 569 additions and 465 deletions

View File

@@ -5,6 +5,7 @@ import io.anuke.mindustry.content.fx.ShootFx;
import io.anuke.mindustry.type.AmmoType;
public class AmmoTypes {
//TODO add definitions for all ammo types
public static final AmmoType
basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5){{
@@ -12,7 +13,27 @@ public class AmmoTypes {
smokeEffect = ShootFx.shootSmallSmoke;
}},
basicSteel = new AmmoType(Items.steel, TurretBullets.basicSteel, 5){{
basicLead = new AmmoType(Items.iron, TurretBullets.basicIron, 5){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
}},
standardLead = new AmmoType(Items.iron, TurretBullets.basicIron, 5){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
}},
standardArmorPiercing = new AmmoType(Items.steel, TurretBullets.basicSteel, 5){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}},
homing = new AmmoType(Items.steel, TurretBullets.basicSteel, 5){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}},
tracer = new AmmoType(Items.steel, TurretBullets.basicSteel, 5){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}},
@@ -21,7 +42,42 @@ public class AmmoTypes {
shootEffect = ShootFx.shootSmallFlame;
}},
basicLeadFrag = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
basicLeadShell = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}},
explosiveFragShell = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}},
fragShell = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}},
standardThoriumShell = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}},
swarmMissile = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}},
scytheMissile = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}},
incendiaryMortar = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}},
surgeMortar = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}},

View File

@@ -2,73 +2,72 @@ package io.anuke.mindustry.content;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
public class Items {
public static final Item
stone = new Item("stone", Color.valueOf("777777")) {
{
material = false;
hardness = 3;
}
},
iron = new Item("iron", Color.valueOf("bc8271")){
{
hardness = 1;
}
},
lead = new Item("lead", Color.valueOf("8e85a2")){
{
hardness = 1;
}
},
coal = new Item("coal", Color.valueOf("272727")) {
{
explosiveness = 0.2f;
flammability = 0.5f;
fluxiness = 0.3f;
material = false;
hardness = 2;
}
},
steel = new Item("steel", Color.valueOf("e2e2e2")),
titanium = new Item("titanium", Color.valueOf("8da1e3")){
{
hardness = 3;
}
},
thorium = new Item("thorium", Color.valueOf("bb80bd")) {
{
explosiveness = 0.1f;
hardness = 4;
}
},
silicon = new Item("silicon", Color.valueOf("53565c")),
plastic = new Item("plastic", Color.valueOf("e9ead3")){
{
flammability = 0.2f;
explosiveness = 0.1f;
}
},
densealloy = new Item("densealloy", Color.valueOf("b4d5c7")),
biomatter = new Item("biomatter", Color.valueOf("648b55")) {
{
material = false;
flammability = 0.4f;
fluxiness = 0.2f;
}
},
sand = new Item("sand", Color.valueOf("e3d39e")){
{
material = false;
fluxiness = 0.5f;
}
},
rdx = new Item("rdx", Color.valueOf("ff795e")){
{
material = false;
flammability = 0.2f;
explosiveness = 0.6f;
}
};
stone = new Item("stone", Color.valueOf("777777")) {{
hardness = 3;
}},
iron = new Item("iron", Color.valueOf("bc8271")){{
type = ItemType.material;
hardness = 1;
}},
lead = new Item("lead", Color.valueOf("8e85a2")){{
type = ItemType.material;
hardness = 1;
}},
coal = new Item("coal", Color.valueOf("272727")) {{
explosiveness = 0.2f;
flammability = 0.5f;
fluxiness = 0.3f;
hardness = 2;
}},
steel = new Item("steel", Color.valueOf("e2e2e2")){{
type = ItemType.material;
}},
titanium = new Item("titanium", Color.valueOf("8da1e3")){{
hardness = 3;
}},
thorium = new Item("thorium", Color.valueOf("bb80bd")) {{
explosiveness = 0.1f;
hardness = 4;
}},
silicon = new Item("silicon", Color.valueOf("53565c")){{
type = ItemType.material;
}},
plastic = new Item("plastic", Color.valueOf("e9ead3")){{
type = ItemType.material;
flammability = 0.2f;
explosiveness = 0.1f;
}},
densealloy = new Item("densealloy", Color.valueOf("b4d5c7")){{
type = ItemType.material;
}},
biomatter = new Item("biomatter", Color.valueOf("648b55")) {{
type = ItemType.material;
flammability = 0.4f;
fluxiness = 0.2f;
}},
sand = new Item("sand", Color.valueOf("e3d39e")){{
fluxiness = 0.5f;
}},
rdx = new Item("rdx", Color.valueOf("ff795e")){{
flammability = 0.2f;
explosiveness = 0.6f;
}};
}

View File

@@ -67,7 +67,7 @@ public class WeaponBlocks{
crux = new ItemTurret("crux"){{
size = 2;
range = 100f;
ammoTypes = new AmmoType[]{AmmoTypes.basicLeadFrag};
ammoTypes = new AmmoType[]{AmmoTypes.basicLeadShell};
reload = 70f;
restitution = 0.03f;
ammoEjectBack = 3f;

View File

@@ -14,6 +14,7 @@ import io.anuke.mindustry.game.TeamInfo;
import io.anuke.mindustry.game.TeamInfo.TeamData;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Timers;
@@ -46,9 +47,10 @@ public class Logic extends Module {
public void play(){
state.wavetime = wavespace * state.difficulty.timeScaling * 2;
//fill inventory with items for debugging
for(Tile tile : state.teams.get(players[0].team).cores){
for(Item item : Item.getAllItems()){
if(item.material){
if(item.type == ItemType.material){
tile.entity.items.addItem(item, 1000);
}
}

View File

@@ -15,15 +15,16 @@ public class Item implements Comparable<Item>{
public final Color color;
public TextureRegion region;
/**type of the item; used for tabs and core acceptance. default value is {@link ItemType#resource}.*/
public ItemType type = ItemType.resource;
/**how explosive this item is.*/
public float explosiveness = 0f;
/**flammability above 0.3 makes this eleigible for item burners.*/
public float flammability = 0f;
/**how radioactive this item is. 0=none, 1=ridiculous*/
/**how radioactive this item is. 0=none, 1=chernobyl ground zero*/
public float radioactivity;
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
public float fluxiness = 0f;
/**whether this material goes in the core*/
public boolean material = true;
/**drill hardness of the item*/
public int hardness = 0;
/**the burning color of this item*/

View File

@@ -0,0 +1,10 @@
package io.anuke.mindustry.type;
public enum ItemType {
/**Not used for anything besides crafting inside blocks.*/
resource,
/**Can be used for constructing blocks. Only materials are accepted into the core.*/
material,
/**Only used as ammo for turrets.*/
ammo
}

View File

@@ -7,6 +7,7 @@ import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
import io.anuke.mindustry.world.BlockFlag;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.graphics.Draw;
@@ -46,7 +47,7 @@ public class CoreBlock extends StorageBlock {
@Override
public boolean acceptItem(Item item, Tile tile, Tile source) {
return tile.entity.items.items[item.id]< itemCapacity && item.material;
return tile.entity.items.items[item.id]< itemCapacity && item.type == ItemType.material;
}
@Override