diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientLauncher.java index fd93a7fa5a..a130e4bf4a 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java @@ -36,7 +36,6 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform loader = new LoadRenderer(); Events.fire(new ClientCreateEvent()); - Vars.loadLogger(); Vars.loadFileLogger(); Vars.platform = this; beginTime = Time.millis(); diff --git a/core/src/mindustry/ai/types/FormationAI.java b/core/src/mindustry/ai/types/FormationAI.java index 3ee744da56..b2096ac315 100644 --- a/core/src/mindustry/ai/types/FormationAI.java +++ b/core/src/mindustry/ai/types/FormationAI.java @@ -35,7 +35,7 @@ public class FormationAI extends AIController implements FormationMember{ } } - unit.moveAt(vec.set(target).sub(unit).limit2(unit.type().speed)); + unit.moveAt(vec.set(target).sub(unit).limit(unit.type().speed)); } @Override diff --git a/core/src/mindustry/content/Weathers.java b/core/src/mindustry/content/Weathers.java index f5d6fedee5..d0b2a137d8 100644 --- a/core/src/mindustry/content/Weathers.java +++ b/core/src/mindustry/content/Weathers.java @@ -62,7 +62,7 @@ public class Weathers implements ContentList{ }; rain = new Weather("rain"){ - float yspeed = 7f, xspeed = 2f, padding = 16f, size = 40f, density = 1000f; + float yspeed = 7f, xspeed = 2f, padding = 16f, size = 40f, density = 1200f; TextureRegion[] splashes = new TextureRegion[12]; @Override diff --git a/core/src/mindustry/entities/def/CommanderComp.java b/core/src/mindustry/entities/def/CommanderComp.java index 60e65980ce..2fa10cad4c 100644 --- a/core/src/mindustry/entities/def/CommanderComp.java +++ b/core/src/mindustry/entities/def/CommanderComp.java @@ -2,7 +2,6 @@ package mindustry.entities.def; import arc.struct.*; import arc.util.ArcAnnotate.*; -import arc.util.*; import mindustry.ai.formations.*; import mindustry.ai.types.*; import mindustry.annotations.Annotations.*; @@ -57,9 +56,6 @@ abstract class CommanderComp implements Unitc{ members.add((FormationAI)u.controller()); } - Log.info(members); - Log.info(members.size); - //TODO doesn't handle units that don't fit a formation formation.addMembers(members); diff --git a/core/src/mindustry/game/GlobalData.java b/core/src/mindustry/game/GlobalData.java index 88dc3ee0b4..eebccf8e65 100644 --- a/core/src/mindustry/game/GlobalData.java +++ b/core/src/mindustry/game/GlobalData.java @@ -1,6 +1,7 @@ package mindustry.game; import arc.*; +import arc.math.*; import arc.struct.*; import arc.files.*; import arc.util.ArcAnnotate.*; @@ -98,8 +99,10 @@ public class GlobalData{ items.getAndIncrement(item, 0, amount); state.stats.itemsDelivered.getAndIncrement(item, 0, amount); + //clamp to capacity + items.put(item, Mathf.clamp(items.get(item), 0, getItemCapacity())); + //clamp overflow - if(items.get(item, 0) < 0) items.put(item, Integer.MAX_VALUE); if(state.stats.itemsDelivered.get(item, 0) < 0) state.stats.itemsDelivered.put(item, Integer.MAX_VALUE); } @@ -139,6 +142,11 @@ public class GlobalData{ return items; } + //TODO: make it upgradeable + public int getItemCapacity(){ + return 10000; + } + /** Returns whether or not this piece of content is unlocked yet. */ public boolean isUnlocked(UnlockableContent content){ return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.name); diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index cfb470e8c3..b4714d9f21 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -132,30 +132,32 @@ public class DesktopInput extends InputHandler{ drawOverRequest(request); } - //draw things that may be placed soon - if(mode == placing && block != null){ - for(int i = 0; i < lineRequests.size; i++){ - BuildRequest req = lineRequests.get(i); - if(i == lineRequests.size - 1 && req.block.rotate){ - drawArrow(block, req.x, req.y, req.rotation); + if(player.isBuilder()){ + //draw things that may be placed soon + if(mode == placing && block != null){ + for(int i = 0; i < lineRequests.size; i++){ + BuildRequest req = lineRequests.get(i); + if(i == lineRequests.size - 1 && req.block.rotate){ + drawArrow(block, req.x, req.y, req.rotation); + } + drawRequest(lineRequests.get(i)); } - drawRequest(lineRequests.get(i)); - } - }else if(isPlacing()){ - if(block.rotate){ - drawArrow(block, cursorX, cursorY, rotation); - } - Draw.color(); - drawRequest(cursorX, cursorY, block, rotation); - block.drawPlace(cursorX, cursorY, rotation, validPlace(cursorX, cursorY, block, rotation)); + }else if(isPlacing()){ + if(block.rotate){ + drawArrow(block, cursorX, cursorY, rotation); + } + Draw.color(); + drawRequest(cursorX, cursorY, block, rotation); + block.drawPlace(cursorX, cursorY, rotation, validPlace(cursorX, cursorY, block, rotation)); - if(block.saveConfig && block.lastConfig != null){ - brequest.set(cursorX, cursorY, rotation, block); - brequest.config = block.lastConfig; + if(block.saveConfig && block.lastConfig != null){ + brequest.set(cursorX, cursorY, rotation, block); + brequest.config = block.lastConfig; + + block.drawRequestConfig(brequest, allRequests()); + } - block.drawRequestConfig(brequest, allRequests()); } - } Draw.reset(); @@ -254,7 +256,7 @@ public class DesktopInput extends InputHandler{ isShooting = false; } - if(isPlacing()){ + if(isPlacing() && player.isBuilder()){ cursorType = SystemCursor.hand; selectScale = Mathf.lerpDelta(selectScale, 1f, 0.2f); }else{ @@ -463,7 +465,7 @@ public class DesktopInput extends InputHandler{ }else if(Core.input.keyTap(Binding.deselect) && !selectRequests.isEmpty()){ selectRequests.clear(); lastSchematic = null; - }else if(Core.input.keyTap(Binding.break_block) && !Core.scene.hasMouse()){ + }else if(Core.input.keyTap(Binding.break_block) && !Core.scene.hasMouse() && player.isBuilder()){ //is recalculated because setting the mode to breaking removes potential multiblock cursor offset deleting = false; mode = breaking; diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 907b691496..55d352e2c6 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -80,7 +80,7 @@ public class PlanetDialog extends FloatingDialog{ float bmargin = 6f; //TODO names - buttons.button("$back", Icon.left, style, this::hide).margin(bmargin); + //buttons.button("$back", Icon.left, style, this::hide).margin(bmargin); //buttons.addImageTextButton("Tech", Icon.tree, style, () -> ui.tech.show()).margin(bmargin); //buttons.addImageTextButton("Launch", Icon.upOpen, style, this::hide).margin(bmargin); //buttons.addImageTextButton("Database", Icon.book, style, () -> ui.database.show()).margin(bmargin); diff --git a/gradle.properties b/gradle.properties index bd4bb38d4f..be3e01ffcd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=ef4e114c648101c2d49ab98c1801737450f2a93a +archash=cb632c0f88ced85999a3b78e6b79e3056e1d15e1