Additional bullet effects / Rotational replacement
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Mon Apr 02 23:01:45 EDT 2018
|
#Tue Apr 03 18:35:41 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=815
|
androidBuildCode=815
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class TurretBullets {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Bullet b) {
|
public void draw(Bullet b) {
|
||||||
Draw.color(Color.valueOf("f3d47f"));
|
Draw.color(Color.valueOf("f3d47f"));
|
||||||
Draw.rect("bullet", b.x, b.y, b.angle() - 90);
|
Draw.rect("bullet", b.x, b.y, 9f, 5f + b.fract()*7f, b.angle() - 90);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ public class NetServer extends Module{
|
|||||||
|
|
||||||
Block block = Block.getByID(packet.block);
|
Block block = Block.getByID(packet.block);
|
||||||
|
|
||||||
if(!Placement.validPlace(placer.team, packet.x, packet.y, block)) return;
|
if(!Placement.validPlace(placer.team, packet.x, packet.y, block, packet.rotation)) return;
|
||||||
|
|
||||||
Recipe recipe = Recipes.getByResult(block);
|
Recipe recipe = Recipes.getByResult(block);
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,21 @@ import io.anuke.ucore.entities.BaseBulletType;
|
|||||||
|
|
||||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||||
public Effect hitEffect = BulletFx.hit;
|
public Effect hitEffect = BulletFx.hit;
|
||||||
|
public Effect despawnEffect = BulletFx.despawn;
|
||||||
|
|
||||||
public BulletType(float speed, int damage){
|
public BulletType(float speed, int damage){
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
|
lifetime = 40f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hit(Bullet b, float hitx, float hity){
|
public void hit(Bullet b, float hitx, float hity){
|
||||||
Effects.effect(hitEffect, hitx, hity, b.angle());
|
Effects.effect(hitEffect, hitx, hity, b.angle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void despawned(Bullet b){
|
||||||
|
Effects.effect(despawnEffect, b.x, b.y, b.angle());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,18 @@ public class BulletFx {
|
|||||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*3 + 1f);
|
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*3 + 1f);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
}),
|
||||||
|
|
||||||
|
despawn = new Effect(12, e -> {
|
||||||
|
Draw.color(lighterOrange, Color.GRAY, e.ifract());
|
||||||
|
Lines.stroke(e.fract());
|
||||||
|
|
||||||
|
Angles.randLenVectors(e.id, 7, e.ifract()*7f, e.rotation, 40f, (x, y) -> {
|
||||||
|
float ang = Mathf.atan2(x, y);
|
||||||
|
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*2 + 1f);
|
||||||
|
});
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Placement.validPlace(player.team, x, y, type);
|
return Placement.validPlace(player.team, x, y, type, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validBreak(int x, int y){
|
public boolean validBreak(int x, int y){
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public class Block extends BaseBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canReplace(Block other){
|
public boolean canReplace(Block other){
|
||||||
return other != this && this.group != BlockGroup.none && other.group == this.group;
|
return (other != this || rotate) && this.group != BlockGroup.none && other.group == this.group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int handleDamage(Tile tile, int amount){
|
public int handleDamage(Tile tile, int amount){
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class Placement {
|
|||||||
if(effects && sound) threads.run(() -> Effects.sound("place", x * tilesize, y * tilesize));
|
if(effects && sound) threads.run(() -> Effects.sound("place", x * tilesize, y * tilesize));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean validPlace(Team team, int x, int y, Block type){
|
public static boolean validPlace(Team team, int x, int y, Block type, int rotation){
|
||||||
Recipe recipe = Recipes.getByResult(type);
|
Recipe recipe = Recipes.getByResult(type);
|
||||||
|
|
||||||
if(recipe == null || !state.inventory.hasItems(recipe.requirements)){
|
if(recipe == null || !state.inventory.hasItems(recipe.requirements)){
|
||||||
@@ -134,8 +134,8 @@ public class Placement {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}else {
|
}else {
|
||||||
return tile.block() != type && (tile.getTeam() == Team.none || tile.getTeam() == team)
|
return (tile.getTeam() == Team.none || tile.getTeam() == team)
|
||||||
&& (type.canReplace(tile.block()) || tile.block().alwaysReplace)
|
&& ((type.canReplace(tile.block()) && !(type == tile.block() && rotation == tile.getRotation() && type.rotate)) || tile.block().alwaysReplace)
|
||||||
&& tile.block().isMultiblock() == type.isMultiblock() || tile.block() == Blocks.air;
|
&& tile.block().isMultiblock() == type.isMultiblock() || tile.block() == Blocks.air;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.types.distribution;
|
|||||||
|
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
|
import io.anuke.mindustry.world.BlockGroup;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@ public class Splitter extends Block{
|
|||||||
instantTransfer = true;
|
instantTransfer = true;
|
||||||
destructible = true;
|
destructible = true;
|
||||||
hasInventory = false;
|
hasInventory = false;
|
||||||
|
group = BlockGroup.transportation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user