Small Loading Order Mismatch with Streaming World

Discuss modding questions and implementation details.
Post Reply
l3lessed
Posts: 1403
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Small Loading Order Mismatch with Streaming World

Post by l3lessed »

So, I've been stuck the last two days trying to figure out why when I walked into a new location, my minimap mod wouldn't grab the right StreamingWorld.CurrentPlayerLocationObject object. It always seemed to grab the previous one I just walked out of, when tied into a PlayerGPS_OnMapPixelChanged(DFPosition mapPixel) change call. This doesn't seem correct. You would think the code would ensure to grab the StreamingWorld.CurrentPlayerLocationObject before the full PlayerGPS_OnMapPixelChanged(DFPosition mapPixel) change call finishes. Instead, it seems to send the PlayerGPS_OnMapPixelChanged(DFPosition mapPixel) call before the StreamingWorld.CurrentPlayerLocationObjec loads the newest current location object the player just moved into.

In my mod, this led to the map loading just fine with fast traveling into a city because the load order for the fast travel and update is correct, and the streaming world current location object doesn't update until after the full fast travel has been completed and the streaming world fully loaded, (including updating the current streaming world location object the player is in). But, as said above, upon walking into the new map pixel/location the map pixel change call would trigger before the streaming world updated the current location object, leading to grabbing the completely wrong/previous streaming current object location.

I found this issue by creating a debug log that listed the location name through the streaming world, through the playerGPS, and through the streaming world/local_playerGPS. I fixed it by doing this.

Code: Select all

if (!GameManager.Instance.IsPlayerInside && Minimap.changedLocations)
{
	if(GameManager.Instance.StreamingWorld.CurrentPlayerLocationObject.Summary.LocationName != GameManager.Instance.PlayerGPS.CurrentLocation.Name)
		Return;

	Minimap.changedLocations = false;
}
Anytime a map pixel change call is done, it flips my change location bool to true. At this point, it then will keep calling the current location object using the playersGPS and the streamingWorld, check the current location object names, and won't flip the changed location bool until both names match.

Nothing major, but it would be nice if the StreamingWorld.CurrentPlayerLocationObject was updated before the PlayerGPS_OnMapPixelChanged(DFPosition mapPixel) call finished, that way, if the map pixel call is used to trigger and grab the StreamingWorld.CurrentPlayerLocationObject other modders don't run into my issue.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply