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.*/
|
/** Steam: View a map listing on the workshop.*/
|
||||||
default void viewMapListing(Map map){}
|
default void viewMapListing(Map map){}
|
||||||
|
|
||||||
|
/** Steam: View a map listing on the workshop.*/
|
||||||
|
default void viewMapListing(String mapid){}
|
||||||
|
|
||||||
/** Steam: Open workshop for maps.*/
|
/** Steam: Open workshop for maps.*/
|
||||||
default void openWorkshop(){}
|
default void openWorkshop(){}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import io.anuke.mindustry.maps.Map;
|
|||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.blocks.BlockPart;
|
import io.anuke.mindustry.world.blocks.BlockPart;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class MapEditor{
|
public class MapEditor{
|
||||||
public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15, 20};
|
public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15, 20};
|
||||||
@@ -52,6 +52,9 @@ public class MapEditor{
|
|||||||
|
|
||||||
loading = true;
|
loading = true;
|
||||||
tags.putAll(map.tags);
|
tags.putAll(map.tags);
|
||||||
|
if(map.file.parent().parent().name().equals("1127400") && steam){
|
||||||
|
tags.put("steamid", map.file.parent().name());
|
||||||
|
}
|
||||||
MapIO.loadMap(map, context);
|
MapIO.loadMap(map, context);
|
||||||
checkLinkedTiles();
|
checkLinkedTiles();
|
||||||
renderer.resize(width(), height());
|
renderer.resize(width(), height());
|
||||||
|
|||||||
@@ -147,6 +147,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
if(steam){
|
if(steam){
|
||||||
menu.cont.addImageTextButton("$editor.publish.workshop", Icon.linkSmall, () -> {
|
menu.cont.addImageTextButton("$editor.publish.workshop", Icon.linkSmall, () -> {
|
||||||
|
if(editor.getTags().containsKey("steamid")){
|
||||||
|
platform.viewMapListing(editor.getTags().get("steamid"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map map = save();
|
Map map = save();
|
||||||
|
|
||||||
if(map == null) return;
|
if(map == null) return;
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ public class Maps{
|
|||||||
//workshop
|
//workshop
|
||||||
for(FileHandle file : platform.getExternalMaps()){
|
for(FileHandle file : platform.getExternalMaps()){
|
||||||
try{
|
try{
|
||||||
loadMap(file, false).workshop = true;
|
Map map = loadMap(file, false);
|
||||||
|
map.workshop = true;
|
||||||
|
map.tags.put("steamid", file.parent().name());
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Log.err("Failed to load workshop map file '{0}'!", file);
|
Log.err("Failed to load workshop map file '{0}'!", file);
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class MessageBlock extends Block{
|
public class MessageBlock extends Block{
|
||||||
protected static int maxTextLength = 170;
|
protected static int maxTextLength = 220;
|
||||||
protected static int maxNewlines = 5;
|
protected static int maxNewlines = 24;
|
||||||
|
|
||||||
public MessageBlock(String name){
|
public MessageBlock(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -204,7 +204,12 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void viewMapListing(Map map){
|
public void viewMapListing(Map map){
|
||||||
SVars.net.friends.activateGameOverlayToWebPage("steam://url/CommunityFilePage/" + map.file.parent().name());
|
viewMapListing(map.file.parent().name());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void viewMapListing(String mapid){
|
||||||
|
SVars.net.friends.activateGameOverlayToWebPage("steam://url/CommunityFilePage/" + mapid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user