Workshop fixes / Message block extension

This commit is contained in:
Anuken
2019-09-25 15:40:31 -04:00
parent 29bf181a08
commit 2658c1f52e
6 changed files with 23 additions and 5 deletions

View File

@@ -34,6 +34,9 @@ public interface Platform{
/** Steam: View a map listing on the workshop.*/
default void viewMapListing(Map map){}
/** Steam: View a map listing on the workshop.*/
default void viewMapListing(String mapid){}
/** Steam: Open workshop for maps.*/
default void openWorkshop(){}

View File

@@ -16,7 +16,7 @@ import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.blocks.BlockPart;
import static io.anuke.mindustry.Vars.world;
import static io.anuke.mindustry.Vars.*;
public class MapEditor{
public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15, 20};
@@ -52,6 +52,9 @@ public class MapEditor{
loading = true;
tags.putAll(map.tags);
if(map.file.parent().parent().name().equals("1127400") && steam){
tags.put("steamid", map.file.parent().name());
}
MapIO.loadMap(map, context);
checkLinkedTiles();
renderer.resize(width(), height());

View File

@@ -147,6 +147,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(steam){
menu.cont.addImageTextButton("$editor.publish.workshop", Icon.linkSmall, () -> {
if(editor.getTags().containsKey("steamid")){
platform.viewMapListing(editor.getTags().get("steamid"));
return;
}
Map map = save();
if(map == null) return;

View File

@@ -106,7 +106,9 @@ public class Maps{
//workshop
for(FileHandle file : platform.getExternalMaps()){
try{
loadMap(file, false).workshop = true;
Map map = loadMap(file, false);
map.workshop = true;
map.tags.put("steamid", file.parent().name());
}catch(Exception e){
Log.err("Failed to load workshop map file '{0}'!", file);
Log.err(e);

View File

@@ -24,8 +24,8 @@ import java.io.*;
import static io.anuke.mindustry.Vars.*;
public class MessageBlock extends Block{
protected static int maxTextLength = 170;
protected static int maxNewlines = 5;
protected static int maxTextLength = 220;
protected static int maxNewlines = 24;
public MessageBlock(String name){
super(name);