Template:PatchDiff/October 4, 2011 Patch/update/scripts/vscripts/debug scripts/mp coop lobby.nut

N/A 1 TauntList<- [  N/A 2 //0   N/A 3 "smallWave",   N/A 4 "highFive",   N/A 5 "not_used",   N/A 6 "rps",   N/A 7 //4   N/A 8 "laugh",   N/A 9 "robotDance",   N/A 10 //6   N/A 11 "teamtease",   N/A 12 "not_used",   N/A 13 "teamhug",   N/A 14 "trickfire",   N/A 15 ]   N/A 16    N/A 17    N/A 18 function OpenHUBAreas   N/A 19 {   N/A 20        local numHighestActiveBranch = GetHighestActiveBranch;   N/A 21        local numReturnToHub = GetGladosSpokenFlags(2);   N/A 22        local bCameFromLastDLCMap = GetCameFromLastDLCMap;   N/A 23    N/A 24        // If we transitioned from the last DLC map AND the num highest branch tells us we've not completed everything   N/A 25        if( bCameFromLastDLCMap && numHighestActiveBranch != 7 )   N/A 26        {   N/A 27                // Remove the glados return speech relay so glados wont jeer the players for quitting   N/A 28                // since they're returning to the hub after completing the DLC   N/A 29                EntFire( "relay_ret_glados", "kill" )   N/A 30        }   N/A 31    N/A 32        if( GetHaveSeenDLCTubesReveal == false )   N/A 33        {   N/A 34                EntFire( "relay_reveal_extra", "Enable", 0, 0 )   N/A 35                SetHaveSeenDLCTubesReveal   N/A 36        }   N/A 37        else   N/A 38        {   N/A 39                EntFire( "relay_quick_glados_extra", "Enable", 0, 0 )   N/A 40        }   N/A 41    N/A 42        EntFire( "counter_screen_flip", "SetMaxValueNoFire", numHighestActiveBranch, 0 )   N/A 43    N/A 44        if ( numHighestActiveBranch == 1 )   N/A 45        {   N/A 46                if ( numReturnToHub & (1 << 0) )   N/A 47                {   N/A 48                        //quick way   N/A 49                        EntFire( "counter_return_to_hub", "SetValue", "1", 0 )   N/A 50                }   N/A 51                else   N/A 52                {   N/A 53                        //slow way   N/A 54                        EntFire( "counter_choose_course", "SetValue", "1", 0 )   N/A 55                        // remember we saw it   N/A 56                        AddGladosSpokenFlags( 2, 1 << 0 )   N/A 57                }   N/A 58    N/A 59                EntFire( "counter_music", "SetValue", "1", 0 )   N/A 60        }   N/A 61        else if ( numHighestActiveBranch == 2 )   N/A 62        {   N/A 63                if ( numReturnToHub & (1 << 1) )   N/A 64                {   N/A 65                        //quick way   N/A 66                        EntFire( "counter_return_to_hub", "SetValue", "2", 0 )   N/A 67                }   N/A 68                else   N/A 69                {   N/A 70                        //slow way   N/A 71                        EntFire( "counter_choose_course", "SetValue", "2", 0 )   N/A 72                        // remember we saw it   N/A 73                        AddGladosSpokenFlags( 2, 1 << 1 )   N/A 74                }   N/A 75    N/A 76                EntFire( "texture_course_01", "SetTextureIndex", "1", 3 )   N/A 77                EntFire( "counter_music", "SetValue", "2", 0 )   N/A 78        }   N/A 79        else if ( numHighestActiveBranch == 3 )   N/A 80        {   N/A 81                if ( numReturnToHub & (1 << 2) )   N/A 82                {   N/A 83                        //quick way   N/A 84                        EntFire( "counter_return_to_hub", "SetValue", "3", 0 )   N/A 85                }   N/A 86                else   N/A 87                {   N/A 88                        //slow way   N/A 89                        EntFire( "counter_choose_course", "SetValue", "3", 0 )   N/A 90                        // remember we saw it   N/A 91                        AddGladosSpokenFlags( 2, 1 << 2 )   N/A 92                }   N/A 93    N/A 94                EntFire( "texture_course_01", "SetTextureIndex", "2", 3 )   N/A 95                EntFire( "texture_course_02", "SetTextureIndex", "1", 4 )   N/A 96                EntFire( "counter_music", "SetValue", "3", 0 )   N/A 97        }   N/A 98        else if ( numHighestActiveBranch == 4 )   N/A 99        {   N/A 100                if ( numReturnToHub & (1 << 3) )   N/A 101                {   N/A 102                        //quick way   N/A 103                        EntFire( "counter_return_to_hub", "SetValue", "4", 0 )   N/A 104                }   N/A 105                else   N/A 106                {   N/A 107                        //slow way   N/A 108                        EntFire( "counter_choose_course", "SetValue", "4", 0 )   N/A 109                        // remember we saw it   N/A 110                        AddGladosSpokenFlags( 2, 1 << 3 )   N/A 111                }   N/A 112    N/A 113                EntFire( "texture_course_01", "SetTextureIndex", "2", 3 )   N/A 114                EntFire( "texture_course_02", "SetTextureIndex", "2", 4 )   N/A 115                EntFire( "texture_course_03", "SetTextureIndex", "1", 5 )   N/A 116                EntFire( "counter_music", "SetValue", "4", 0 )   N/A 117        }   N/A 118        else if ( numHighestActiveBranch == 5 )   N/A 119        {   N/A 120                if ( numReturnToHub & (1 << 4) )   N/A 121                {   N/A 122                        //quick way   N/A 123                        EntFire( "counter_return_to_hub", "SetValue", "5", 0 )   N/A 124                }   N/A 125                else   N/A 126                {   N/A 127                        //slow way   N/A 128                        EntFire( "counter_choose_course", "SetValue", "5", 0 )   N/A 129                        // remember we saw it   N/A 130                        AddGladosSpokenFlags( 2, 1 << 4 )   N/A 131                }   N/A 132    N/A 133                EntFire( "texture_course_01", "SetTextureIndex", "2", 3 )   N/A 134                EntFire( "texture_course_02", "SetTextureIndex", "2", 4 )   N/A 135                EntFire( "texture_course_03", "SetTextureIndex", "2", 5 )   N/A 136                EntFire( "texture_course_04", "SetTextureIndex", "1", 6 )   N/A 137                EntFire( "counter_music", "SetValue", "5", 0 )   N/A 138        }   N/A 139        else if ( numHighestActiveBranch >= 6 )   N/A 140        {   N/A 141                EntFire( "counter_return_to_hub", "SetValue", "6", 0 )   N/A 142                EntFire( "texture_course_01", "SetTextureIndex", "2", 3 )   N/A 143                EntFire( "texture_course_02", "SetTextureIndex", "2", 4 )   N/A 144                EntFire( "texture_course_03", "SetTextureIndex", "2", 5 )   N/A 145                EntFire( "texture_course_04", "SetTextureIndex", "2", 6 )   N/A 146    N/A 147                if ( numHighestActiveBranch == 6 )   N/A 148                {   N/A 149                        EntFire( "counter_music", "SetValue", "6", 0 )   N/A 150                }   N/A 151                else   N/A 152                {   N/A 153                        EntFire( "counter_music", "SetValue", "7", 0 )   N/A 154                }   N/A 155        }   N/A 156    N/A 157        // now grant taunts to players if they are playing with a partner who has unocked more courses than they have   N/A 158        // they would have gotten the taunt when the course was unlocked for the first time,   N/A 159        // but since it's skipped when playing with a more experienced partner, we need to give them silently here   N/A 160        // check for the teamtease first   N/A 161        if ( numHighestActiveBranch >= 3 )   N/A 162        {   N/A 163                // check if mp_coop_fan is NOT complete in course 2 by either player   N/A 164                if ( IsPlayerLevelComplete( 0, 1, 7 ) == false || IsPlayerLevelComplete( 1, 1, 7 )  == false )   N/A 165                {   N/A 166                        EntFire( "@command", "command", "mp_earn_taunt teamtease 1", 1.0 )   N/A 167                        //printl("!!=== SCRIPT trying to grant teamtease silently" )   N/A 168                }   N/A 169        }   N/A 170        // now check the same thing for the laugh taunt   N/A 171        if ( numHighestActiveBranch >= 2 )   N/A 172        {   N/A 173                // check if mp_coop_teambts is NOT complete in course 1   N/A 174                if ( IsPlayerLevelComplete( 0, 0, 5 ) == false || IsPlayerLevelComplete( 1, 0, 5 ) == false )   N/A 175                {   N/A 176                        EntFire( "@command", "command", "mp_earn_taunt laugh 1", 1.0 )   N/A 177                        //printl("!!=== SCRIPT trying to grant laugh silently" )   N/A 178                }   N/A 179        }   N/A 180    N/A 181        EntFire( "counter_music", "GetValue", "", 1 )   N/A 182    N/A 183        if ( numHighestActiveBranch >= 2 )   N/A 184        {   N/A 185                EntFire( "hint_zoom", "Enable", "", 0 )   N/A 186        }   N/A 187    N/A 188        // give each player an achievement if they finished the prior branch   N/A 189        //TEAM_BUILDING   N/A 190        if ( IsPlayerBranchComplete( 0, 0 ) )   N/A 191        {   N/A 192                RecordAchievementEvent( "ACH.TEAM_BUILDING", GetBluePlayerIndex )   N/A 193        }   N/A 194        if ( IsPlayerBranchComplete( 1, 0 ) )   N/A 195        {   N/A 196                RecordAchievementEvent( "ACH.TEAM_BUILDING", GetOrangePlayerIndex )          N/A 197        }   N/A 198        //MASS_AND_VELOCITY   N/A 199        if ( IsPlayerBranchComplete( 0, 1 ) )   N/A 200        {   N/A 201                RecordAchievementEvent( "ACH.MASS_AND_VELOCITY", GetBluePlayerIndex )   N/A 202        }   N/A 203        if ( IsPlayerBranchComplete( 1, 1 ) )   N/A 204        {   N/A 205                RecordAchievementEvent( "ACH.MASS_AND_VELOCITY", GetOrangePlayerIndex )          N/A 206        }   N/A 207        //LIGHT BRIDGES   N/A 208        if ( IsPlayerBranchComplete( 0, 2 ) )   N/A 209        {   N/A 210                RecordAchievementEvent( "ACH.HUG_NAME", GetBluePlayerIndex )   N/A 211        }   N/A 212        if ( IsPlayerBranchComplete( 1, 2 ) )   N/A 213        {   N/A 214                RecordAchievementEvent( "ACH.HUG_NAME", GetOrangePlayerIndex )          N/A 215        }   N/A 216        //EXCURSION_FUNNELS   N/A 217        if ( IsPlayerBranchComplete( 0, 3 ) )   N/A 218        {   N/A 219                RecordAchievementEvent( "ACH.EXCURSION_FUNNELS", GetBluePlayerIndex )   N/A 220        }   N/A 221        if ( IsPlayerBranchComplete( 1, 3 ) )   N/A 222        {   N/A 223                RecordAchievementEvent( "ACH.EXCURSION_FUNNELS", GetOrangePlayerIndex )          N/A 224        }   N/A 225    N/A 226        for ( local i = 0; i < 5; i++ )   N/A 227        {          N/A 228                for ( local j = 0; j < 16; j++ )   N/A 229                {   N/A 230                        if ( IsLevelComplete( i, j ) )   N/A 231                        {   N/A 232                                EntFire( "texture_level_complete" + i + "" + j, "SetTextureIndex", "1", 0 )   N/A 233                        }   N/A 234                }   N/A 235    N/A 236                local branch = i + 1   N/A 237    N/A 238                if ( IsBranchComplete( i ) )   N/A 239                {   N/A 240                        EntFire( "track" + branch + "-texture_toggle_door", "SetTextureIndex", "1", i + 3 )   N/A 241                }   N/A 242        }   N/A 243    N/A 244        GrantGameCompleteAchievementHUB   N/A 245 }   N/A 246    N/A 247 function CompleteFinalMap   N/A 248 {   N/A 249        MarkMapComplete( GetMapName )   N/A 250 }   N/A 251    N/A 252 function GrantGameCompleteAchievementHUB   N/A 253 {   N/A 254        local bGameCompleteB = true   N/A 255        local bGameCompleteO = true   N/A 256        for ( local i = 0; i < 5; i++ )   N/A 257        {          N/A 258                if ( IsPlayerBranchComplete( 0, i ) == false )   N/A 259                {   N/A 260                        bGameCompleteB = false   N/A 261                        //printl("!!=== bGameCompleteB = false --- not completed branch " + i )   N/A 262                }   N/A 263                if ( IsPlayerBranchComplete( 1, i ) == false )   N/A 264                {   N/A 265                        bGameCompleteO = false   N/A 266                }   N/A 267        }   N/A 268    N/A 269        if ( bGameCompleteB )   N/A 270        {   N/A 271                RecordAchievementEvent( "ACH.NEW_BLOOD", GetBluePlayerIndex )          N/A 272                RecordAchievementEvent( "AV_SHIRT1", GetBluePlayerIndex )          N/A 273                //printl("!!!!!!!!=== AWARDING END GAME ACHIEVEMENT!!!" )  N/A 274        }   N/A 275        if ( bGameCompleteO )   N/A 276        {   N/A 277                RecordAchievementEvent( "ACH.NEW_BLOOD", GetOrangePlayerIndex )          N/A 278                RecordAchievementEvent( "AV_SHIRT1", GetOrangePlayerIndex )          N/A 279        }   N/A 280 }   N/A 281    N/A 282 function GrantGameCompleteAchievement   N/A 283 {   N/A 284        // this was moved from the last map because the toast caused the bink movie's sound to echo on the 360!   N/A 285        // it now lives in credits_coop.nut in CreditsGrantGameCompleteAchievement   N/A 286 }   N/A 287    N/A 288 function EarnTaunt( nTaunt )   N/A 289 {   N/A 290        local TauntName = TauntList[nTaunt];   N/A 291        if ( TauntName == "not_used" )   N/A 292                return;   N/A 293    N/A 294        local bGrantTauntB = true   N/A 295        local bGrantTauntO = true   N/A 296    N/A 297        if ( TauntName == "laugh" || TauntName == "teamtease" )   N/A 298        {   N/A 299                local nCourse = 0   N/A 300    N/A 301                if ( TauntName == "laugh" )   N/A 302                {   N/A 303                        nCourse = 1   N/A 304                }   N/A 305                else if ( TauntName == "teamtease" )   N/A 306                {   N/A 307                        nCourse = 2   N/A 308                }   N/A 309    N/A 310                for ( local j = 0; j < 16; j++ )   N/A 311                {   N/A 312                        if ( IsPlayerLevelComplete( 0, nCourse, j ) )   N/A 313                        {   N/A 314                                bGrantTauntB = false   N/A 315                                //printl("bGrantTauntB = false")   N/A 316                        }   N/A 317                        if ( IsPlayerLevelComplete( 1, nCourse, j ) )   N/A 318                        {   N/A 319                                bGrantTauntO = false   N/A 320                                //printl("bGrantTauntB = false")   N/A 321                        }   N/A 322                }   N/A 323        }   N/A 324    N/A 325        if ( bGrantTauntB == false && bGrantTauntO == false )   N/A 326        {   N/A 327                //printl("Not granting " + TauntName + " because both players already have it")   N/A 328                return   N/A 329        }   N/A 330    N/A 331        //printl("Earning " + TauntName)   N/A 332        EntFire( "@command", "command", "mp_earn_taunt " + TauntName, 0.0 )   N/A 333 }   N/A 334    N/A 335 function TransitionToCredits   N/A 336 {   N/A 337        if ( IsLocalSplitScreen )   N/A 338        {   N/A 339                EntFire( "@command", "Command", "changelevel mp_coop_credits", 0.1 )   N/A 340        }   N/A 341        else   N/A 342        {   N/A 343                EntFire( "@command", "Command", "changelevel mp_coop_credits", 0.0 )   N/A 344        }   N/A 345 }   N/A 346    N/A 347 function CheckForNewTaunts   N/A 348 {   N/A 349 }   0 350  + true