Implemented sandbox mode
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 532 B |
Binary file not shown.
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 231 B |
@@ -370,6 +370,7 @@ mode.waves.name=waves
|
|||||||
mode.waves.description=the normal mode. limited resources and automatic incoming waves.
|
mode.waves.description=the normal mode. limited resources and automatic incoming waves.
|
||||||
mode.sandbox.name=sandbox
|
mode.sandbox.name=sandbox
|
||||||
mode.sandbox.description=infinite resources and no timer for waves.
|
mode.sandbox.description=infinite resources and no timer for waves.
|
||||||
|
mode.sandbox.warning=Note that blocks cannot be used in sandbox mode until they are unlocked in other modes.\n\n[LIGHT_GRAY]If you have not unlocked any blocks, none will appear.
|
||||||
mode.freebuild.name=freebuild
|
mode.freebuild.name=freebuild
|
||||||
mode.freebuild.description=limited resources and no timer for waves.
|
mode.freebuild.description=limited resources and no timer for waves.
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
@@ -13,6 +13,7 @@ import io.anuke.mindustry.entities.TileEntity;
|
|||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.ContentDatabase;
|
import io.anuke.mindustry.game.ContentDatabase;
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
|
import io.anuke.mindustry.game.GameMode;
|
||||||
import io.anuke.mindustry.game.Saves;
|
import io.anuke.mindustry.game.Saves;
|
||||||
import io.anuke.mindustry.input.DefaultKeybinds;
|
import io.anuke.mindustry.input.DefaultKeybinds;
|
||||||
import io.anuke.mindustry.input.DesktopInput;
|
import io.anuke.mindustry.input.DesktopInput;
|
||||||
@@ -109,6 +110,12 @@ public class Control extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
|
|
||||||
|
if(state.mode == GameMode.sandbox && !Settings.getBool("sandbox-warning", false)){
|
||||||
|
threads.runGraphics(() -> ui.showInfo("$mode.sandbox.warning"));
|
||||||
|
Settings.putBool("sandbox-warning", true);
|
||||||
|
Settings.save();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(WorldLoadGraphicsEvent.class, () -> {
|
Events.on(WorldLoadGraphicsEvent.class, () -> {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class Logic extends Module{
|
|||||||
tile.entity.items.set(item, 1000);
|
tile.entity.items.set(item, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else if(!state.mode.infiniteResources){
|
||||||
tile.entity.items.add(Items.tungsten, 50);
|
tile.entity.items.add(Items.tungsten, 50);
|
||||||
tile.entity.items.add(Items.lead, 20);
|
tile.entity.items.add(Items.lead, 20);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,12 +227,14 @@ public class BlocksFragment extends Fragment{
|
|||||||
|
|
||||||
if(entity == null) return;
|
if(entity == null) return;
|
||||||
|
|
||||||
|
if(!state.mode.infiniteResources){
|
||||||
for(ItemStack s : r.requirements){
|
for(ItemStack s : r.requirements){
|
||||||
if(!entity.items.has(s.item, Mathf.ceil(s.amount))){
|
if(!entity.items.has(s.item, Mathf.ceil(s.amount))){
|
||||||
istack.setColor(Color.GRAY);
|
istack.setColor(Color.GRAY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
istack.setColor(Color.WHITE);
|
istack.setColor(Color.WHITE);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -310,7 +312,7 @@ public class BlocksFragment extends Fragment{
|
|||||||
requirements.addImage(stack.item.region).size(8 * 3);
|
requirements.addImage(stack.item.region).size(8 * 3);
|
||||||
Label reqlabel = new Label(() -> {
|
Label reqlabel = new Label(() -> {
|
||||||
TileEntity core = players[0].getClosestCore();
|
TileEntity core = players[0].getClosestCore();
|
||||||
if(core == null) return "*/*";
|
if(core == null || state.mode.infiniteResources) return "*/*";
|
||||||
|
|
||||||
int amount = core.items.get(stack.item);
|
int amount = core.items.get(stack.item);
|
||||||
String color = (amount < stack.amount / 2f ? "[red]" : amount < stack.amount ? "[orange]" : "[white]");
|
String color = (amount < stack.amount / 2f ? "[red]" : amount < stack.amount ? "[orange]" : "[white]");
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ public class BuildBlock extends Block{
|
|||||||
builderID = builder.getID();
|
builderID = builder.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(progress >= 1f || debug){
|
if(progress >= 1f || debug || state.mode.infiniteResources){
|
||||||
Call.onConstructFinish(tile, recipe.result, builderID, tile.getRotation(), builder.getTeam());
|
Call.onConstructFinish(tile, recipe.result, builderID, tile.getRotation(), builder.getTeam());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ public class BuildBlock extends Block{
|
|||||||
|
|
||||||
progress = Mathf.clamp(progress - amount);
|
progress = Mathf.clamp(progress - amount);
|
||||||
|
|
||||||
if(progress <= 0 || debug){
|
if(progress <= 0 || debug || state.mode.infiniteResources){
|
||||||
Call.onDeconstructFinish(tile, this.recipe == null ? previous : this.recipe.result);
|
Call.onDeconstructFinish(tile, this.recipe == null ? previous : this.recipe.result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user