world_regrowth_pp/modmain.lua

105 lines
2.1 KiB
Lua
Raw Normal View History

2018-01-23 04:35:36 +00:00
if GLOBAL.STRINGS.NAMES.MIGRATION_PORTAL then
-- we have caves
AddPrefabPostInit("forest", function(inst)
if inst.ismastersim then
inst:AddComponent("natural_regrowth")
inst:AddComponent("event_regrowth")
end
end)
AddPrefabPostInit("cave", function(inst)
2018-01-23 04:35:36 +00:00
if inst.ismastersim then
inst:AddComponent("natural_regrowth")
inst:AddComponent("event_regrowth")
2018-01-23 04:35:36 +00:00
end
end)
else
-- only overworld
AddPrefabPostInit("world", function(inst)
2018-01-23 04:35:36 +00:00
if inst.ismastersim then
inst:AddComponent("natural_regrowth")
inst:AddComponent("event_regrowth")
2018-01-23 04:35:36 +00:00
end
end)
end
local natural =
{
2018-01-28 00:44:49 +00:00
berrybush = 1451,
berrybush2 = 1429,
berrybush_juicy = 1429,
carrot_planted = 240,
2018-01-28 00:44:49 +00:00
evergreen = 251,
deciduoustree = 251,
marsh_tree = 480,
2018-01-28 00:44:49 +00:00
twiggytree = 491,
flower = 229,
grass = 229,
blue_mushroom = 251,
red_mushroom = 240,
green_mushroom = 240,
reeds = 480,
sapling = 240,
marsh_bush = 480,
2018-01-28 00:44:49 +00:00
cactus = 479,
rock1 = 229,
rock2 = 240,
2018-01-28 00:44:49 +00:00
rock_flintless = 251,
rock_moon = 480,
2018-01-28 00:44:49 +00:00
stalagmite = 489,
stalagmite_tall = 240,
}
local event =
{
2018-01-28 00:44:49 +00:00
flower_evil = 480,
marbletree= 960,
livingtree = 969,
mandrake = 969,
beehive = 489,
wasphive = 969,
houndmound = 1449,
pighouse = 960,
mermhouse = 960,
2018-01-28 00:44:49 +00:00
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,
2018-01-28 00:44:49 +00:00
monkeypods = 951,
ruins_statue_mage = 969,
ruins_statue_mage_nogem = 969,
ruins_statue_head = 960,
2018-01-28 00:44:49 +00:00
ruins_statue_head_nogem = 951,
rabbithouse = 951,
2018-01-28 05:43:36 +00:00
slurtlehole = 951,
tallbirdnest = 960
}
2018-01-23 04:35:36 +00:00
AddComponentPostInit("natural_regrowth", function(component)
for prefab, time in pairs(natural) do
2018-01-28 00:44:49 +00:00
if GetModConfigData(prefab) then
component:RegisterRegrowth(prefab, prefab, time)
end
end
2018-01-28 00:44:49 +00:00
component:FinishModConfig()
2018-01-23 04:35:36 +00:00
end)
AddComponentPostInit("event_regrowth", function(component)
for prefab, time in pairs(event) do
2018-01-28 00:44:49 +00:00
if GetModConfigData(prefab) then
component:RegisterRegrowth(prefab, prefab, time)
end
end
component:FinishModConfig()
end)
2018-01-23 04:35:36 +00:00
--"forest" for the overworld
--"cave" for the caves.
--No more "world" prefab.