Workshop fixes / Message block extension
This commit is contained in:
@@ -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(){}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user