mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 07:07:03 +07:00
Bugfixes / Cleanup
This commit is contained in:
parent
8e50228df2
commit
43642ff546
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=ef4e114c648101c2d49ab98c1801737450f2a93a
|
||||
archash=cb632c0f88ced85999a3b78e6b79e3056e1d15e1
|
||||
|
Loading…
Reference in New Issue
Block a user