Jump to content

With this code I have, how can I add "secondary" biomes easily.


Recommended Posts

This code below works to force Pig village biome properly, but is there anyway to just add a secondary biome or even a third and so on easily.
For example I tried to add
-if i == "Befriend the pigs", "Killer bees!" then

But the "," crashes the game. Adding "and" seems to do nothing as well I think (unsure).

---------------------

local function AddPigs(taskset)
    -- check if caves, if so then exit
    if taskset.location ~= "forest" then
        return
    end
    -- add extra pig village if it doesn't exist in the tasks to be executed
    local has_pigs = false
    for _,i in pairs(taskset.tasks) do
        if i == "Befriend the pigs" then
            has_pigs = true
            break
        end
    end
    if not has_pigs then
        table.insert(taskset.tasks, "Befriend the pigs")
    end
    -- remove extra pig village if it is in optional tasks
    for index,i in pairs(taskset.optionaltasks) do
        if i == "Befriend the pigs" then
            table.remove(taskset.optionaltasks, index)
            taskset.numoptionaltasks = taskset.numoptionaltasks - 1
            break
        end
    end
end

-- modify any task sets
AddTaskSetPreInitAny(AddPigs)

Edited by NamelessName
Link to comment
Share on other sites

I have not directly attempted to change biomes myself, but I suggest taking a look at the Magic Biomes & Creatures mod that does a ton of worldgen stuff. There might some sort of functionality in it that allows them to add a biome after all the other code has run. If so, you might be able to run it however many times you need, without blowing up the server that is...

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...