- Added Blue, Red, Green Mushtree to natural regrowth

- Added light flowers (1x,2x,3x) to event regrowth
- Changed Stalagmite's interval from 1 day to 0.5 days
- Refactored config table
This commit is contained in:
secXsQuared 2018-01-29 05:33:28 -05:00
parent 90b2ead675
commit 43b41d8883
4 changed files with 177 additions and 123 deletions

View File

@ -1,5 +1,5 @@
name = "World Regrowth++"
version = "0.1.3"
version = "0.1.4"
description = "Version "..version.."\n\nAdvanced world regrowth including caves! See the Steam Workshop page for more information.\n\nHappy hunting and do starve!"
author = "lolo"
@ -14,69 +14,83 @@ all_clients_require_mod = false
client_only_mod = false
dst_compatible = true
local REGROWTH_TYPE =
{
NATURAL = 1,
EVENT = 2
}
-- Configuration Generation
-- I can't reference this from another file... duplicate
local config_table =
{
{"evergreen","Evergreen","Natural"},
{"deciduoustree","Birchnut Tree","Natural"},
{"marsh_tree","Spiky Tree","Natural"},
{"twiggytree","Twiggy Tree","Natural"},
{"marbletree","Marble Tree","Event-based"},
{"livingtree","Totally Normal Tree","Event-based"},
{"evergreen","Evergreen", REGROWTH_TYPE.NATURAL, 251},
{"deciduoustree","Birchnut Tree",REGROWTH_TYPE.NATURAL, 251},
{"marsh_tree","Spiky Tree",REGROWTH_TYPE.NATURAL, 480},
{"twiggytree","Twiggy Tree",REGROWTH_TYPE.NATURAL, 491},
{"marbletree","Marble Tree",REGROWTH_TYPE.EVENT, 960},
{"livingtree","Totally Normal Tree",REGROWTH_TYPE.EVENT, 969},
{"mushtree_tall","Blue Mushtree", REGROWTH_TYPE.NATURAL, 251},
{"mushtree_medium","Red Mushtree",REGROWTH_TYPE.NATURAL, 229},
{"mushtree_small","Green Mushtree", REGROWTH_TYPE.NATURAL, 240},
{"berrybush","Berry Bush","Natural"},
{"berrybush2","Spiky Berry Bush","Natural"},
{"berrybush_juicy","Juicy Berry Bush","Natural"},
{"berrybush","Berry Bush",REGROWTH_TYPE.NATURAL, 1451},
{"berrybush2","Spiky Berry Bush",REGROWTH_TYPE.NATURAL, 1429},
{"berrybush_juicy","Juicy Berry Bush",REGROWTH_TYPE.NATURAL, 1429},
{"carrot_planted","Carrot","Natural"},
{"flower","Flower","Natural"},
{"flower_evil","Evil Flower","Event-based"},
{"blue_mushroom","Blue Mushroom","Natural"},
{"red_mushroom","Red Mushroom","Natural"},
{"green_mushroom","Green Mushroom","Natural"},
{"cactus","Cactus","Natural"},
{"mandrake","Mandrake","Event-based"},
{"carrot_planted","Carrot",REGROWTH_TYPE.NATURAL, 240},
{"flower","Flower",REGROWTH_TYPE.NATURAL, 229},
{"flower_evil","Evil Flower",REGROWTH_TYPE.EVENT, 480},
{"flower_cave","Light Flower",REGROWTH_TYPE.EVENT, 480},
{"flower_cave_double","Double Light Flower",REGROWTH_TYPE.EVENT, 489},
{"flower_cave_triple","Triple Light Flower",REGROWTH_TYPE.EVENT, 471},
{"blue_mushroom","Blue Mushroom",REGROWTH_TYPE.NATURAL, 249},
{"red_mushroom","Red Mushroom",REGROWTH_TYPE.NATURAL, 240},
{"green_mushroom","Green Mushroom",REGROWTH_TYPE.NATURAL, 240},
{"cactus","Cactus",REGROWTH_TYPE.NATURAL, 479},
{"mandrake","Mandrake",REGROWTH_TYPE.EVENT, 969},
{"reeds","Reeds","Natural"},
{"sapling","Sapling","Natural"},
{"grass","Grass","Natural"},
{"marsh_bush","Spiky Bush","Natural"},
{"reeds","Reeds",REGROWTH_TYPE.NATURAL, 480},
{"sapling","Sapling",REGROWTH_TYPE.NATURAL, 240},
{"grass","Grass",REGROWTH_TYPE.NATURAL, 229},
{"marsh_bush","Spiky Bush",REGROWTH_TYPE.NATURAL, 480},
{"rock1","Boulder","Natural"},
{"rock2","Gold Vein","Natural"},
{"rock_flintless","Flintless Boulder","Natural"},
{"rock_moon","Moon Rock","Natural"},
{"rock1","Boulder",REGROWTH_TYPE.NATURAL, 229},
{"rock2","Gold Vein",REGROWTH_TYPE.NATURAL, 240},
{"rock_flintless","Flintless Boulder",REGROWTH_TYPE.NATURAL, 251},
{"rock_moon","Moon Rock",REGROWTH_TYPE.NATURAL, 480},
{"stalagmite","Stalagmite","Natural"},
{"stalagmite_tall","Tall Stalagmite","Natural"},
{"stalagmite","Stalagmite",REGROWTH_TYPE.NATURAL, 229},
{"stalagmite_tall","Tall Stalagmite",REGROWTH_TYPE.NATURAL, 240},
{"beehive","Beehive","Event-based"},
{"wasphive","Killer Bee Hive","Event-based"},
{"houndmound","Hound Mound","Event-based"},
{"pighouse","Pig House","Event-based"},
{"mermhouse","Rundown House","Event-based"},
{"spiderden","Spider Den","Event-based"},
{"catcoonden","Hollow Stump","Event-based"},
{"rabbithouse","Rabbit Hutch","Event-based"},
{"monkeypods","Splumonkey Pod","Event-based"},
{"slurtlehole", "Slurtle Mound", "Event-based"},
{"tallbirdnest", "Tallbird Nest", "Event-based"},
{"beehive","Beehive",REGROWTH_TYPE.EVENT, 489},
{"wasphive","Killer Bee Hive",REGROWTH_TYPE.EVENT, 969},
{"houndmound","Hound Mound",REGROWTH_TYPE.EVENT, 1449},
{"pighouse","Pig House",REGROWTH_TYPE.EVENT, 960},
{"mermhouse","Rundown House",REGROWTH_TYPE.EVENT, 1429},
{"spiderden","Spider Den",REGROWTH_TYPE.EVENT, 1431},
{"catcoonden","Hollow Stump",REGROWTH_TYPE.EVENT, 951},
{"rabbithouse","Rabbit Hutch",REGROWTH_TYPE.EVENT, 951},
{"monkeypods","Splumonkey Pod",REGROWTH_TYPE.EVENT, 951},
{"slurtlehole", "Slurtle Mound", REGROWTH_TYPE.EVENT, 951},
{"tallbirdnest", "Tallbird Nest", REGROWTH_TYPE.EVENT, 960},
{"fireflies","Fireflies","Event-based"},
{"tentacle","Tentacle","Event-based"},
{"knight","Clockwork Knight","Event-based"},
{"bishop","Clockwork Bishop","Event-based"},
{"rook","Clockwork Rook","Event-based"},
{"knight_nightmare","Damaged Knight","Event-based"},
{"bishop_nightmare","Damaged Bishop","Event-based"},
{"rook_nightmare","Damaged Rook","Event-based"},
{"fireflies","Fireflies",REGROWTH_TYPE.EVENT, 471},
{"tentacle","Tentacle",REGROWTH_TYPE.EVENT, 489},
{"knight","Clockwork Knight",REGROWTH_TYPE.EVENT, 1440},
{"bishop","Clockwork Bishop",REGROWTH_TYPE.EVENT, 1431},
{"rook","Clockwork Rook",REGROWTH_TYPE.EVENT, 1449},
{"knight_nightmare","Damaged Knight",REGROWTH_TYPE.EVENT, 1449},
{"bishop_nightmare","Damaged Bishop",REGROWTH_TYPE.EVENT, 1440},
{"rook_nightmare","Damaged Rook",REGROWTH_TYPE.EVENT, 1440},
{"ruins_statue_mage","Ancient Mage Statue","Event-based"},
{"ruins_statue_mage_nogem","Gemless Ancient Mage Statue","Event-based"},
{"ruins_statue_head","Ancient Head Statue","Event-based"},
{"ruins_statue_head_nogem", "Gemless Ancient Head Statue", "Event-based"}
{"ruins_statue_mage","Ancient Mage Statue",REGROWTH_TYPE.EVENT, 969},
{"ruins_statue_mage_nogem","Gemless Ancient Mage Statue",REGROWTH_TYPE.EVENT, 969},
{"ruins_statue_head","Ancient Head Statue",REGROWTH_TYPE.EVENT, 960},
{"ruins_statue_head_nogem", "Gemless Ancient Head Statue", REGROWTH_TYPE.EVENT, 951}
}
local config_options = {}
for i = 1, #config_table do
@ -84,7 +98,7 @@ for i = 1, #config_table do
{
name = config_table[i][1],
label = config_table[i][2],
hover = config_table[i][3],
hover = config_table[i][3] == REGROWTH_TYPE.EVENT and "Event-based" or "Natural",
options =
{
{

View File

@ -1,3 +1,81 @@
local REGROWTH_TYPE =
{
NATURAL = 1,
EVENT = 2
}
local DEBUG = false
-- Configuration Generation
-- I can't reference this from another file... duplicate
local config_table =
{
{"evergreen","Evergreen", REGROWTH_TYPE.NATURAL, 251},
{"deciduoustree","Birchnut Tree",REGROWTH_TYPE.NATURAL, 251},
{"marsh_tree","Spiky Tree",REGROWTH_TYPE.NATURAL, 480},
{"twiggytree","Twiggy Tree",REGROWTH_TYPE.NATURAL, 491},
{"marbletree","Marble Tree",REGROWTH_TYPE.EVENT, 960},
{"livingtree","Totally Normal Tree",REGROWTH_TYPE.EVENT, 969},
{"mushtree_tall","Blue Mushtree", REGROWTH_TYPE.NATURAL, 251},
{"mushtree_medium","Red Mushtree",REGROWTH_TYPE.NATURAL, 229},
{"mushtree_small","Green Mushtree", REGROWTH_TYPE.NATURAL, 240},
{"berrybush","Berry Bush",REGROWTH_TYPE.NATURAL, 1451},
{"berrybush2","Spiky Berry Bush",REGROWTH_TYPE.NATURAL, 1429},
{"berrybush_juicy","Juicy Berry Bush",REGROWTH_TYPE.NATURAL, 1429},
{"carrot_planted","Carrot",REGROWTH_TYPE.NATURAL, 240},
{"flower","Flower",REGROWTH_TYPE.NATURAL, 229},
{"flower_evil","Evil Flower",REGROWTH_TYPE.EVENT, 480},
{"flower_cave","Light Flower",REGROWTH_TYPE.EVENT, 480},
{"flower_cave_double","Double Light Flower",REGROWTH_TYPE.EVENT, 489},
{"flower_cave_triple","Triple Light Flower",REGROWTH_TYPE.EVENT, 471},
{"blue_mushroom","Blue Mushroom",REGROWTH_TYPE.NATURAL, 249},
{"red_mushroom","Red Mushroom",REGROWTH_TYPE.NATURAL, 240},
{"green_mushroom","Green Mushroom",REGROWTH_TYPE.NATURAL, 240},
{"cactus","Cactus",REGROWTH_TYPE.NATURAL, 479},
{"mandrake","Mandrake",REGROWTH_TYPE.EVENT, 969},
{"reeds","Reeds",REGROWTH_TYPE.NATURAL, 480},
{"sapling","Sapling",REGROWTH_TYPE.NATURAL, 240},
{"grass","Grass",REGROWTH_TYPE.NATURAL, 229},
{"marsh_bush","Spiky Bush",REGROWTH_TYPE.NATURAL, 480},
{"rock1","Boulder",REGROWTH_TYPE.NATURAL, 229},
{"rock2","Gold Vein",REGROWTH_TYPE.NATURAL, 240},
{"rock_flintless","Flintless Boulder",REGROWTH_TYPE.NATURAL, 251},
{"rock_moon","Moon Rock",REGROWTH_TYPE.NATURAL, 480},
{"stalagmite","Stalagmite",REGROWTH_TYPE.NATURAL, 229},
{"stalagmite_tall","Tall Stalagmite",REGROWTH_TYPE.NATURAL, 240},
{"beehive","Beehive",REGROWTH_TYPE.EVENT, 489},
{"wasphive","Killer Bee Hive",REGROWTH_TYPE.EVENT, 969},
{"houndmound","Hound Mound",REGROWTH_TYPE.EVENT, 1449},
{"pighouse","Pig House",REGROWTH_TYPE.EVENT, 960},
{"mermhouse","Rundown House",REGROWTH_TYPE.EVENT, 1429},
{"spiderden","Spider Den",REGROWTH_TYPE.EVENT, 1431},
{"catcoonden","Hollow Stump",REGROWTH_TYPE.EVENT, 951},
{"rabbithouse","Rabbit Hutch",REGROWTH_TYPE.EVENT, 951},
{"monkeypods","Splumonkey Pod",REGROWTH_TYPE.EVENT, 951},
{"slurtlehole", "Slurtle Mound", REGROWTH_TYPE.EVENT, 951},
{"tallbirdnest", "Tallbird Nest", REGROWTH_TYPE.EVENT, 960},
{"fireflies","Fireflies",REGROWTH_TYPE.EVENT, 471},
{"tentacle","Tentacle",REGROWTH_TYPE.EVENT, 489},
{"knight","Clockwork Knight",REGROWTH_TYPE.EVENT, 1440},
{"bishop","Clockwork Bishop",REGROWTH_TYPE.EVENT, 1431},
{"rook","Clockwork Rook",REGROWTH_TYPE.EVENT, 1449},
{"knight_nightmare","Damaged Knight",REGROWTH_TYPE.EVENT, 1449},
{"bishop_nightmare","Damaged Bishop",REGROWTH_TYPE.EVENT, 1440},
{"rook_nightmare","Damaged Rook",REGROWTH_TYPE.EVENT, 1440},
{"ruins_statue_mage","Ancient Mage Statue",REGROWTH_TYPE.EVENT, 969},
{"ruins_statue_mage_nogem","Gemless Ancient Mage Statue",REGROWTH_TYPE.EVENT, 969},
{"ruins_statue_head","Ancient Head Statue",REGROWTH_TYPE.EVENT, 960},
{"ruins_statue_head_nogem", "Gemless Ancient Head Statue", REGROWTH_TYPE.EVENT, 951}
}
if GLOBAL.STRINGS.NAMES.MIGRATION_PORTAL then
-- we have caves
AddPrefabPostInit("forest", function(inst)
@ -22,84 +100,30 @@ else
end)
end
local natural =
{
berrybush = 1451,
berrybush2 = 1429,
berrybush_juicy = 1429,
carrot_planted = 240,
evergreen = 251,
deciduoustree = 251,
marsh_tree = 480,
twiggytree = 491,
flower = 229,
grass = 229,
blue_mushroom = 251,
red_mushroom = 240,
green_mushroom = 240,
reeds = 480,
sapling = 240,
marsh_bush = 480,
cactus = 479,
rock1 = 229,
rock2 = 240,
rock_flintless = 251,
rock_moon = 480,
stalagmite = 489,
stalagmite_tall = 240,
}
local event =
{
flower_evil = 480,
marbletree= 960,
livingtree = 969,
mandrake = 969,
beehive = 489,
wasphive = 969,
houndmound = 1449,
pighouse = 960,
mermhouse = 960,
spiderden = 1431,
catcoonden = 951,
tentacle = 489,
rabbithole = 471,
fireflies = 471,
knight = 1431,
bishop = 1431,
rook = 1449,
knight_nightmare = 1449,
bishop_nightmare = 1440,
rook_nightmare = 1440,
monkeypods = 951,
ruins_statue_mage = 969,
ruins_statue_mage_nogem = 969,
ruins_statue_head = 960,
ruins_statue_head_nogem = 951,
rabbithouse = 951,
slurtlehole = 951,
tallbirdnest = 960
}
AddComponentPostInit("natural_regrowth", function(component)
for prefab, time in pairs(natural) do
if GetModConfigData(prefab) then
component:RegisterRegrowth(prefab, prefab, time)
for i = 1, #config_table do
local entry = config_table[i]
if entry[3] == REGROWTH_TYPE.NATURAL then
local prefab = entry[1]
local delay = entry[4]
if GetModConfigData(prefab) then
component:RegisterRegrowth(prefab, prefab, DEBUG and (delay / 100) or delay)
end
end
end
component:FinishModConfig()
end)
AddComponentPostInit("event_regrowth", function(component)
for prefab, time in pairs(event) do
if GetModConfigData(prefab) then
component:RegisterRegrowth(prefab, prefab, time)
for i = 1, #config_table do
local entry = config_table[i]
if entry[3] == REGROWTH_TYPE.EVENT then
local prefab = entry[1]
local delay = entry[4]
if GetModConfigData(prefab) then
component:RegisterRegrowth(prefab, prefab, DEBUG and (delay / 100) or delay)
end
end
end
component:FinishModConfig()
end)
--"forest" for the overworld
--"cave" for the caves.
--No more "world" prefab.
end)

View File

@ -209,6 +209,14 @@ return Class(function(self, inst)
end
function self:RegisterRegrowth(prefab, product, interval)
if interval == nil then
if DEBUG then
print("[EventRegrowth] WARNING: interval for ", prefab, " is null. Using default.")
end
interval = 480
end
if regrowth_table[prefab] == nil then
-- avoid duplicate registration
regrowth_table[prefab] =

View File

@ -149,6 +149,14 @@ return Class(function(self, inst)
end
function self:RegisterRegrowth(prefab, product, interval)
if interval == nil then
if DEBUG then
print("[NaturalRegrowth] WARNING: interval for ", prefab, " is null. Using default.")
end
interval = 480
end
if DEBUG then
print("[NaturalRegrowth] Registered ", product, " for prefab " ,prefab )
end