Jump to content

Would this code work for modding?


Recommended Posts

Quote

local _G = GLOBAL
local TUNING = _G.TUNING
local APPI = AddPrefabPostInit

APPI("world", function(world)
    world:ListenForEvent("fullmoon", function()
        print("full moon, setting leif chances to 1/5")
        
        local LEIF_MIN_DAY = TUNING.LEIF_MIN_DAY
        local LEIF_PERCENT_CHANCE = TUNING.LEIF_PERCENT_CHANCE
        TUNING.LEIF_MIN_DAY = 0
        TUNING.LEIF_PERCENT_CHANCE = 1/5
        
        local function clocktick()
            local clock = _G.GetClock()
            if clock:IsNight() and clock:GetMoonPhase() == "full" then return end 
            print("exiting full moon, setting leif chances back")
            
            TUNING.LEIF_MIN_DAY = LEIF_MIN_DAY
            TUNING.LEIF_PERCENT_CHANCE = LEIF_PERCENT_CHANCE
            world:RemoveEventCallback("clocktick", clocktick)
        end
        
        world:ListenForEvent("clocktick", clocktick)
    end)
end)

Why does the game says it's out of date?

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...