MapControl init process¶
The init process involves 2 phases:
- Start
- The first LateUpdate (known as
latestart)
Start¶
Here is what Start does:
- Reset ScrewPlatform.
camischangingto false so the camera won't be fixed somewhere else as the map initialises - MainManager.FixSamira called. For more information, consult the samira section section of the music playback system
- Reset the DeadLanderOmega state (
stateto 0,detectedto false,activeidto -1 andhandto null) - If the skybox is present and we are not in an inside, the skybox's shader
_Tintis set to pure gray
Camera gets initialised with the following fields (the default value is picked if the field's magnitude is 0.2 or below):
| Value | Field | Default |
|---|---|---|
instance.camoffset |
camoffset |
defaultcamoffset |
instance.camangleoffset |
camangle |
defaultcamangle |
mainmeshgets a default value of the first child object if it was nullmainrendergets a default value of themainmesh's Renderer if it was nullmusicpreloadset to a new list- If
areaidisn't the current one, MainManager.UpdateArea is called with the new area. For more information, check the areaid section of the map identification documentation actualcenterset tocentralpoint- If there are any
canfollowIDelements,tempfollowersis initialised to a new list - instance.
battlestageset tobattlemap(this becomes the default stage to use on StartBattle if the stageid is -1) - The TextAsset of the map's dialogues is located and loaded. For more details on how this is done, check the
dialoguessection of the SetText configuration documentation - If the dialogues file loaded sucessfully,
dialoguesis set to its data whose endlines are normalised to LF and split by LF - If
useglobalcommandis true, the GlobalCommand system is enabled. Check the documentation to learn more - CreateEntities called which initialises
entities - The skybox gets set:
- If
skyboxmatexists, skybox gets set to it and if we aren't in an inside, its shader_Tintgets set to pure gray - Otherwise, skybox gets set to null and the
MainCamera's backgroundColor gets set to pure black
- If
- GetSkyColor called which just sets
skycolor's alpha to 1.0 (fully opaque) - If not
ineventandkeepmusicis false, Music is called which sets the music and initialises some music fields - CheckDisc is invoked in 1.0 seconds which will set
hiddenitemto 100 (only the fact it's not null matters) which will allow theDetectormedal to beep under specific conditions. Check the discoveryids documentation to learn more as this array is heavily involved in the checks for this - All
flowerbedof allplayerdataentities gets destroyed if any exists rendergets set to all MeshRenderer under in the children ofmainmeshmapflagsis initialised to 10 elements- GetDigWalls called which sets
digwallwith the following:- All GameObjects with
DigWalltag are found and all their first Collider are added todigwall - All GameObjects with
Respawntag have their layer set to 0 (Default) and if they have a BoxCollider, it is set to be trigger
- All GameObjects with
The fog settings are configured with fields:
| Value | Field |
|---|---|
| fogEndDistance | fogend |
| fogColor | fogcolor |
| ambientLight | globallight |
- SetScreenEffect called which will only do something if
screeneffectisSunRaysTopRight. If it is, a newPrefabs/Particles/SunRayis instantiated childed to theGUICamerawith a local position of (9.0, 7.0, 10.0) without rotations - RefreshInsides is called without inside and without caller which forces the initial state of the map to be outside
- CheckQuests called
- RefreshEntities called with forceanim and refreshmap
- CheckAchievement called which updates the records's states
- AreaSpecific called
- HelperMedalCheck called which will set flags 716 to true and add the
Helpermedal tobadgeshops[0](Merab) if flags 716 was false and any of the following flags is true (NOTE: only 514 and 298 matters because every other should imply 298 under normal gameplay):- 514 (Completed the Help Me Get it Back! quest)
- 498 (Completed the Explorer Check! quest)
- 610 (Beaten Maki’s team for the first time)
- 135 (Completed the Requesting Assistance quest)
- 704 (Completed the A New Hope quest)
- 391 (Completed the Butler Missing Again! quest)
- 298 (Beat the Dune Scorpion in chapter 4)
- 709 (Completed the Loose Ends quest)
- UpdateShops gets called which will randomly shuffle all
availablebadgepoolarrays (this changes the items on the shelf of the shops and updates flags 587's value which is true only when all Merab's medals were bought) - If
insidetypeslength isn't theinsidesone,insidetypesgets truncated to have a matching length - The shader global
GlobalIceRadiusis set to 0.0 - If
mapidisBugariaResidential, CombineMesh is invoked in 0.1 seconds. Check the merged mesh documentation to learn more
First LateUpdate (latestart)¶
tempfollowersgets updated from instance.extrafollowersusingcanfollowIDandchompygets set if needed. Check the follower system documentation to learn more- SetParticles called. See the particles level documentation to learn more
- PreloadSprites is invoked in 0.1 seconds which will set
entityspriteto each ofentities'ssprite's texture - If
faderchangeis true:fadersis set to all Fader in this mapfssis set to all the enablement of allfaders
- SetPlayerColliders is invoked in 0.2 seconds. See the entityonly documentation to learn more
latestartis set to true which blocks this logic from happening again