mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 05:51:47 -08:00
PvP autohost
This commit is contained in:
parent
404cbf9b4a
commit
4eb2c1f646
3 changed files with 21 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ allprojects {
|
|||
appName = 'Mindustry'
|
||||
gdxVersion = '1.9.8'
|
||||
roboVMVersion = '2.3.0'
|
||||
uCoreVersion = '628ced32dbceefe9096c6acc9639cd39b1a867f4'
|
||||
uCoreVersion = 'abd096135c0c3da6f42b781851118b8725b1c676'
|
||||
|
||||
getVersionString = {
|
||||
String buildVersion = getBuildVersion()
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ text.saving=[accent]Saving...
|
|||
text.wave=[orange]Wave {0}
|
||||
text.wave.waiting=[LIGHT_GRAY]Wave in {0}
|
||||
text.waiting=[LIGHT_GRAY]Waiting...
|
||||
text.waiting.players=Waiting for 2 players...
|
||||
text.waiting.players=Waiting for players...
|
||||
text.wave.enemies=[LIGHT_GRAY]{0} Enemies Remaining
|
||||
text.wave.enemy=[LIGHT_GRAY]{0} Enemy Remaining
|
||||
text.loadimage=Load Image
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.audio.Sound;
|
|||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
|
|
@ -13,6 +14,7 @@ import io.anuke.mindustry.game.Content;
|
|||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.Saves;
|
||||
import io.anuke.mindustry.game.Unlocks;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.input.DefaultKeybinds;
|
||||
import io.anuke.mindustry.input.DesktopInput;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
|
|
@ -27,7 +29,10 @@ import io.anuke.ucore.entities.Entities;
|
|||
import io.anuke.ucore.entities.EntityQuery;
|
||||
import io.anuke.ucore.modules.Module;
|
||||
import io.anuke.ucore.util.Atlas;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
|
|
@ -159,6 +164,19 @@ public class Control extends Module{
|
|||
});
|
||||
});
|
||||
|
||||
//autohost for pvp sectors
|
||||
Events.on(WorldLoadEvent.class, event -> {
|
||||
if(state.mode.isPvp && !Net.active()){
|
||||
try{
|
||||
Net.host(port);
|
||||
players[0].isAdmin = true;
|
||||
}catch(IOException e){
|
||||
ui.showError(Bundles.format("text.server.error", Strings.parseException(e, false)));
|
||||
state.set(State.menu);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(WorldLoadEvent.class, event -> threads.runGraphics(() -> Events.fire(new WorldLoadGraphicsEvent())));
|
||||
|
||||
Events.on(TileChangeEvent.class, event -> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue