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
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

@@ -5,6 +5,7 @@ import io.anuke.mindustry.content.fx.ShootFx;
import io.anuke.mindustry.type.AmmoType; import io.anuke.mindustry.type.AmmoType;
public class AmmoTypes { public class AmmoTypes {
//TODO add definitions for all ammo types
public static final AmmoType public static final AmmoType
basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5){{ basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5){{
@@ -12,7 +13,27 @@ public class AmmoTypes {
smokeEffect = ShootFx.shootSmallSmoke; 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; shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke; smokeEffect = ShootFx.shootBigSmoke;
}}, }},
@@ -21,7 +42,42 @@ public class AmmoTypes {
shootEffect = ShootFx.shootSmallFlame; 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; shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2; smokeEffect = ShootFx.shootBigSmoke2;
}}, }},
+64 -65
View File
@@ -2,73 +2,72 @@ package io.anuke.mindustry.content;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
public class Items { public class Items {
public static final Item public static final Item
stone = new Item("stone", Color.valueOf("777777")) { stone = new Item("stone", Color.valueOf("777777")) {{
{ hardness = 3;
material = false; }},
hardness = 3;
} iron = new Item("iron", Color.valueOf("bc8271")){{
}, type = ItemType.material;
iron = new Item("iron", Color.valueOf("bc8271")){ hardness = 1;
{ }},
hardness = 1;
} lead = new Item("lead", Color.valueOf("8e85a2")){{
}, type = ItemType.material;
lead = new Item("lead", Color.valueOf("8e85a2")){ hardness = 1;
{ }},
hardness = 1;
} coal = new Item("coal", Color.valueOf("272727")) {{
}, explosiveness = 0.2f;
coal = new Item("coal", Color.valueOf("272727")) { flammability = 0.5f;
{ fluxiness = 0.3f;
explosiveness = 0.2f; hardness = 2;
flammability = 0.5f; }},
fluxiness = 0.3f;
material = false; steel = new Item("steel", Color.valueOf("e2e2e2")){{
hardness = 2; type = ItemType.material;
} }},
},
steel = new Item("steel", Color.valueOf("e2e2e2")), titanium = new Item("titanium", Color.valueOf("8da1e3")){{
titanium = new Item("titanium", Color.valueOf("8da1e3")){ hardness = 3;
{ }},
hardness = 3;
} thorium = new Item("thorium", Color.valueOf("bb80bd")) {{
}, explosiveness = 0.1f;
thorium = new Item("thorium", Color.valueOf("bb80bd")) { hardness = 4;
{ }},
explosiveness = 0.1f;
hardness = 4; silicon = new Item("silicon", Color.valueOf("53565c")){{
} type = ItemType.material;
}, }},
silicon = new Item("silicon", Color.valueOf("53565c")),
plastic = new Item("plastic", Color.valueOf("e9ead3")){ plastic = new Item("plastic", Color.valueOf("e9ead3")){{
{ type = ItemType.material;
flammability = 0.2f; flammability = 0.2f;
explosiveness = 0.1f; explosiveness = 0.1f;
} }},
},
densealloy = new Item("densealloy", Color.valueOf("b4d5c7")), densealloy = new Item("densealloy", Color.valueOf("b4d5c7")){{
biomatter = new Item("biomatter", Color.valueOf("648b55")) { type = ItemType.material;
{ }},
material = false;
flammability = 0.4f; biomatter = new Item("biomatter", Color.valueOf("648b55")) {{
fluxiness = 0.2f; type = ItemType.material;
} flammability = 0.4f;
}, fluxiness = 0.2f;
sand = new Item("sand", Color.valueOf("e3d39e")){ }},
{
material = false; sand = new Item("sand", Color.valueOf("e3d39e")){{
fluxiness = 0.5f;
} fluxiness = 0.5f;
}, }},
rdx = new Item("rdx", Color.valueOf("ff795e")){
{ rdx = new Item("rdx", Color.valueOf("ff795e")){{
material = false; flammability = 0.2f;
flammability = 0.2f; explosiveness = 0.6f;
explosiveness = 0.6f; }};
}
};
} }
@@ -67,7 +67,7 @@ public class WeaponBlocks{
crux = new ItemTurret("crux"){{ crux = new ItemTurret("crux"){{
size = 2; size = 2;
range = 100f; range = 100f;
ammoTypes = new AmmoType[]{AmmoTypes.basicLeadFrag}; ammoTypes = new AmmoType[]{AmmoTypes.basicLeadShell};
reload = 70f; reload = 70f;
restitution = 0.03f; restitution = 0.03f;
ammoEjectBack = 3f; ammoEjectBack = 3f;
+3 -1
View File
@@ -14,6 +14,7 @@ import io.anuke.mindustry.game.TeamInfo;
import io.anuke.mindustry.game.TeamInfo.TeamData; import io.anuke.mindustry.game.TeamInfo.TeamData;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
@@ -46,9 +47,10 @@ public class Logic extends Module {
public void play(){ public void play(){
state.wavetime = wavespace * state.difficulty.timeScaling * 2; state.wavetime = wavespace * state.difficulty.timeScaling * 2;
//fill inventory with items for debugging
for(Tile tile : state.teams.get(players[0].team).cores){ for(Tile tile : state.teams.get(players[0].team).cores){
for(Item item : Item.getAllItems()){ for(Item item : Item.getAllItems()){
if(item.material){ if(item.type == ItemType.material){
tile.entity.items.addItem(item, 1000); tile.entity.items.addItem(item, 1000);
} }
} }
+4 -3
View File
@@ -15,15 +15,16 @@ public class Item implements Comparable<Item>{
public final Color color; public final Color color;
public TextureRegion region; 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; public float explosiveness = 0f;
/**flammability above 0.3 makes this eleigible for item burners.*/ /**flammability above 0.3 makes this eleigible for item burners.*/
public float flammability = 0f; 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; public float radioactivity;
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/ /**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
public float fluxiness = 0f; public float fluxiness = 0f;
/**whether this material goes in the core*/
public boolean material = true;
/**drill hardness of the item*/ /**drill hardness of the item*/
public int hardness = 0; public int hardness = 0;
/**the burning color of this item*/ /**the burning color of this item*/
@@ -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
}
@@ -7,6 +7,7 @@ import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
import io.anuke.mindustry.world.BlockFlag; import io.anuke.mindustry.world.BlockFlag;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
@@ -46,7 +47,7 @@ public class CoreBlock extends StorageBlock {
@Override @Override
public boolean acceptItem(Item item, Tile tile, Tile source) { 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 @Override