From da2a8aaf26822cbf9a58651434552347545f3ab3 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 26 May 2020 19:59:31 -0400 Subject: [PATCH] this is necessary again --- core/src/mindustry/core/Control.java | 9 +++++++++ core/src/mindustry/core/Logic.java | 4 ---- core/src/mindustry/ctype/Content.java | 8 +++----- core/src/mindustry/editor/DrawOperation.java | 2 +- core/src/mindustry/entities/comp/LegsComp.java | 17 ++++++++++++----- core/src/mindustry/net/Registrator.java | 4 ++-- core/src/mindustry/type/Weather.java | 2 +- gradle.properties | 2 +- 8 files changed, 29 insertions(+), 19 deletions(-) diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index b2e7b91025..f744a16b4f 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -392,6 +392,15 @@ public class Control implements ApplicationListener, Loadable{ public void init(){ platform.updateRPC(); + //just a regular reminder + if(!OS.prop("user.name").equals("anuke") && !OS.hasEnv("iknowwhatimdoing")){ + if(mobile){ + ui.showInfo("[scarlet]6.0 doesn't work on mobile.[] Don't play it."); + }else{ + ui.showInfo("[scarlet]6.0 is not supposed to be played.[] Go do something else."); + } + } + //play tutorial on stop if(!settings.getBool("playedtutorial", false)){ Core.app.post(() -> Core.app.post(this::playTutorial)); diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index b02198d644..502d3f2571 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -33,10 +33,6 @@ import static mindustry.Vars.*; public class Logic implements ApplicationListener{ public Logic(){ - Events.on(WorldLoadEvent.class, event -> { - //TODO remove later - //Weathers.snow.create(); - }); Events.on(WaveEvent.class, event -> { if(state.isCampaign()){ diff --git a/core/src/mindustry/ctype/Content.java b/core/src/mindustry/ctype/Content.java index 19196a5f4a..7565dc88b0 100644 --- a/core/src/mindustry/ctype/Content.java +++ b/core/src/mindustry/ctype/Content.java @@ -14,7 +14,7 @@ public abstract class Content implements Comparable, Disposable{ public Content(){ - this.id = (short) Vars.content.getBy(getContentType()).size; + this.id = (short)Vars.content.getBy(getContentType()).size; Vars.content.handleContent(this); } @@ -25,15 +25,13 @@ public abstract class Content implements Comparable, Disposable{ public abstract ContentType getContentType(); /** Called after all content and modules are created. Do not use to load regions or texture data! */ - public void init(){ - } + public void init(){} /** * Called after all content is created, only on non-headless versions. * Use for loading regions or other image data. */ - public void load(){ - } + public void load(){} /** @return whether an error ocurred during mod loading. */ public boolean hasErrored(){ diff --git a/core/src/mindustry/editor/DrawOperation.java b/core/src/mindustry/editor/DrawOperation.java index c38efca996..17e84715db 100755 --- a/core/src/mindustry/editor/DrawOperation.java +++ b/core/src/mindustry/editor/DrawOperation.java @@ -1,6 +1,6 @@ package mindustry.editor; -import mindustry.annotations.Annotations.Struct; +import mindustry.annotations.Annotations.*; import arc.struct.LongArray; import mindustry.game.Team; import mindustry.gen.TileOp; diff --git a/core/src/mindustry/entities/comp/LegsComp.java b/core/src/mindustry/entities/comp/LegsComp.java index cef4485a60..e494e32b27 100644 --- a/core/src/mindustry/entities/comp/LegsComp.java +++ b/core/src/mindustry/entities/comp/LegsComp.java @@ -7,11 +7,13 @@ import mindustry.annotations.Annotations.*; import mindustry.content.*; import mindustry.entities.*; import mindustry.gen.*; +import mindustry.type.*; import mindustry.world.blocks.environment.*; @Component abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ @Import float x, y, elevation; + @Import UnitType type; transient Leg[] legs = {}; transient float totalLength; @@ -22,12 +24,12 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ //keep elevation halfway elevation = 0.5f; - int count = type().legCount; - float legLength = type().legLength; + int count = type.legCount; + float legLength = type.legLength; float rotation = vel().angle(); //set up initial leg positions - if(legs.length != type().legCount){ + if(legs.length != type.legCount){ this.legs = new Leg[count]; float spacing = 360f / count; @@ -42,7 +44,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ } } - float moveSpeed = type().legSpeed; + float moveSpeed = type.legSpeed; int div = Math.max(legs.length / 2, 2); float moveSpace = legLength / 1.6f / (div / 2f); @@ -62,6 +64,11 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ }else{ Fx.unitLandSmall.at(l.base.x, l.base.y, 0.5f, floor.mapColor); } + + //shake when legs contact ground + if(type.landShake > 0){ + Effects.shake(type.landShake, type.landShake, this); + } } } @@ -69,7 +76,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ } float movespace = 360f / legs.length / 4f; - float trns = vel().len() * 12.5f * div/1.5f * type().legTrns; + float trns = vel().len() * 12.5f * div/1.5f * type.legTrns; Tmp.v4.trns(rotation, trns); diff --git a/core/src/mindustry/net/Registrator.java b/core/src/mindustry/net/Registrator.java index 8e3c48dc51..c0368497f5 100644 --- a/core/src/mindustry/net/Registrator.java +++ b/core/src/mindustry/net/Registrator.java @@ -5,14 +5,14 @@ import arc.func.Prov; import mindustry.net.Packets.*; public class Registrator{ - private static ClassEntry[] classes = { + private static final ClassEntry[] classes = { new ClassEntry(StreamBegin.class, StreamBegin::new), new ClassEntry(StreamChunk.class, StreamChunk::new), new ClassEntry(WorldStream.class, WorldStream::new), new ClassEntry(ConnectPacket.class, ConnectPacket::new), new ClassEntry(InvokePacket.class, InvokePacket::new) }; - private static ObjectIntMap ids = new ObjectIntMap<>(); + private static final ObjectIntMap> ids = new ObjectIntMap<>(); static{ if(classes.length > 127) throw new RuntimeException("Can't have more than 127 registered classes!"); diff --git a/core/src/mindustry/type/Weather.java b/core/src/mindustry/type/Weather.java index d541a75029..cf2d5fc28d 100644 --- a/core/src/mindustry/type/Weather.java +++ b/core/src/mindustry/type/Weather.java @@ -71,7 +71,7 @@ public abstract class Weather extends MappableContent{ return ContentType.weather; } - @Remote + @Remote(called = Loc.server) public static void createWeather(Weather weather, float intensity, float duration){ weather.create(intensity, duration); } diff --git a/gradle.properties b/gradle.properties index d6e56b4a21..1652cb9f9d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=c8cdb44c30f50d0350c403547ad25532ad77c465 +archash=edaf52e6768e0c24cc4598de8105d07a6c66efd8