-- Copyright ©2022 by Todd Hundersmarck (ThundR)
-- All Rights Reserved
THNightGlower = {} local THNightGlower_mt = Class(THNightGlower, NightGlower) local function runScript() local globalEnv = g_thMain:getGlobalEnv() globalEnv.THNightGlower = THNightGlower g_thMain:hookFunction("NightGlower", "update", THNightGlower) g_thMain:hookFunction("NightGlower", "onWeatherChanged", THNightGlower) g_thMain:hookFunction("NightGlower", "delete", THNightGlower) end function THNightGlower:onCreate(id, ...) if entityExists(id) then return THNightGlower:superClass().onCreate(self, id, ...) end end function THNightGlower:hook_update(superFunc, dt, ...) if entityExists(self.id) then return superFunc(self, dt, ...) end end function THNightGlower:hook_onWeatherChanged(superFunc, ...) local id = self.id if entityExists(id) then if g_currentMission ~= nil and g_currentMission.environment ~= nil then return superFunc(self, ...) end end end function THNightGlower:hook_delete(superFunc, ...) g_currentMission:removeUpdateable(self) return superFunc(self, ...) end runScript()