Jump to content

Recommended Posts

I'm doing a Hamlet Volcano mod, and I'm trying to synchronize the seasons on the Volcano with the seasons in Hamlet, and I had the idea to save the season data on the player, since the player's data is reloaded when entering a new world.

In my test world, I am climbing the volcano at the beginning of the lush season, but when I am on the volcano it's back to the beginning of temperate season, as if the data isn't being loaded at all - yet I had the season manager print out the data it's loading, and the correct data with {current_season = "lush"} is indeed getting through.. so what might be interfering with the season manager setting the current season to lush season?

local World_Traveller = Class(function(self, inst) end)

function World_Traveller:OnSave()
  	local data = {...}
	local manager = GetSeasonManager()
	if manager.seasonmode == "plateau" then 
		print("saving porkland season data in world traveller component")
		data.porkland_season = GetSeasonManager():OnSave() 
		for k, v in pairs(data.porkland_season) do print(k, v) end 
	end 
	
	return data
end 

function World_Traveller:OnLoad(data)
-- 	(a series of checks to make sure it's the volcano of hamlet)
	local manager = GetSeasonManager()
	if data.porkland_season and manager.Plateau then 
		print("loading porkland season data from world traveller component")
		for k, v in pairs(data.porkland_season) do print(k, v) end 
		manager:Plateau()
		if manager.season_change_task then 
			manager.season_change_task = manager.season_change_task:Cancel()
		end 
		manager:OnLoad(data.porkland_season)	
		manager.OnLoad = function() end 
	end 
end 

return World_Traveller

 

Edited by Bad Willow

It turns out that the Save Game Index loads the season it saved when it figures out that you're in the same season mode in the new world as in the one you left, so all you have to do is this:

function World_Traveller:OnLoad(data)
	...
	local manager = GetSeasonManager()
	if data.world == "porkland" and manager.Plateau then 
		manager:Plateau()
	end 
end 

Yet I'm still confused why the data loaded by the SaveGameIndex - which is done after my World_Traveller component loads its own season data - why these two loading processes would conflict with each other and displace the current season...

Edited by Bad Willow

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
×
  • Create New...