Jump to content

Creating new shard from in game


Recommended Posts

Well im trying to create option for new shard in game. similar to curret "caves" option. I gave managed to get add new tab and everything working except if I run the game it simply won't start the shard for it. save game data doesn't appear but I will not get any errors. it's as if the option was never selected.

Can somebody see if they can find any info why the server won't start and load the shard as it does with caves. heres my modmain.lua theres currently nothing else. 

local STRINGS = GLOBAL.STRINGS
local require = GLOBAL.require
local Level = require("map/level")
local _G = GLOBAL

local function FileExists(filename)
	filename = 'scripts/' .. filename .. '.lua'
	local f = _G.io.open(filename, "r")
	if f then
		f:close()
		return true
	end
end
STRINGS.UI.SANDBOXMENU.LOCATIONTABNAME.RUIN = 'Ruins'
STRINGS.UI.SANDBOXMENU.LOCATION.RUIN = 'Ruins'
STRINGS.TAGS.LOCATION.RUIN = "Ruins"
STRINGS.MAPRECORDER.LOCATION.RUIN = " in the ruins"
local TAB = "screens/servercreationscreen"
if FileExists(TAB) then
	local ServerCreationScreen = require(TAB)
	local old_MakeWorldTab = ServerCreationScreen.MakeWorldTab
	if old_MakeWorldTab then
		function ServerCreationScreen:MakeWorldTab()
            GLOBAL.SERVER_LEVEL_LOCATIONS[3] = "ruin"
            _G.AddLevel(LEVELTYPE.SURVIVAL, {
        id="DST_RUINS",
        name='Ruins',
        desc= STRINGS.UI.CUSTOMIZATIONSCREEN.PRESETLEVELDESC.DST_CAVE,
        location = "ruin",
        version = 3,

        overrides={
        },
        background_node_range = {0,1},
    })
_G.AddLocation({
    location = "ruin",
    version = 2,
    overrides={
        task_set = "cave_default",
        start_location = "ruins",
        season_start = "default",
        world_size = "default",
        layout_mode = "RestrictNodesByKey",
        wormhole_prefab = "tentacle_pillar",
        roads = "never",
    },
    required_prefabs = {
        "multiplayer_portal",
    },
})
_G.AddStartLocation("ruins", {
    name = STRINGS.UI.SANDBOXMENU.CAVESTART,
    location = "ruin",
    start_setpeice = "CaveStart",	
    start_node = {
        "RabbitArea",
        "RabbitTown",
        "RabbitSinkhole",
        "SpiderIncursion",
        "SinkholeForest",
        "SinkholeCopses",
        "SinkholeOasis",
        "GrasslandSinkhole",
        "GreenMushSinkhole",
        "GreenMushRabbits",
    },
})
            old_MakeWorldTab(self)
        end
	end
end

 

Edited by Ricoom
Link to comment
Share on other sites

@Ipsquiggle  Any help.. I have been trying to find issue but All I can find is that it must be hardcoded into the part of the game TheSystemService:StartDedicatedServers won't accept additional worldgen variable as a valid option and ignores it entirely. Can you elaborate on that. If that is case is there any workarounds you can suggest besides creating dedicated servers manually. There are several places that look like that it has been kinda hardcoded in the fact there should be always worlds 1 and 2 won't even check if there are more.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...