mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 23:28:52 +07:00
Re-implemented block shadows / Removed alpha drones
This commit is contained in:
parent
36b27458b6
commit
35348f1150
@ -14,18 +14,12 @@ import io.anuke.mindustry.content.fx.UnitFx;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.effect.Lightning;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.entities.units.types.AlphaDrone;
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.maps.TutorialSector;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.type.Mech;
|
||||
|
||||
import static io.anuke.mindustry.Vars.unitGroups;
|
||||
|
||||
public class Mechs implements ContentList{
|
||||
public static Mech alpha, delta, tau, omega, dart, javelin, trident, glaive;
|
||||
|
||||
@ -36,8 +30,6 @@ public class Mechs implements ContentList{
|
||||
public void load(){
|
||||
|
||||
alpha = new Mech("alpha-mech", false){
|
||||
int maxDrones = 3;
|
||||
float buildTime = 20f;
|
||||
|
||||
{
|
||||
drillPower = 1;
|
||||
@ -53,28 +45,6 @@ public class Mechs implements ContentList{
|
||||
@Override
|
||||
public void updateAlt(Player player){
|
||||
|
||||
if(player.isShooting && getDrones(player) < maxDrones && !TutorialSector.supressDrone()){
|
||||
player.timer.get(Player.timerAbility, buildTime);
|
||||
|
||||
if(player.timer.getTime(Player.timerAbility) > buildTime/2f){
|
||||
if(!Net.client()){
|
||||
AlphaDrone drone = (AlphaDrone) UnitTypes.alphaDrone.create(player.getTeam());
|
||||
drone.leader = player;
|
||||
drone.set(player.x, player.y);
|
||||
drone.add();
|
||||
|
||||
Effects.effect(UnitFx.unitLand, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getDrones(Player player){
|
||||
int sum = 0;
|
||||
for(BaseUnit unit : unitGroups[player.getTeam().ordinal()].all()){
|
||||
if(unit instanceof AlphaDrone && ((AlphaDrone) unit).leader == player) sum ++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.mindustry.entities.units.UnitType;
|
||||
import io.anuke.mindustry.entities.units.types.*;
|
||||
@ -10,32 +9,11 @@ import io.anuke.mindustry.type.ContentType;
|
||||
public class UnitTypes implements ContentList{
|
||||
public static UnitType
|
||||
spirit, phantom,
|
||||
alphaDrone,
|
||||
wraith, ghoul, revenant,
|
||||
dagger, titan, fortress;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
alphaDrone = new UnitType("alpha-drone", AlphaDrone.class, AlphaDrone::new){
|
||||
{
|
||||
isFlying = true;
|
||||
drag = 0.005f;
|
||||
speed = 0.6f;
|
||||
maxVelocity = 1.7f;
|
||||
range = 40f;
|
||||
health = 45;
|
||||
hitsize = 4f;
|
||||
mass = 0.1f;
|
||||
weapon = Weapons.droneBlaster;
|
||||
trailColor = Color.valueOf("ffd37f");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
spirit = new UnitType("spirit", Spirit.class, Spirit::new){{
|
||||
weapon = Weapons.healBlasterDrone;
|
||||
isFlying = true;
|
||||
|
@ -9,6 +9,7 @@ import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.glutils.FrameBuffer;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.util.Tmp;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||
@ -32,6 +33,7 @@ public class BlockRenderer{
|
||||
private int requestidx = 0;
|
||||
private int iterateidx = 0;
|
||||
private FrameBuffer shadows = new FrameBuffer(1, 1);
|
||||
private FrameBuffer shadowWrite = new FrameBuffer(1, 1);
|
||||
|
||||
public BlockRenderer(){
|
||||
|
||||
@ -57,10 +59,10 @@ public class BlockRenderer{
|
||||
|
||||
public void drawShadows(){
|
||||
Draw.color(0, 0, 0, 0.15f);
|
||||
Draw.rect(Draw.wrap(shadows.getTexture()),
|
||||
Draw.rect(Draw.wrap(shadowWrite.getTexture()),
|
||||
camera.position.x - camera.position.x % tilesize,
|
||||
camera.position.y - camera.position.y % tilesize,
|
||||
shadows.getWidth(), -shadows.getHeight());
|
||||
shadowWrite.getWidth()*Draw.scl, -shadowWrite.getHeight()*Draw.scl);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@ -87,13 +89,15 @@ public class BlockRenderer{
|
||||
teamChecks.clear();
|
||||
requestidx = 0;
|
||||
|
||||
//TODO fix shadows
|
||||
Draw.flush();
|
||||
Draw.proj().setOrtho(Mathf.round(camera.position.x, tilesize)-shadowW/2f, Mathf.round(camera.position.y, tilesize)-shadowH/2f,
|
||||
shadowW, shadowH);
|
||||
Draw.proj().setOrtho(
|
||||
Mathf.round(Core.camera.position.x, tilesize)-shadowW/2f*Draw.scl,
|
||||
Mathf.round(Core.camera.position.y, tilesize)-shadowH/2f*Draw.scl,
|
||||
shadowW*Draw.scl, shadowH*Draw.scl);
|
||||
|
||||
if(shadows.getWidth() != shadowW || shadows.getHeight() != shadowH){
|
||||
shadows.resize(shadowW, shadowH);
|
||||
shadowWrite.resize(shadowW, shadowH);
|
||||
}
|
||||
|
||||
shadows.begin();
|
||||
@ -137,10 +141,24 @@ public class BlockRenderer{
|
||||
}
|
||||
}
|
||||
|
||||
//TODO proper shadows
|
||||
Draw.flush();
|
||||
shadows.end();
|
||||
|
||||
Tmp.tr1.set(shadows.getTexture());
|
||||
Shaders.outline.color.set(Color.BLACK);
|
||||
Shaders.outline.region = Tmp.tr1;
|
||||
|
||||
Draw.shader(Shaders.outline);
|
||||
shadowWrite.begin();
|
||||
Core.graphics.clear(Color.CLEAR);
|
||||
Draw.rect(Draw.wrap(shadows.getTexture()),
|
||||
Mathf.round(Core.camera.position.x, tilesize),
|
||||
Mathf.round(Core.camera.position.y, tilesize),
|
||||
shadows.getTexture().getWidth() * Draw.scl,
|
||||
-shadows.getTexture().getHeight() * Draw.scl);
|
||||
Draw.shader();
|
||||
shadowWrite.end();
|
||||
|
||||
Draw.proj(camera.projection());
|
||||
|
||||
Sort.instance().sort(requests.items, 0, requestidx);
|
||||
|
Loading…
Reference in New Issue
Block a user