Skip to content

Commit

Permalink
Update for new cave configure.
Browse files Browse the repository at this point in the history
  • Loading branch information
KKyang committed Dec 17, 2015
1 parent b005cca commit 9994286
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 82 deletions.
57 changes: 53 additions & 4 deletions ioworldgenoverridelua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,45 @@ bool IOWorldGenOverrideLua::readLuaFile(std::vector<properties> &PV, std::vector
QString msg;
msg = file.readLine();
msg = msg.trimmed();
if(msg.indexOf("override_enabled = true,") > -1)
if(msg.indexOf("preset = ") > -1)
{
while(!file.atEnd())
if(msg.contains("preset = "))
{
properties P;
P.group = "Overall";
P.name = "preset";
P.settings = msg.split("--")[0].split('=')[1].replace(" ","").replace('"',"").replace(',',"");
PV.push_back(P);

std::vector<QString> select;
if(msg.indexOf(QString("-- ")) > 0)
{
msg = msg.split("-- ")[msg.split("-- ").size() - 1];
#ifdef QT_DEBUG
qDebug() << msg;
#endif
msg = msg.split(":")[msg.split(":").size() - 1];
#ifdef QT_DEBUG
qDebug() << msg;
#endif
QStringList inGroupData = msg.split(",");
for(int i = 0; i < inGroupData.size(); i++)
{
select.push_back(inGroupData[i].replace(" ","").replace('"',""));
}
}
else
{
select.push_back("never");
select.push_back("rare");
select.push_back("default");
select.push_back("often");
select.push_back("always");
}
IV.push_back(select);
}
while(!file.atEnd())
{
QString data = file.readLine().trimmed();
QString segment = data.split("--")[0];
if(segment.indexOf('{') > -1)
Expand Down Expand Up @@ -117,9 +152,23 @@ bool IOWorldGenOverrideLua::writeLuaFile(std::vector<properties> &PV, std::vecto

stream << "return{\n\n";
stream << " override_enabled = true,\n";
properties &pp = PV[0];
std::vector<QString> &sss = IV[0];
stream << " preset = " << pp.settings << ", -- ";
QString show;
for(int j = 0; j < sss.size(); j++)
{
show = show + QString('"') + sss[j] + QString('"');
if(j == sss.size() - 1)
{
break;
}
show = show + QString(", ");
}
stream << show << "\n";

QString last_group_name;
for(int i = 0; i < PV.size(); i++)
for(int i = 1; i < PV.size(); i++)
{
properties &p = PV[i];
std::vector<QString> &ss = IV[i];
Expand All @@ -132,7 +181,7 @@ bool IOWorldGenOverrideLua::writeLuaFile(std::vector<properties> &PV, std::vecto
if(p.group.compare("misc"))
{
stream << " " << p.group << " = { -- ";
QString show;
show.clear();
for(int j = 0; j < ss.size(); j++)
{
show = show + QString('"') + ss[j] + QString('"');
Expand Down
173 changes: 95 additions & 78 deletions template/worldgenoverride_world.lua
Original file line number Diff line number Diff line change
@@ -1,80 +1,97 @@
return {

override_enabled = true,
unprepared = { -- "never", "rare", "default", "often", "always"
berrybush = "default",
cactus = "default",
carrot = "default",
mushroom = "default",
},
misc = {
task_set = "default", -- Biomes: "default", "classic", "cave_default"
start_location = "default", -- Start: "default", "plus", "darkness", "caves"
autumn = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
boons = "default", -- "never", "rare", "default", "often", "always"
branching = "default", -- "never", "least", "default", "most"
day = "default", -- "default", "longday", "longdusk", "longnight", "noday", "nodusk", "nonight", "onlyday", "onlydusk", "onlynight"
frograin = "default", -- "never", "rare", "default", "often", "always"
lightning = "default", -- "never", "rare", "default", "often", "always"
loop = "default", -- "never", "default", "always"
season_start = "default", -- "default", "winter", "spring", "summer", "random"
spring = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
summer = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
touchstone = "default", -- "never", "rare", "default", "often", "always"
weather = "default", -- "never", "rare", "default", "often", "always"
wildfires = "default", -- "never", "rare", "default", "often", "always"
winter = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
world_size = "default", -- "default", "medium", "large", "huge"
},
animals = { -- "never", "rare", "default", "often", "always"
alternatehunt = "default",
angrybees = "default",
beefalo = "default",
beefaloheat = "default",
bees = "default",
birds = "default",
butterfly = "default",
buzzard = "default",
catcoon = "default",
frogs = "default",
hunt = "default",
lightninggoat = "default",
moles = "default",
penguins = "default",
perd = "default",
pigs = "default",
rabbits = "default",
tallbirds = "default",
},
monsters = { -- "never", "rare", "default", "often", "always"
bearger = "default",
chess = "default",
deciduousmonster = "default",
deerclops = "default",
dragonfly = "default",
goosemoose = "default",
houndmound = "default",
hounds = "default",
krampus = "default",
liefs = "default",
lureplants = "default",
merm = "default",
spiders = "default",
tentacles = "default",
walrus = "default",
},
resources = { -- "never", "rare", "default", "often", "always"
flint = "default",
flowers = "default",
grass = "default",
marshbush = "default",
meteorshowers = "default",
meteorspawner = "default",
reeds = "default",
rock = "default",
rock_ice = "default",
sapling = "default",
trees = "default",
tumbleweed = "default",
},
override_enabled = true,
preset = SURVIVAL_TOGETHER, -- "SURVIVAL_TOGETHER", "SURVIVAL_TOGETHER_CLASSIC", "SURVIVAL_DEFAULT_PLUS", "COMPLETE_DARKNESS", "DST_CAVE"
unprepared = { -- "never", "rare", "default", "often", "always"
banana = "default",
berrybush = "default",
cactus = "default",
carrot = "default",
lichen = "default",
mushroom = "default",
},
misc = {
autumn = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
boons = "default", -- "never", "rare", "default", "often", "always"
branching = "default", -- "never", "least", "default", "most"
cavelight = "default", -- "veryslow", "slow", "default", "fast", "veryfast"
day = "default", -- "default", "longday", "longdusk", "longnight", "noday", "nodusk", "nonight", "onlyday", "onlydusk", "onlynight"
earthquakes = "default", -- "never", "rare", "default", "often", "always"
frograin = "default", -- "never", "rare", "default", "often", "always"
lightning = "default", -- "never", "rare", "default", "often", "always"
loop = "default", -- "never", "default", "always"
regrowth = "default", -- "veryslow", "slow", "default", "fast", "veryfast"
season_start = "default", -- "default", "winter", "spring", "summer", "autumnorspring", "winterorsummer", "random"
spring = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
start_location = "default", -- "caves", "default", "plus", "darkness"
summer = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
task_set = "default", -- "classic", "default", "cave_default"
touchstone = "default", -- "never", "rare", "default", "often", "always"
weather = "default", -- "never", "rare", "default", "often", "always"
wildfires = "default", -- "never", "rare", "default", "often", "always"
winter = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
world_size = "default", -- "small", "medium", "default", "huge"
},
animals = { -- "never", "rare", "default", "often", "always"
alternatehunt = "default",
angrybees = "default",
beefalo = "default",
beefaloheat = "default",
bees = "default",
birds = "default",
bunnymen = "default",
butterfly = "default",
buzzard = "default",
catcoon = "default",
frogs = "default",
hunt = "default",
lightninggoat = "default",
moles = "default",
monkey = "default",
penguins = "default",
perd = "default",
pigs = "default",
rabbits = "default",
rocky = "default",
slurper = "default",
slurtles = "default",
tallbirds = "default",
},
monsters = { -- "never", "rare", "default", "often", "always"
bats = "default",
bearger = "default",
chess = "default",
deciduousmonster = "default",
deerclops = "default",
dragonfly = "default",
fissure = "default",
goosemoose = "default",
houndmound = "default",
hounds = "default",
krampus = "default",
liefs = "default",
lureplants = "default",
merm = "default",
spiders = "default",
tentacles = "default",
walrus = "default",
worms = "default",
},
resources = { -- "never", "rare", "default", "often", "always"
fern = "default",
flint = "default",
flower_cave = "default",
flowers = "default",
grass = "default",
marshbush = "default",
meteorshowers = "default",
meteorspawner = "default",
mushtree = "default",
reeds = "default",
rock = "default",
rock_ice = "default",
sapling = "default",
trees = "default",
tumbleweed = "default",
wormlights = "default",
},
}

0 comments on commit 9994286

Please sign in to comment.