mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-15 12:24:28 +07:00
Gamemode-specfic missions / Red-enabled location verification
This commit is contained in:
parent
53b6e68a85
commit
ba96ea5a0c
@ -24,6 +24,7 @@ public class Mechs implements ContentList{
|
||||
speed = 0.5f;
|
||||
weapon = Weapons.blaster;
|
||||
trailColor = Palette.lightTrail;
|
||||
maxSpeed = 3f;
|
||||
}};
|
||||
|
||||
delta = new Mech("delta-mech", false){{
|
||||
@ -37,16 +38,19 @@ public class Mechs implements ContentList{
|
||||
weapon = Weapons.shockgun;
|
||||
ammoCapacity = 50;
|
||||
trailColor = Color.valueOf("d3ddff");
|
||||
maxSpeed = 3f;
|
||||
}};
|
||||
|
||||
tau = new Mech("tau-mech", false){{
|
||||
drillPower = 2;
|
||||
speed = 0.5f;
|
||||
maxSpeed = 3f;
|
||||
}};
|
||||
|
||||
omega = new Mech("omega-mech", false){{
|
||||
drillPower = 1;
|
||||
speed = 0.4f;
|
||||
maxSpeed = 3f;
|
||||
}};
|
||||
|
||||
dart = new Mech("dart-ship", true){{
|
||||
|
@ -131,11 +131,11 @@ public class Logic extends Module{
|
||||
|
||||
if(!state.is(State.paused) || Net.active()){
|
||||
|
||||
if(!state.mode.disableWaveTimer){
|
||||
if(!state.mode.disableWaveTimer && !state.mode.disableWaves){
|
||||
state.wavetime -= Timers.delta();
|
||||
}
|
||||
|
||||
if(!Net.client() && state.wavetime <= 0){
|
||||
if(!Net.client() && state.wavetime <= 0 && !state.mode.disableWaves){
|
||||
runWave();
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,9 @@ import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.game.Version;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.gen.RemoteReadServer;
|
||||
import io.anuke.mindustry.game.Version;
|
||||
import io.anuke.mindustry.net.*;
|
||||
import io.anuke.mindustry.net.Administration.PlayerInfo;
|
||||
import io.anuke.mindustry.net.Packets.*;
|
||||
@ -175,16 +175,14 @@ public class NetServer extends Module{
|
||||
NetConnection connection = Net.getConnection(id);
|
||||
if(player == null || connection == null || packet.snapid < connection.lastRecievedClientSnapshot) return;
|
||||
|
||||
boolean verifyPosition = !player.isDead() && !debug && headless && !player.mech.flying && player.getCarrier() == null;
|
||||
boolean verifyPosition = !player.isDead() && !debug && headless && player.getCarrier() == null;
|
||||
|
||||
if(connection.lastRecievedClientTime == 0) connection.lastRecievedClientTime = TimeUtils.millis() - 16;
|
||||
|
||||
long elapsed = TimeUtils.timeSinceMillis(connection.lastRecievedClientTime);
|
||||
|
||||
float maxSpeed = (packet.boosting && !player.mech.flying ? player.mech.boostSpeed : player.mech.speed) * 2.5f;
|
||||
|
||||
//extra 1.1x multiplicaton is added just in case
|
||||
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.1f;
|
||||
float maxSpeed = packet.boosting && !player.mech.flying ? player.mech.boostSpeed : player.mech.speed;
|
||||
float maxMove = elapsed / 1000f * 60f * Math.min(compound(maxSpeed, player.mech.drag) * 1.1f, player.mech.maxSpeed * 1.05f);
|
||||
|
||||
player.pointerX = packet.pointerX;
|
||||
player.pointerY = packet.pointerY;
|
||||
@ -238,6 +236,15 @@ public class NetServer extends Module{
|
||||
});
|
||||
}
|
||||
|
||||
private float compound(float speed, float drag){
|
||||
float total = 0f;
|
||||
for(int i = 0; i < 10; i++){
|
||||
total *= (1f - drag);
|
||||
total += speed;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a raw byte[] snapshot to a client, splitting up into chunks when needed.
|
||||
*/
|
||||
|
@ -219,6 +219,7 @@ public class World extends Module{
|
||||
/**Loads up a sector map. This does not call play(), but calls reset().*/
|
||||
public void loadSector(Sector sector){
|
||||
currentSector = sector;
|
||||
state.mode = sector.missions.peek().getMode();
|
||||
Timers.mark();
|
||||
Timers.mark();
|
||||
|
||||
|
@ -547,7 +547,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
velocity.add(movement);
|
||||
}
|
||||
float prex = x, prey = y;
|
||||
updateVelocityStatus(mech.drag, 10f);
|
||||
updateVelocityStatus(mech.drag, mech.maxSpeed);
|
||||
moved = distanceTo(prex, prey) > 0.01f;
|
||||
}else{
|
||||
velocity.setZero();
|
||||
|
@ -4,20 +4,19 @@ import io.anuke.ucore.util.Bundles;
|
||||
|
||||
public enum GameMode{
|
||||
waves,
|
||||
//disabled for technical reasons
|
||||
/*sandbox{
|
||||
{
|
||||
sandbox{{
|
||||
infiniteResources = true;
|
||||
disableWaveTimer = true;
|
||||
}
|
||||
},*/
|
||||
freebuild{
|
||||
{
|
||||
}},
|
||||
freebuild{{
|
||||
disableWaveTimer = true;
|
||||
}
|
||||
};
|
||||
}},
|
||||
noWaves{{
|
||||
disableWaves = true;
|
||||
}};
|
||||
public boolean infiniteResources;
|
||||
public boolean disableWaveTimer;
|
||||
public boolean disableWaves;
|
||||
|
||||
public String description(){
|
||||
return Bundles.get("mode." + name() + ".description");
|
||||
|
@ -2,6 +2,7 @@ package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.maps.Sector;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@ -14,6 +15,11 @@ public class BattleMission implements Mission{
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameMode getMode(){
|
||||
return GameMode.noWaves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String displayString(){
|
||||
return Bundles.get("text.mission.battle");
|
||||
|
@ -1,11 +1,13 @@
|
||||
package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.maps.Sector;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public interface Mission{
|
||||
boolean isComplete();
|
||||
String displayString();
|
||||
GameMode getMode();
|
||||
|
||||
default void generate(Tile[][] tiles, Sector sector){}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
@ -13,6 +14,11 @@ public class ResourceMission implements Mission{
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameMode getMode(){
|
||||
return GameMode.waves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplete(){
|
||||
return Vars.state.teams.getTeams(true).first().cores.first().entity.items.has(item, amount);
|
||||
|
@ -1,8 +1,9 @@
|
||||
package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
|
||||
public class WaveMission implements Mission{
|
||||
private final int target;
|
||||
@ -11,6 +12,11 @@ public class WaveMission implements Mission{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameMode getMode(){
|
||||
return GameMode.waves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String displayString(){
|
||||
return Bundles.format("text.mission.wave", target);
|
||||
|
@ -285,6 +285,7 @@ public class HudFragment extends Fragment{
|
||||
});
|
||||
|
||||
table.add().growX();
|
||||
table.visible(() -> !state.mode.disableWaves);
|
||||
|
||||
playButton(uheight);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user