Template:PatchDiff/May 08, 2012 Patch/update/scripts/vscripts/choreo/glados.nut

N/A 1 //ispaused  N/A 2 //IsPlayingBack   N/A 3 //EstimateLength   N/A 4    N/A 5 //debug stuff   N/A 6 debug <- false        //Set true to enable debug block during think function   N/A 7 debugInterval <- 10.00   N/A 8    N/A 9 lastthink <- Time   N/A 10 startBlock <- 0   N/A 11    N/A 12 //Queue of scenes started with GladosPlayVcd   N/A 13 scenequeue <- {}   N/A 14 firedfromqueue <- false   N/A 15    N/A 16 //Map Name   N/A 17 curMapName <- GetMapName   N/A 18    N/A 19 //PitchShifting stuff   N/A 20 pitchShifting <- false   N/A 21 pitchShiftLastThink <- Time   N/A 22 pitchShiftInterval <- 1.0   N/A 23 pitchShiftValue <- 1.0   N/A 24 pitchOverride <- null   N/A 25    N/A 26 //State Flags   N/A 27 stateSlowFieldTraining <- false   N/A 28    N/A 29    N/A 30 //jailbreak specific stuff   N/A 31 if (curMapName=="sp_sabotage_jailbreak_01" || curMapName=="sp_sabotage_jailbreak" || curMapName=="sp_a2_bts1")   N/A 32 {   N/A 33        jailbreakpos <- 0   N/A 34 }   N/A 35    N/A 36    N/A 37 //sp_catapult_fling_sphere_peek specific stuff   N/A 38 if (curMapName=="sp_a2_sphere_peek")   N/A 39 {   N/A 40        peekctr <- 0   N/A 41 }   N/A 42    N/A 43    N/A 44 //Dings   N/A 45 sceneDingOn  <- CreateSceneEntity("scenes/npc/glados_manual/ding_on.vcd")   N/A 46 sceneDingOff <- CreateSceneEntity("scenes/npc/glados_manual/ding_off.vcd")   N/A 47    N/A 48    N/A 49 //Include the autogenerated scene table   N/A 50 DoIncludeScript( "choreo/glados_scenetable_include", self.GetScriptScope )   N/A 51    N/A 52 //Include the manual scene table   N/A 53 DoIncludeScript( "choreo/glados_scenetable_include_manual", self.GetScriptScope )   N/A 54    N/A 55 //include the manual scene table for act 3   N/A 56 DoIncludeScript( "choreo/glados_scenetable_include_manual_act3", self.GetScriptScope )   N/A 57    N/A 58 //include the manual scene table for act 3   N/A 59 DoIncludeScript( "choreo/glados_scenetable_include_manual_cave", self.GetScriptScope )   N/A 60    N/A 61 //include the manual scene table for act 4   N/A 62 DoIncludeScript( "choreo/glados_scenetable_include_manual_act4", self.GetScriptScope )   N/A 63    N/A 64 //include the dlc2 stuff   N/A 65 DoIncludeScript( "choreo/dlc2_vo.nut", self.GetScriptScope )   N/A 66    N/A 67    N/A 68 function printldebug(arg)   N/A 69 {   N/A 70        if (debug)   N/A 71        {   N/A 72                printl(arg)   N/A 73        }   N/A 74 }   N/A 75    N/A 76    N/A 77 // ---   N/A 78 // Precache sounds we will emit   N/A 79 // Define like this: self.PrecacheSoundScript( "Your.SoundName" )   N/A 80 //   N/A 81 // Then you call the sound like so:   N/A 82 // self.EmitSound("Your.SoundName")   N/A 83 // ---   N/A 84 function Precache   N/A 85 {                N/A 86        if (curMapName=="sp_a4_tb_trust_drop")   N/A 87        {   N/A 88                self.PrecacheSoundScript( "World.WheatleyZap" )   N/A 89        }   N/A 90        if (curMapName=="sp_a1_wakeup")   N/A 91        {   N/A 92                self.PrecacheSoundScript( "World.HackBuzzer" )   N/A 93        }   N/A 94        if (curMapName=="sp_a3_speed_ramp")   N/A 95        {   N/A 96                self.PrecacheSoundScript( "World.WheatleyZap" )   N/A 97                self.PrecacheSoundScript( "World.GladosPotatoZap" )   N/A 98        }   N/A 99        if (curMapName=="sp_a3_transition01")   N/A 100        {   N/A 101                self.PrecacheSoundScript( "World.GladosPotatoZap" )   N/A 102        }   N/A 103    N/A 104    N/A 105 }   N/A 106    N/A 107 //function testemito   N/A 108 //{   N/A 109 //        self.EmitSound("World.Electrocution")   N/A 110 //}   N/A 111    N/A 112    N/A 113    N/A 114    N/A 115 // OnPostSpawn - this is all the initial setup stuff   N/A 116 function OnPostSpawn   N/A 117 {   N/A 118                local i = 0   N/A 119                //assign a unique id to each scene entity (uses SetTeam because that's the only thing available)   N/A 120                foreach (val in SceneTable)   N/A 121                {   N/A 122                        i+=1   N/A 123                        val.vcd.ValidateScriptScope   N/A 124                        val.vcd.SetTeam(i)   N/A 125                        val.index <- i   N/A 126                }                  N/A 127                //Initialize the deferred scene queue   N/A 128                QueueInitialize   N/A 129                PuzzlePreStart   N/A 130    N/A 131                //Map specific Spawn stuff   N/A 132                switch (curMapName)   N/A 133                {   N/A 134                        case "sp_a1_wakeup":   N/A 135                                EntFire("@glados","runscriptcode","sp_a1_wakeup_start_map",1.0)   N/A 136                                break   N/A 137                }   N/A 138 }   N/A 139    N/A 140    N/A 141    N/A 142 //Passed the unique team id associated with a scene entity defined in SceneTable, this function returns the correct SceneTable index for that entry   N/A 143 //ex: SceneTableInst = SceneTable[findIndex(team)]   N/A 144 function findIndex(team)   N/A 145 {   N/A 146                local idx, val   N/A 147                foreach (idx, val in SceneTable)   N/A 148                {   N/A 149                        if (val.index == team)   N/A 150                        {   N/A 151                                return idx   N/A 152                        }   N/A 153                }   N/A 154                return null   N/A 155 }   N/A 156    N/A 157 //Passed the unique team id associated with a scene entity defined in SceneTable, this function returns the scene instance that originally fired it. N/A 158 //Unfortunately, if multiple scene instances fire the same vcd, this isn't reliable. Hopefully we can either a) fix that  N/A 159 //or b) not have multiple scene instances use the same vcd (which is currently the case as of 07/19/2010 - efw)   N/A 160 function FindSceneInstanceByTeam(team)   N/A 161 {   N/A 162        local idx, val   N/A 163        local idx2, val2   N/A 164        local inst = null   N/A 165        foreach (idx, val in scenequeue)   N/A 166        {   N/A 167                foreach (idx2, val2 in val.waitFiredVcds)   N/A 168                {   N/A 169                        if (val2 == team)   N/A 170                        {   N/A 171                                inst = val   N/A 172                                break   N/A 173                        }   N/A 174                }   N/A 175                if (inst != null)   N/A 176                        break   N/A 177        }   N/A 178        return inst   N/A 179 }   N/A 180    N/A 181    N/A 182 function SceneCanceled   N/A 183 {   N/A 184        printldebug("========SCENE CANCELLED - CALLING ENTITY: "+findIndex(owninginstance.GetTeam))   N/A 185 }   N/A 186    N/A 187 //If a vcd is tagged to "exit early" (by setting postdelay < 0), this event fires rather than PlayNextScene when the vcd finishes. N/A 188 //SkipOnCompletion has all the functionality of PlayNextScene, except it doesn't actually play the next scene, because the next scene presumably  N/A 189 //already started playing when the vcd exited early. N/A 190 //SkipOnCompletion does, however, evaluate the vcd's SceneTable entry to see if any EntFires need to happen. N/A 191 function SkipOnCompletion  N/A 192 {   N/A 193        printldebug("========SKIPONCOMPLETION CALLING ENTITY: "+findIndex(owninginstance.GetTeam)+" : TIME "+Time)   N/A 194        local team = owninginstance.GetTeam   N/A 195        local inst = FindSceneInstanceByTeam(team)   N/A 196        if (inst != null)   N/A 197        {   N/A 198                inst.deleteFiredVcd(team)   N/A 199                inst.waitVcdCurrent = findIndex(team)   N/A 200                //Are there any EntFires associated with this vcd? N/A 201               if (inst.waitVcdCurrent != null)   N/A 202                {   N/A 203                        if ("fires" in SceneTable[inst.waitVcdCurrent])   N/A 204                        {   N/A 205                                local idx, val   N/A 206                                foreach (idx, val in SceneTable[inst.waitVcdCurrent].fires)   N/A 207                                {   N/A 208                                        if (!("fireatstart" in val))   N/A 209                                        {   N/A 210                                                printldebug(">>>>>>ENT FIRE AT (SKIPCOMPLETION) END: "+val.entity+":"+val.input)   N/A 211                                                EntFire(val.entity,val.input,val.parameter,val.delay)   N/A 212                                        }   N/A 213                                }   N/A 214                        }   N/A 215                }   N/A 216        }   N/A 217 }          N/A 218    N/A 219    N/A 220 function PlayNextScene   N/A 221 {   N/A 222        local team = owninginstance.GetTeam   N/A 223        local inst = FindSceneInstanceByTeam(team)   N/A 224        if (inst != null)   N/A 225        {   N/A 226                printldebug("========PLAYNEXTSCENE CALLING ENTITY: "+findIndex(owninginstance.GetTeam)+" : TIME "+Time)   N/A 227                inst.deleteFiredVcd(team)   N/A 228                inst.waitVcdCurrent = findIndex(team)   N/A 229                PlayNextSceneInternal(inst)   N/A 230        }          N/A 231        else   N/A 232        {   N/A 233                printldebug("========PLAYNEXTSCENE CALLING ENTITY NO LONGER EXISTS: CHECKING QUEUE...")   N/A 234                QueueCheck   N/A 235        }   N/A 236 }          N/A 237    N/A 238    N/A 239    N/A 240 function PlayNextSceneInternal(inst = null)   N/A 241 //inst = just completed scene   N/A 242 {   N/A 243        local i = 0   N/A 244        local tmp = 0   N/A 245    N/A 246        //Set the ducking back to the default value   N/A 247        SendToConsole( "snd_ducktovolume 0.55" )   N/A 248    N/A 249        //Are there any "fire at the end" triggers associated with the just completed? N/A 250       if (inst.waitVcdCurrent != null)   N/A 251        {   N/A 252                if ("fires" in SceneTable[inst.waitVcdCurrent])   N/A 253                {   N/A 254                        local idx, val   N/A 255                        foreach (idx, val in SceneTable[inst.waitVcdCurrent].fires)   N/A 256                        {   N/A 257                                if (!("fireatstart" in val))   N/A 258                                {   N/A 259                                        printldebug(">>>>>>ENT FIRE AT END: "+val.entity+":"+val.input)   N/A 260                                        EntFire(val.entity,val.input,val.parameter,val.delay)   N/A 261                                }   N/A 262                        }   N/A 263                }   N/A 264        }   N/A 265    N/A 266        //If the vcd that's ending is part of a nag cycle, check to see if there are any queued   N/A 267        //scenes for the primary nag character. If so, abandon the nag and start the queued scene. N/A 268       if (inst.isNag)   N/A 269        {   N/A 270                if (QueueLen(inst.currentCharacter)>0)   N/A 271                {   N/A 272                        printldebug("========ABANDONING NAG CYCLE TO PLAY QUEUED SCENE")   N/A 273                        scenequeue_DeleteScene(inst.index)   N/A 274                        QueueCheck   N/A 275                        return   N/A 276                }          N/A 277        }   N/A 278    N/A 279        //Is there another vcd in the scene chain? N/A 280       if (inst.waitNext != null)   N/A 281        {   N/A 282                printldebug("=====There is a next scene: "+inst.waitNext)   N/A 283                if (inst.waitLength == null)   N/A 284                {   N/A 285                        i+=1   N/A 286                        printldebug("===================Ready to play:" + i)   N/A 287                        GladosPlayVcd(inst)   N/A 288                 }          N/A 289                else   N/A 290                {   N/A 291                        inst.waitStartTime = Time   N/A 292                        inst.waiting = 1   N/A 293                }          N/A 294        }   N/A 295        else   N/A 296        {   N/A 297                printldebug("=====No next scene!")   N/A 298                //Remove the instance from the scene list   N/A 299                scenequeue_DeleteScene(inst.index)   N/A 300                //The current scene is over. Check to see if there are any queued scenes. N/A 301               if (QueueCheck)   N/A 302                        return   N/A 303                //Do the ding if nothing's queued and the previous scene requires a ding   N/A 304                if (!inst.waitNoDingOff)   N/A 305                        EntFireByHandle( sceneDingOff, "Start", "", 0.1, null, null )   N/A 306        }   N/A 307 }   N/A 308    N/A 309    N/A 310 //Think function   N/A 311 function GladosThink   N/A 312 {   N/A 313        //Put debug stuff here! N/A 314       if (debug)   N/A 315        {   N/A 316                if (Time-lastthink>debugInterval)   N/A 317                {   N/A 318                        printldebug("===================GladosThink-> " + lastthink)   N/A 319                        lastthink = Time   N/A 320                        QueueDebug   N/A 321                }   N/A 322        }          N/A 323        //Is GLaDOS gibbering   N/A 324        //if (glados_gibbering)   N/A 325        //{   N/A 326                //sp_sabotage_glados_gibberish   N/A 327        //}   N/A 328        //Are we PitchShifting? N/A 329       if (pitchShifting)   N/A 330        {   N/A 331                if (Time-pitchShiftLastThink>pitchShiftInterval)   N/A 332                {   N/A 333                        local curscene = self.GetCurrentScene   N/A 334                        if ( curscene != null )   N/A 335                        {   N/A 336                                local shiftAmount = RandomFloat( -0.10, 0.10)   N/A 337                                if (shiftAmount<0.00)   N/A 338                                        shiftAmount=shiftAmount*1.5   N/A 339                                pitchShiftValue += shiftAmount   N/A 340                                if ((pitchShiftValue <= 0.0) || (pitchShiftValue >= 1.7) )   N/A 341                                        pitchShiftValue -= (shiftAmount*2)   N/A 342                                EntFireByHandle( curscene, "PitchShift", pitchShiftValue.tostring, 0, null, null )   N/A 343                                pitchShiftInterval = RandomFloat( 0.1, 0.2)   N/A 344                        }   N/A 345                        //Set Lastthink   N/A 346                        pitchShiftLastThink = Time   N/A 347                }   N/A 348        }          N/A 349    N/A 350    N/A 351        local idx, val   N/A 352        //scan the list of currently playing scenes. N/A 353       foreach (idx,val in scenequeue)   N/A 354        {   N/A 355                //Check if the current vcd is scheduled to exit early   N/A 356                if (val.waitPreDelayed)   N/A 357                {   N/A 358                        if (Time>=val.waitDelayingUntil)   N/A 359                        {   N/A 360                                printldebug("*******LAUNCHING PREDELAYED SCENE")   N/A 361                                GladosPlayVcd(val)   N/A 362                        }   N/A 363                }   N/A 364                if (val.waitExitingEarly)   N/A 365                {   N/A 366                        if (Time-val.waitExitingEarlyStartTime >= val.waitExitingEarlyThreshold)   N/A 367                        {   N/A 368                                local team   N/A 369                                val.waitExitingEarly=false   N/A 370                                local curscene = characterCurscene(val.currentCharacter)   N/A 371                                if (curscene!=null)   N/A 372                                {   N/A 373                                        curscene.ValidateScriptScope   N/A 374                                        curscene.GetScriptScope.SkipOnCompletion <- SkipOnCompletion.bindenv(this)   N/A 375                                        curscene.DisconnectOutput("OnCompletion", "PlayNextScene")   N/A 376                                        curscene.DisconnectOutput("OnCompletion", "SkipOnCompletion")   N/A 377                                        curscene.ConnectOutput( "OnCompletion", "SkipOnCompletion" )   N/A 378                                        team = curscene.GetTeam   N/A 379                                        val.waitVcdCurrent = findIndex(team)   N/A 380                                }   N/A 381                                printldebug("====Scene "+val.index+" EXITING EARLY")   N/A 382                                PlayNextSceneInternal(val)   N/A 383                                return   N/A 384                        }   N/A 385                }   N/A 386        }   N/A 387    N/A 388        local tmp   N/A 389        //Check the deferred scene queue   N/A 390        tmp = QueueThink   N/A 391        //Is a queued scene ready to fire? N/A 392       if (tmp != null)   N/A 393        {   N/A 394                        printldebug("===========FORCING QUEUED SCENE: "+tmp)   N/A 395                        GladosPlayVcd(tmp,true)   N/A 396                        return   N/A 397        }   N/A 398    N/A 399        foreach (idx,val in scenequeue)   N/A 400        {   N/A 401                //Are we waiting to play another vcd? N/A 402               if (val.waiting == 1)   N/A 403                {   N/A 404                        if (Time-val.waitStartTime >= val.waitLength)   N/A 405                        {   N/A 406                                val.waiting = 0   N/A 407                                GladosPlayVcd(val)   N/A 408                        }   N/A 409                }   N/A 410        }   N/A 411 }   N/A 412    N/A 413    N/A 414 //Play a vcd from the SceneTable, plus set up next line (if any). N/A 415 //This is the function that should be used to start a scene from inside a map. N/A 416 function GladosPlayVcd(arg,IgnoreQueue = null, caller = null)  N/A 417 //arg==instance        -> Continue playing scene defined by scene class instance arg   N/A 418 //arg==integer        -> Start playing new scene (scene being a chain of vcds) from SceneTable[SceneTableLookup[arg]]   N/A 419 //arg==string                -> Start playing new scene (scene being a chain of vcds) from SceneTable[arg]   N/A 420 //arg==null                        -> Continue playing current scene with next vcd in current chain   N/A 421 //IgnoreQueue                -> true == don't check for queue status (this is used to force a queued vcd to play)   N/A 422 //caller                                -> If passed as an entity, the vcd will have its "target1" set to caller.GetName   N/A 423 {   N/A 424        printldebug("=========GladosPlayVcd Called!========="+arg)          N/A 425        local dingon = false   N/A 426    N/A 427        local inst   N/A 428        local fromqueue = firedfromqueue   N/A 429        firedfromqueue = false   N/A 430    N/A 431        if (typeof arg == "instance")   N/A 432        {   N/A 433                //if this is a vcd that was being held for predelay, play it   N/A 434                if (arg.waitPreDelayed)   N/A 435                {   N/A 436                        inst = arg   N/A 437                        arg = inst.waitPreDelayedEntry   N/A 438                }   N/A 439                //otherwise, play the next vcd in the chain   N/A 440                else   N/A 441                {   N/A 442                        inst = arg   N/A 443                        arg=inst.waitNext   N/A 444                }          N/A 445        }   N/A 446        else   N/A 447        {   N/A 448                //If this is a call from the map, look up the integer arg in the scene lookup table. N/A 449               //We need to do this because hammer/the engine can't pass a squirrel script a string, just an integer. N/A 450               //In other words, from a map, @glados.GladosPlayVcd("MyVcd") crashes the game. GladosPlayVcd(16) doesn't.  N/A 451                local sceneStart = 0   N/A 452                if (typeof arg == "integer")   N/A 453                {   N/A 454                        if (arg == 407 || arg == 43) //remove this line without changing map (12/21/2010)   N/A 455                        {   N/A 456                                return   N/A 457                        }   N/A 458                        sceneStart = arg   N/A 459                        printldebug("{}{}{}{}{}{}{}{}{}GladosPlayVcd: "+arg)          N/A 460                        arg = SceneTableLookup[arg]   N/A 461                }   N/A 462                else   N/A 463                {   N/A 464                        sceneStart = 0   N/A 465                }   N/A 466                //if SkipIfBusy is present & we're already playing a scene, skip this new scene   N/A 467                if ("skipifbusy" in SceneTable[arg])   N/A 468                {   N/A 469                        if (characterCurscene(SceneTable[arg].char)!=null)   N/A 470                        {   N/A 471                                return   N/A 472                        }   N/A 473                }   N/A 474                //if queue is present & we're already playing a scene, add scene to queue   N/A 475                 if ("queue" in SceneTable[arg])   N/A 476                 {   N/A 477                         if (IgnoreQueue == null)   N/A 478                        {   N/A 479                                //queue if a specific character is talking   N/A 480                                 if ("queuecharacter" in SceneTable[arg])   N/A 481                                 {   N/A 482                                        if (characterCurscene(SceneTable[arg].queuecharacter)!=null)   N/A 483                                        {   N/A 484                                                 QueueAdd(arg)   N/A 485                                                 return   N/A 486                                         }   N/A 487                                }   N/A 488                                //otherwise, queue if the character associated with the vcd is talking   N/A 489                                else   N/A 490                                {   N/A 491                                        if (characterCurscene(SceneTable[arg].char)!=null)   N/A 492                                        {   N/A 493                                                 QueueAdd(arg)   N/A 494                                                 return   N/A 495                                         }   N/A 496                                 }          N/A 497                        }                  N/A 498          }   N/A 499    N/A 500                if (scenequeue_AddScene(arg,SceneTable[arg].char) == null)   N/A 501                        return   N/A 502                inst = scenequeue[arg]   N/A 503                inst.waitSceneStart = sceneStart   N/A 504    N/A 505                if ("idle" in SceneTable[arg])   N/A 506                {   N/A 507                        nags_init(inst,arg)   N/A 508                }   N/A 509    N/A 510                //This is a new dialog block, so turn off special processing   N/A 511                dingon=true   N/A 512                pitchShifting = false   N/A 513                //startBlock = Time   N/A 514                if ("noDingOff" in SceneTable[arg])   N/A 515                        inst.waitNoDingOff = true   N/A 516                else   N/A 517                        inst.waitNoDingOff = false          N/A 518                if ("noDingOn" in SceneTable[arg])   N/A 519                        inst.waitNoDingOn = true   N/A 520                else   N/A 521                        inst.waitNoDingOn = false          N/A 522        }   N/A 523    N/A 524        local preDelay = 0.00   N/A 525        //If this vcd wasn't called after a predelay (meaning the predelay already happened), see if there is a predelay   N/A 526        if (!inst.waitPreDelayed)   N/A 527        {   N/A 528                preDelay = EvaluateTimeKey("predelay", SceneTable[arg])   N/A 529                if (fromqueue && "queuepredelay" in SceneTable[arg])   N/A 530                {   N/A 531                        preDelay = EvaluateTimeKey("queuepredelay", SceneTable[arg])   N/A 532                }   N/A 533                //If there is a predelay, set it and then GladosThink will fire it after predelay seconds. N/A 534               if (preDelay > 0.00)   N/A 535                {   N/A 536                        inst.waitPreDelayed = true   N/A 537                        inst.waitDelayingUntil = Time+preDelay   N/A 538                        inst.waitPreDelayedEntry = arg   N/A 539                        printldebug("======= "+arg+" PREDELAYED FOR "+preDelay+" SECONDS")   N/A 540                        return   N/A 541                }   N/A 542        }   N/A 543        //Otherwise, set the PreDelayed flag to false          N/A 544        else   N/A 545        {   N/A 546                inst.waitPreDelayed = false   N/A 547                inst.waitPreDelayedEntry = null   N/A 548        }   N/A 549    N/A 550        //If this scene is a nag/idle cycle, grab the next line off the stack   N/A 551        if (inst.isNag)   N/A 552        {   N/A 553                //If we're not in a vcd chain, grab the next vcd from the randomized pool   N/A 554                if (!inst.naginchain)   N/A 555                {   N/A 556                        arg = nags_fetch(inst)   N/A 557                }          N/A 558                //if nothing fetched (because the nag has used all the lines and isn't marked as "repeat"), remove this scene   N/A 559                if (arg == null)   N/A 560                {   N/A 561                        scenequeue_DeleteScene(inst.index)   N/A 562                        return   N/A 563                }   N/A 564        }   N/A 565    N/A 566        //Set ducking volume correctly for booming glados audio   N/A 567        SendToConsole( "snd_ducktovolume 0.2" )   N/A 568    N/A 569  //SetDucking( "announcerVOLayer", "announcerVO", 0.01 )   N/A 570  //SetDucking( "gladosVOLayer", "gladosVO", 0.1 )   N/A 571    N/A 572        if ( arg != null )   N/A 573        {   N/A 574    N/A 575                local ltalkover   N/A 576                ltalkover =  "talkover" in SceneTable[arg]   N/A 577    N/A 578                //Cancel any vcd that's already playing   N/A 579                if (!ltalkover)   N/A 580                {   N/A 581                        GladosAllCharactersStopScene   N/A 582                }          N/A 583                else   N/A 584                {   N/A 585                        //characters can't currently talk over themselves   N/A 586                        GladosCharacterStopScene(SceneTable[arg].char)   N/A 587                }   N/A 588    N/A 589                //Play the initial ding (unless the scene specifically requests no ding)   N/A 590                if (dingon && !inst.waitNoDingOn)   N/A 591                        EntFireByHandle( sceneDingOn, "Start", "", 0.00, null, null )   N/A 592    N/A 593    N/A 594                //Start the new vcd          N/A 595                printldebug("===================Playing:" + arg)   N/A 596                inst.currentCharacter = SceneTable[arg].char   N/A 597    N/A 598                //Bind the OnCompletion Event   N/A 599                SceneTable[arg].vcd.ValidateScriptScope   N/A 600                SceneTable[arg].vcd.GetScriptScope.PlayNextScene <- PlayNextScene.bindenv(this)   N/A 601                SceneTable[arg].vcd.DisconnectOutput( "OnCompletion", "PlayNextScene" )   N/A 602                SceneTable[arg].vcd.ConnectOutput( "OnCompletion", "PlayNextScene" )   N/A 603                SceneTable[arg].vcd.ConnectOutput( "OnCanceled", "SceneCanceled" )   N/A 604    N/A 605                //Set the target1 if necessary   N/A 606                if (caller != null)   N/A 607                {   N/A 608                        if (typeof caller == "string")   N/A 609                        {   N/A 610                                EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", caller, 0, null, null )   N/A 611                                printldebug("++++++++++++SETTING TARGET: "+caller)   N/A 612                        }          N/A 613                        else   N/A 614                        {   N/A 615                                EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", caller.GetName, 0, null, null )   N/A 616                        }   N/A 617                }          N/A 618                if ("settarget1" in SceneTable[arg])   N/A 619                {   N/A 620                        printldebug("++++++++++++ "+arg+"SETTING TARGET: "+SceneTable[arg].settarget1)   N/A 621                        EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", SceneTable[arg].settarget1, 0, null, null )   N/A 622                }   N/A 623    N/A 624                inst.waitVcdTeam = SceneTable[arg].index   N/A 625                inst.waitVcdCurrent = arg   N/A 626    N/A 627                inst.addFiredVcd(SceneTable[arg].index)   N/A 628    N/A 629                if (dingon && !inst.waitNoDingOn)   N/A 630                        EntFireByHandle( SceneTable[arg].vcd, "Start", "", 0.00+0.18, null, null )   N/A 631                else          N/A 632                        EntFireByHandle( SceneTable[arg].vcd, "Start", "", 0.00, null, null )   N/A 633    N/A 634    N/A 635                //Does this vcd have a "fire into entities" array? N/A 636               if ("fires" in SceneTable[arg])   N/A 637                {   N/A 638                        local idx, val   N/A 639                        foreach (idx, val in SceneTable[arg].fires)   N/A 640                        {   N/A 641                                if ("fireatstart" in val)   N/A 642                                {   N/A 643                                        printldebug(">>>>>>ENT FIRE AT START: "+val.entity+":"+val.input)   N/A 644                                        EntFire(val.entity,val.input,val.parameter, val.delay)   N/A 645                                }   N/A 646                        }   N/A 647                }   N/A 648    N/A 649                if ("special" in SceneTable[arg])   N/A 650                {   N/A 651                        switch (SceneTable[arg].special)   N/A 652                        {   N/A 653                                case 1: //Block-wide pitch shifting   N/A 654                                        pitchShifting = true   N/A 655                                        break   N/A 656                                case 2: //Speed up   N/A 657                                        if (pitchOverride == null)          N/A 658                                                EntFireByHandle( SceneTable[arg].vcd, "PitchShift", "2.5", 0, null, null )   N/A 659                                        break   N/A 660                                case 3: //Slow down a bit          N/A 661                                        EntFireByHandle( SceneTable[arg].vcd, "PitchShift", "0.9", 0, null, null )   N/A 662                                        break   N/A 663                        }   N/A 664                }   N/A 665                if (pitchOverride!=null)   N/A 666                        EntFireByHandle( SceneTable[arg].vcd, "PitchShift", pitchOverride.tostring, 0, null, null )   N/A 667    N/A 668    //Setup next line (if there is one)   N/A 669    if (SceneTable[arg].next != null || inst.isNag)   N/A 670    {   N/A 671            local pdelay = EvaluateTimeKey("postdelay",SceneTable[arg])   N/A 672    N/A 673            //if this is a nag, use min/max defined in the first entry in the scene   N/A 674            if (inst.isNag)   N/A 675            {   N/A 676                    pdelay = RandomFloat(inst.nagminsecs,inst.nagmaxsecs)   N/A 677            }   N/A 678    N/A 679            if (pdelay<0.00)   N/A 680            {   N/A 681                    if (inst.isNag)   N/A 682                            //If the "next" key != null, it means we're in a vcd chain   N/A 683                            if (SceneTable[arg].next != null)   N/A 684                            {   N/A 685                                    inst.waitNext = SceneTable[arg].next   N/A 686                                    inst.naginchain = true   N/A 687                            }   N/A 688                            else   N/A 689                            {   N/A 690                                    //Otherwise, just slug in the same index (any non-null value would work here, however)   N/A 691                                                inst.waitNext = arg   N/A 692                                    inst.naginchain = false   N/A 693                                        }   N/A 694                    else   N/A 695                                        inst.waitNext = SceneTable[arg].next   N/A 696                                 inst.waitExitingEarly=true   N/A 697                                 inst.waitLength=null   N/A 698                                 inst.waitExitingEarlyStartTime=Time   N/A 699                                //If we're in a nag vcd chain, use the vcds postdelay rather than the nag-wide delay   N/A 700                                //This is because vcd chains generally need to be explicitly timed at the chain level   N/A 701                                //since the vcds are grouped together as a block   N/A 702                                 if (inst.naginchain)   N/A 703                                         pdelay = EvaluateTimeKey("postdelay",SceneTable[arg])   N/A 704                                 inst.waitExitingEarlyThreshold=pdelay*-1   N/A 705                        }   N/A 706                        else   N/A 707                        {   N/A 708                                 inst.waitExitingEarly=false   N/A 709                    if (inst.isNag)   N/A 710                    {   N/A 711                            //If the "next" key != null, it means we're in a vcd chain   N/A 712                            if (SceneTable[arg].next != null)   N/A 713                            {   N/A 714                                    inst.waitNext = SceneTable[arg].next   N/A 715                                    inst.naginchain = true   N/A 716                            }   N/A 717                            else   N/A 718                            {   N/A 719                                    //Otherwise, just slug in the same index (any non-null value would work here, however)   N/A 720                                                inst.waitNext = arg   N/A 721                                    inst.naginchain = false   N/A 722                                        }   N/A 723                                }   N/A 724                    else   N/A 725                    {   N/A 726                                        inst.waitNext = SceneTable[arg].next   N/A 727                                }          N/A 728                                //If we're in a nag vcd chain, use the vcds postdelay rather than the nag-wide delay   N/A 729                                //This is because vcd chains generally need to be explicitly timed at the chain level   N/A 730                                //since the vcds are grouped together as a block   N/A 731                                 if (inst.naginchain)   N/A 732                                         pdelay = EvaluateTimeKey("postdelay",SceneTable[arg])   N/A 733                        }          N/A 734                   inst.waitLength = pdelay   N/A 735    }          N/A 736                else   N/A 737                {   N/A 738                        inst.waitNext = null   N/A 739                        printldebug("===================SCENE END")   N/A 740                }   N/A 741        }          N/A 742 }   N/A 743    N/A 744 function EvaluateTimeKey(keyname, keytable)   N/A 745 {   N/A 746        local ret = null   N/A 747    N/A 748         if (keyname in keytable)   N/A 749         {   N/A 750                 local typ = typeof keytable[keyname]   N/A 751                 if (typ == "array")   N/A 752                 {   N/A 753                         if (keytable[keyname].len != 2)   N/A 754                         {   N/A 755                                printldebug("!!!!!!!!!!!!EVALUATE TIME KEY ERROR: "+keyname+" is an array with a length != 2")                   N/A 756                                return 0.00   N/A 757                         }   N/A 758                         ret = RandomFloat(keytable[keyname][0],keytable[keyname][1])   N/A 759                 }   N/A 760                 else   N/A 761                 {   N/A 762                         ret = keytable[keyname]   N/A 763                 }          N/A 764         }   N/A 765         if (ret == null)   N/A 766                 ret = 0.00   N/A 767        printldebug(">>>>>>>>>EVALUATE TIME KEY: "+keyname+" : "+ret)                   N/A 768         return ret   N/A 769 }   N/A 770    N/A 771    N/A 772 function GladosToggleDebug(arg = null)   N/A 773 {   N/A 774        debug = !debug   N/A 775        if (debug)   N/A 776                printl("======================GLaDOS debug ON")   N/A 777        else   N/A 778                printl("======================GLaDOS debug OFF")   N/A 779        if (arg!=null)   N/A 780                debugInterval = arg   N/A 781 }   N/A 782    N/A 783 function GladosSetPitch(arg)   N/A 784 {   N/A 785        pitchOverride = arg   N/A 786        local curscene = self.GetCurrentScene   N/A 787        if ( curscene != null )          N/A 788                EntFireByHandle( curscene, "PitchShift", pitchOverride.tostring, 0, null, null )   N/A 789 }   N/A 790    N/A 791    N/A 792 //Nukes Everything. Delete all currently playing & queued scenes. N/A 793 function nuke  N/A 794 {   N/A 795        scenequeue = {}   N/A 796        Queue.clear   N/A 797        GladosAllCharactersStopScene   N/A 798        StopAllCaveSpeakers   N/A 799    N/A 800 }   N/A 801    N/A 802 //Checks each cave speaker actor to see if it's playing a vcd and stops it if it is. N/A 803 function StopAllCaveSpeakers  N/A 804 {   N/A 805        local caveactors = array(27),ent,val,sc   N/A 806        caveactors[0] = "@cave_exit_lift"   N/A 807        caveactors[1] = "cave_a3_03_dummy"   N/A 808        caveactors[2] = "cave_a3_03_dummy2"   N/A 809        caveactors[3] = "cave_a3_03_dummy3"   N/A 810        caveactors[4] = "cave_a3_03_exit"   N/A 811        caveactors[5] = "cave_a3_03_lift_shaft"   N/A 812        caveactors[6] = "cave_a3_03_waiting_room"   N/A 813        caveactors[7] = "cave_a3_jump_intro_entrance"   N/A 814        caveactors[8] = "cave_a3_jump_intro_interchamber"   N/A 815        caveactors[9] = "cave_a3_jump_intro_second_chamber"   N/A 816        caveactors[10] = "cave_a3_transition01_dummy"   N/A 817        caveactors[11] = "cave_a3_transition01_dummy2"   N/A 818        caveactors[12] = "cave_a3_transition01_dummy3"   N/A 819        caveactors[13] = "cave_bomb_flings_chamber"   N/A 820        caveactors[14] = "cave_bomb_flings_entrance"   N/A 821        caveactors[15] = "cave_crazy_box_2nd_chamber"   N/A 822        caveactors[16] = "cave_crazy_box_dummy_chamber"   N/A 823        caveactors[17] = "cave_crazy_box_entrance"   N/A 824        caveactors[18] = "cave_portal_intro_entrance"   N/A 825        caveactors[19] = "cave_portal_intro_exit"   N/A 826        caveactors[20] = "cave_portal_intro_office"   N/A 827        caveactors[21] = "cave_portal_intro_whitepaint"   N/A 828        caveactors[22] = "cave_speed_flings_entrance"   N/A 829        caveactors[23] = "cave_speed_ramp_entrance"   N/A 830        caveactors[24] = "cave_speed_ramp_inter_chamber"   N/A 831        caveactors[25] = "cave_transition01_dummy_exit"   N/A 832        caveactors[26] = "cave_transition01_welcome"   N/A 833    N/A 834        foreach (val in caveactors)   N/A 835        {   N/A 836                        ent=null   N/A 837                        ent = Entities.FindByName(ent, val)   N/A 838                        if (ent != null)   N/A 839                        {   N/A 840                                sc = ent.GetCurrentScene   N/A 841                                if ( sc != null )          N/A 842                                {   N/A 843                                        EntFireByHandle( sc, "Cancel", "", 0, null, null )   N/A 844                                }          N/A 845                        }   N/A 846        }   N/A 847 }   N/A 848    N/A 849    N/A 850 //Stops a scene for all characters   N/A 851 function GladosAllCharactersStopScene   N/A 852 {   N/A 853        GladosCharacterStopScene("glados")   N/A 854        GladosCharacterStopScene("wheatley")   N/A 855        GladosCharacterStopScene("cave_body")   N/A 856        GladosCharacterStopScene("core01")   N/A 857        GladosCharacterStopScene("core02")   N/A 858        GladosCharacterStopScene("core03")   N/A 859 }   N/A 860    N/A 861 function characterCurscene(arg)   N/A 862 {   N/A 863        local ret = null, ent = null   N/A 864        switch (arg)   N/A 865        {   N/A 866                case "bossannouncer":   N/A 867                        ent = Entities.FindByName(ent, "@actor_announcer")   N/A 868                        break   N/A 869                case "announcerglados":   N/A 870                        ent = Entities.FindByName(ent, "@glados")   N/A 871                        break   N/A 872                case "glados":   N/A 873                case "@glados":   N/A 874                        ent = Entities.FindByName(ent, "@glados")   N/A 875                        break   N/A 876                case "cave":   N/A 877                case "@cave":   N/A 878                        ent = Entities.FindByName(ent, "@cave")   N/A 879                        break   N/A 880                case "@sphere":   N/A 881                case "wheatley":          N/A 882                case "sphere":   N/A 883                        ent = Entities.FindByName(ent, "@sphere")   N/A 884                        break   N/A 885                case "core01":          N/A 886                case "@core01":          N/A 887                        ent = Entities.FindByName(ent, "@core01")   N/A 888                        break   N/A 889                case "core02":          N/A 890                case "@core02":          N/A 891                        ent = Entities.FindByName(ent, "@core02")   N/A 892                        break   N/A 893                case "core03":          N/A 894                case "@core03":          N/A 895                        ent = Entities.FindByName(ent, "@core03")   N/A 896                        break   N/A 897                case "cave_body":          N/A 898                case "cavebody":          N/A 899                        ent = Entities.FindByName(ent, "@cave_body")   N/A 900                        break   N/A 901                case "conveyor_turret":          N/A 902                        ent = Entities.FindByName(ent, "conveyor_turret_body")   N/A 903                        break   N/A 904        }   N/A 905        if (ent != null)   N/A 906        {   N/A 907                printldebug("&&&&&&FOUND ENTITY: "+arg)   N/A 908                ret = ent.GetCurrentScene   N/A 909        }          N/A 910        return ret   N/A 911 }   N/A 912    N/A 913 //Stops a scene for a particular character   N/A 914 function GladosCharacterStopScene(arg)   N/A 915 {   N/A 916        local ent = null   N/A 917        local curscene = characterCurscene(arg)   N/A 918        if ( curscene != null )   N/A 919        {   N/A 920                printldebug("&&&&&&STOP SCENE: "+arg+" FOUND SCENE TO DELETE!!!!!!!!!")   N/A 921                EntFireByHandle( curscene, "Cancel", "", 0, null, null )   N/A 922        }   N/A 923        else   N/A 924        {   N/A 925                printldebug("&&&&&&STOP SCENE: NO SCENE TO DELETE FOR " + arg)   N/A 926        }   N/A 927 }   N/A 928    N/A 929 //Turns off current Glados speech   N/A 930 function GladosStopTalking   N/A 931 {   N/A 932        local curscene = self.GetCurrentScene   N/A 933        pitchOverride = null   N/A 934        waitNext = null   N/A 935        waitLength = null   N/A 936        if ( curscene != null )          N/A 937                        EntFireByHandle( curscene, "Cancel", "", 0, null, null )   N/A 938 }   N/A 939    N/A 940 //Turns off current Glados speech if the scene # passed as arg is currently playing   N/A 941 function GladosStopScene(arg)   N/A 942 {   N/A 943        if (waitSceneStart == arg)   N/A 944        {   N/A 945                local curscene = self.GetCurrentScene   N/A 946                pitchOverride = null   N/A 947                waiting = 0   N/A 948                waitNext = null   N/A 949                waitLength = null   N/A 950                if ( curscene != null )          N/A 951                        EntFireByHandle( curscene, "Cancel", "", 0, null, null )   N/A 952        }                  N/A 953 }   N/A 954    N/A 955 //Slowfield functions   N/A 956 function GladosEndSlowFieldTraining   N/A 957 {   N/A 958        stateSlowFieldTraining = false   N/A 959        GladosStopTalking   N/A 960 }   N/A 961    N/A 962 function GladosStartSlowFieldTraining   N/A 963 {   N/A 964        stateSlowFieldTraining = true   N/A 965        GladosPlayVcd(40)   N/A 966 }   N/A 967    N/A 968 function GladosSlowFieldOn   N/A 969 {   N/A 970        if (stateSlowFieldTraining)   N/A 971                GladosPlayVcd(41)   N/A 972 }   N/A 973    N/A 974 function GladosSlowFieldOff   N/A 975 {   N/A 976        if (stateSlowFieldTraining)   N/A 977                GladosPlayVcd(40)   N/A 978 }   N/A 979 //End of Slowfield functions   N/A 980    N/A 981 //Special Chamber Processing   N/A 982 function GladosRelaxationVaultPowerUp   N/A 983 {   N/A 984        EntFire("open_portal_relay","Trigger","", 0.00)   N/A 985 }   N/A 986    N/A 987 //   N/A 988 // Automated dialog lookup   N/A 989 //   N/A 990    N/A 991 function MapNameConversion(orgname)   N/A 992 {   N/A 993        if (orgname in MapBspConversion)   N/A 994        {   N/A 995                return  MapBspConversion[orgname]   N/A 996        }   N/A 997        else   N/A 998        {   N/A 999                return orgname   N/A 1000        }   N/A 1001 }   N/A 1002    N/A 1003    N/A 1004 GladosDialog <-   N/A 1005 [   N/A 1006        { map = "sp_a1_intro2", prestart = "PreHub01PortalCarouselEntry01" completed = "PreHub01PortalCarouselSuccess01" },   N/A 1007        { map = "sp_a1_intro3", prestart = "sp_intro_03Start01"  completed = "sp_intro_03MindTheGapFinish01"},   N/A 1008        { map = "sp_a1_intro4", start = "PreHub01BoxDropperEntry01" completed = "sp_a1_intro4End01" },   N/A 1009        //{ map = "sp_a1_intro5", start = "PreHub01DualButtonOnePortalEntry01" completed = "PreHub01DualButtonOnePortalSuccessB01" },   N/A 1010        { map = "sp_a1_intro5", start = "sp_a1_intro5Start01" completed = "PreHub01DualButtonOnePortalSuccessB01" },   N/A 1011        { map = "sp_a1_intro6", start = "sp_a1_intro6Start01" completed = "sp_a1_intro6End01" },   N/A 1012        { map = "sp_a1_intro7", prestart = "sp_a1_intro7Start01" },   N/A 1013        //{ map = "sp_incinerator_01", exitstarted = "sp_incinerator_01Elevator01" },   N/A 1014        { map = "sp_laser_redirect_intro", start = "sp_laser_redirect_introStart01" completed = "sp_laser_redirect_introEnd01" },   N/A 1015        { map = "sp_laser_stairs", start = "sp_laser_stairsStart01" completed = "sp_laser_stairsEnd01" },   N/A 1016        { map = "sp_laser_dual_lasers", prestart = "sp_laser_dual_lasersStart01" completed = "sp_laser_dual_lasersEnd01" },   N/A 1017        { map = "sp_laser_over_goo", start = "sp_laser_over_gooStart01" completed = "sp_laser_over_gooEnd01" },   N/A 1018        { map = "sp_catapult_intro", completed = "sp_catapult_introEnd01" },   N/A 1019        { map = "sp_trust_fling", prestart = "sp_trust_flingStart01" completed = "sp_trust_flingEnd01" },   N/A 1020        { map = "sp_a2_pit_flings", prestart = "sp_a2_pit_flingsStart01" completed = "sp_a2_pit_flingsCubeSmuggleEnding01" },   N/A 1021        { map = "sp_a2_fizzler_intro" start = "sp_a2_fizzler_introStart01" },   N/A 1022        { map = "sp_catapult_fling_sphere_peek",  completed = "sp_catapult_fling_sphere_peekEnd01" },   N/A 1023        { map = "sp_a2_ricochet", prestart = "sp_a2_ricochetStart01" completed = "sp_a2_ricochetEnd01"},   N/A 1024        { map = "sp_bridge_intro", completed = "sp_bridge_introEnd01" },   N/A 1025        { map = "sp_bridge_the_gap", prestart = "sp_bridge_the_gapStart01" completed = "sp_bridge_the_gapEnd01" },   N/A 1026        { map = "sp_turret_training_advanced", prestart = "sp_turret_training_advancedStart01" },   N/A 1027        { map = "sp_laser_relays",  prestart = "sp_laser_relaysStart01" completed = "sp_laser_relaysEnd01" },   N/A 1028        { map = "sp_a2_turret_blocker", prestart = "sp_turret_blocker_introStart01" completed = "sp_turret_blocker_introEnd01" },   N/A 1029        { map = "sp_laser_vs_turret_intro", prestart = "sp_laser_vs_turret_introStart01" completed = "sp_laser_vs_turret_introEnd01" },   N/A 1030        { map = "sp_a2_pull_the_rug", prestart = "sp_a2_pull_the_rugStart01" completed = "sp_a2_pull_the_rugEnd01" },   N/A 1031        //RING AROUND THE TURRETS NO LONGER IN THE TRACK   N/A 1032        //{ map = "sp_ring_around_the_turrets",  completed = "sp_ring_around_the_turretsEnd01" }, **   N/A 1033        { map = "sp_column_blocker", completed = "sp_column_blockerEnd01" },   N/A 1034        { map = "sp_a2_laser_chaining" prestart = "sp_a2_laser_chainingStart01" completed = "sp_a2_laser_chainingEnd01"},   N/A 1035        //Turret Tower no longer in track   N/A 1036        //{ map = "sp_turret_tower" prestart = "sp_turret_towerStart01" completed = "sp_turret_towerEnd01"},   N/A 1037        { map = "sp_a2_triple_laser" start = "sp_a2_triple_laserStart01" completed = "sp_a2_triple_laserEnd01"},   N/A 1038        { map = "sp_sabotage_jailbreak" prestart = "sp_sabotage_jailbreakStart01" },   N/A 1039        { map = "sp_a3_speed_ramp", prestart = "-3150_01" },   N/A 1040        { map = "sp_a4_finale3", prestart = "-4849_01" },   N/A 1041 ]   N/A 1042    N/A 1043 //Generic glados dialog functions. N/A 1044 //PuzzleStart fires automatically as the player moves out of the level transition area  N/A 1045 function PuzzleStart   N/A 1046 {   N/A 1047        printldebug( "===============In Puzzle Start" + GetMapName)   N/A 1048        local mpco   N/A 1049        foreach (index, level in GladosDialog)   N/A 1050        {   N/A 1051                mpco=MapNameConversion(level.map)   N/A 1052                if ((level.map == GetMapName || mpco == GetMapName) && ("start" in level) )   N/A 1053                {   N/A 1054                        printldebug( "===============PuzzleStart: playing scene " + level.start )   N/A 1055                        GladosPlayVcd(level.start)   N/A 1056                }   N/A 1057        }   N/A 1058 }   N/A 1059    N/A 1060 //PuzzlePreStart fires just after the level load   N/A 1061 function PuzzlePreStart   N/A 1062 {   N/A 1063        printldebug( "===============In Puzzle PreStart")   N/A 1064        local mpco   N/A 1065        foreach (index, level in GladosDialog)   N/A 1066        {   N/A 1067                mpco=MapNameConversion(level.map)   N/A 1068                if ((level.map == GetMapName || mpco == GetMapName) && ("prestart" in level) )   N/A 1069                {   N/A 1070                        printldebug( "===============PuzzlePreStart: playing scene " + level.prestart )   N/A 1071                        GladosPlayVcd(level.prestart)   N/A 1072                }   N/A 1073        }   N/A 1074 }   N/A 1075    N/A 1076 didLeftElevatorChamber <- false   N/A 1077    N/A 1078 function LeftElevatorChamber   N/A 1079 {   N/A 1080        if (!didLeftElevatorChamber)   N/A 1081        {   N/A 1082                didLeftElevatorChamber = true   N/A 1083                local mpco   N/A 1084                foreach (index, level in GladosDialog)   N/A 1085                {   N/A 1086                        mpco=MapNameConversion(level.map)   N/A 1087                        if ((level.map == GetMapName || mpco == GetMapName) && ("leftelevatorchamber" in level) )   N/A 1088                        {   N/A 1089                                printldebug( "===============LeftElevatorChamber: playing scene " + level.leftelevatorchamber )   N/A 1090                                GladosPlayVcd(level.leftelevatorchamber)   N/A 1091                        }   N/A 1092                }   N/A 1093        }   N/A 1094 }   N/A 1095    N/A 1096 //ExitStarted fires when the exit elevator doors close   N/A 1097 function ExitStarted   N/A 1098 {   N/A 1099        printldebug( "===============In Puzzle ExitStarted")   N/A 1100        local mpco   N/A 1101        foreach (index, level in GladosDialog)   N/A 1102        {   N/A 1103                mpco=MapNameConversion(level.map)   N/A 1104                if ((level.map == GetMapName || mpco == GetMapName) && ("exitstarted" in level) )   N/A 1105                {   N/A 1106                        printldebug( "===============ExitStarted: playing scene " + level.exitstarted )   N/A 1107                        GladosPlayVcd(level.exitstarted)   N/A 1108                }   N/A 1109        }   N/A 1110 }   N/A 1111    N/A 1112 //PuzzleCompleted fires when the glados exit speech is supposed to trigger. It isn't fired automatically from an instance. N/A 1113 //It needs to fire from a trigger in the map  N/A 1114 function PuzzleCompleted   N/A 1115 {   N/A 1116        local mpco   N/A 1117        foreach (index, level in GladosDialog)   N/A 1118        {   N/A 1119                mpco=MapNameConversion(level.map)   N/A 1120                if ((level.map == GetMapName || mpco==GetMapName) && ("completed" in level) )   N/A 1121                {   N/A 1122                        printldebug( "===============PuzzleCompleted: playing scene " + level.completed )   N/A 1123                        GladosPlayVcd(level.completed)   N/A 1124                }   N/A 1125        }   N/A 1126 }   N/A 1127    N/A 1128 //--   N/A 1129 //Queue Functions   N/A 1130 //        -This is the queue of scenes delayed by another scene   N/A 1131 //--   N/A 1132    N/A 1133 Queue <- []   N/A 1134    N/A 1135 //Initialize the queue   N/A 1136 function QueueInitialize   N/A 1137 {   N/A 1138        Queue.clear   N/A 1139 }   N/A 1140    N/A 1141 //Add a scene to the queue   N/A 1142 //Queue table structure:   N/A 1143 //        item                                                 = index in SceneTable (ie: SceneTable[Queue[index].item])   N/A 1144 //        added                                                = time added to queue   N/A 1145 //        queueforcesecs        = (from SceneTable) force item to play after queueforcesecs seconds in queue   N/A 1146 //        queuetimeout                = (from SceneTable) delete item if it sits in queue for queuetimeout seconds   N/A 1147 //        queuepredelay                = (from SceneTable) wait queuepredelay seconds to fire the scene if it sat in the queue for any amount of time   N/A 1148 function QueueAdd(arg)   N/A 1149 {   N/A 1150        Queue.append( { item = arg added = Time })   N/A 1151        if (arg in SceneTable)   N/A 1152        {   N/A 1153                 if ("queueforcesecs" in SceneTable[arg])   N/A 1154                 {   N/A 1155                         Queue[Queue.len-1].queueforcesecs <- SceneTable[arg].queueforcesecs   N/A 1156                 }   N/A 1157                 else   N/A 1158                 {   N/A 1159                         Queue[Queue.len-1].queueforcesecs <- 45.0   N/A 1160                 }   N/A 1161                 if ("queuetimeout" in SceneTable[arg])   N/A 1162                 {   N/A 1163                         Queue[Queue.len-1].queuetimeout <- SceneTable[arg].queuetimeout   N/A 1164                 }   N/A 1165                 if ("queuepredelay" in SceneTable[arg])   N/A 1166                 {   N/A 1167                         Queue[Queue.len-1].queuepredelay <- SceneTable[arg].queuepredelay   N/A 1168                 }   N/A 1169    N/A 1170        }   N/A 1171 }   N/A 1172    N/A 1173 //Returns number of items in the queue   N/A 1174 function QueueLen(char = null)   N/A 1175 {   N/A 1176        local i = 0   N/A 1177        if (char == null)   N/A 1178        {   N/A 1179                return Queue.len   N/A 1180        }          N/A 1181        else   N/A 1182        {   N/A 1183                foreach (index, scene in Queue)   N/A 1184                {   N/A 1185                        if (SceneTable[scene.item].char == char)   N/A 1186                        {   N/A 1187                                i+=1   N/A 1188                        }   N/A 1189                }   N/A 1190                return i   N/A 1191        }   N/A 1192 }   N/A 1193    N/A 1194 //Fetch the next scene in the queue   N/A 1195 function QueueGetNext   N/A 1196 {   N/A 1197        local ret,l   N/A 1198        ret = null   N/A 1199        l=QueueLen   N/A 1200        if (l>0)   N/A 1201        {   N/A 1202                ret = Queue[l-1].item   N/A 1203                Queue.remove(l-1)   N/A 1204        }   N/A 1205        return ret   N/A 1206 }   N/A 1207    N/A 1208 function QueueDebug   N/A 1209 {   N/A 1210        printldebug("===================  items in queue-> " + Queue.len)   N/A 1211        foreach (index, scene in Queue)   N/A 1212        {   N/A 1213                printldebug("========= queue item "+index+"("+scene.item+"): character "+SceneTable[scene.item].char)   N/A 1214        }   N/A 1215 }   N/A 1216    N/A 1217 //General stuff called from GladosThink   N/A 1218 function QueueThink   N/A 1219 {   N/A 1220        local ret,t,index   N/A 1221        if (QueueLen==0)   N/A 1222        {   N/A 1223                return null   N/A 1224        }          N/A 1225    N/A 1226        t=Time   N/A 1227        //Check to see if any queued scenes timed out   N/A 1228        for (index = QueueLen; index > 0; index -= 1)   N/A 1229        {   N/A 1230                 if ("queuetimeout" in Queue[index-1])   N/A 1231                 {   N/A 1232                         if (t-Queue[index-1].added > Queue[index-1].queuetimeout)   N/A 1233                         {   N/A 1234                                 Queue.remove(index-1)   N/A 1235                         }   N/A 1236                 }   N/A 1237        }   N/A 1238    N/A 1239        //Check to see if any queued scenes should force fire   N/A 1240        foreach (index, scene in Queue)   N/A 1241        {   N/A 1242                 if ("queueforcesecs" in scene)   N/A 1243                 {   N/A 1244                         if (t-scene.added >scene.queueforcesecs)   N/A 1245                         {   N/A 1246                                 ret = scene.item   N/A 1247                                 Queue.remove(index)   N/A 1248                                 return ret   N/A 1249                         }   N/A 1250                 }   N/A 1251        }   N/A 1252        return null   N/A 1253 }   N/A 1254    N/A 1255 //Debug testbed function   N/A 1256 function QueueTest   N/A 1257 {   N/A 1258        local a = []   N/A 1259        for(local i=0;i<10;i+=1)   N/A 1260        {   N/A 1261                a.append(RandomInt(1,100))   N/A 1262                printl(">>>>>> " + i + " : " + a[i])   N/A 1263        }   N/A 1264        for (local i = a.len; i>0; i-=1)   N/A 1265        {   N/A 1266                if (a[i-1]<50)   N/A 1267                        a.remove(i-1)   N/A 1268        }   N/A 1269        foreach (index, n in a)   N/A 1270        {   N/A 1271                printl(">>>>>> " + index + " : " + a[index])   N/A 1272        }   N/A 1273 }   N/A 1274    N/A 1275 //Delete a single item from the queue   N/A 1276 function QueueDeleteItem(item)   N/A 1277 {   N/A 1278        if (QueueLen==0)   N/A 1279        {   N/A 1280                return false   N/A 1281        }          N/A 1282        foreach (index, scene in Queue)   N/A 1283        {   N/A 1284                if (scene.item == item)   N/A 1285                {   N/A 1286                                 Queue.remove(index)   N/A 1287                                 return true   N/A 1288                 }   N/A 1289        }   N/A 1290        return false   N/A 1291 }   N/A 1292    N/A 1293    N/A 1294 //Check to see if there's a Queued scene ready to go. If so, fire it! (and return true)  N/A 1295 function QueueCheck   N/A 1296 {   N/A 1297        local tmp   N/A 1298        if (QueueLen>0)   N/A 1299        {   N/A 1300                printldebug("===QUEUE LEN IS "+QueueLen)   N/A 1301                tmp=QueueGetNext   N/A 1302                if (tmp != null)   N/A 1303                {   N/A 1304                        firedfromqueue = true   N/A 1305                        GladosPlayVcd(tmp,true)   N/A 1306                        //GladosPlayVcd(tmp)   N/A 1307                        return true   N/A 1308                }   N/A 1309        }   N/A 1310        return false   N/A 1311 }   N/A 1312    N/A 1313 //--   N/A 1314 //End of Queue Functions   N/A 1315 //--   N/A 1316    N/A 1317 //--   N/A 1318 //sp_sabotage_jailbreak specific functions   N/A 1319 //--   N/A 1320    N/A 1321 function jailbreak_alert(arg)   N/A 1322 {   N/A 1323        jailbreakpos =arg   N/A 1324        printldebug("==========JAILBREAK ALERT "+arg)   N/A 1325 }   N/A 1326    N/A 1327 function jailbreak_whoah_speech   N/A 1328 {   N/A 1329        if (jailbreakpos == 0)   N/A 1330        {   N/A 1331                GladosPlayVcd(303)   N/A 1332        }   N/A 1333        else   N/A 1334        {   N/A 1335                GladosPlayVcd(302)   N/A 1336        }   N/A 1337 }   N/A 1338    N/A 1339    N/A 1340 //--   N/A 1341 //sp_sabotage_darkness specific functions   N/A 1342 //--   N/A 1343    N/A 1344    N/A 1345 function PlayGhostStory   N/A 1346 {   N/A 1347        GladosPlayVcd(445)   N/A 1348 }   N/A 1349    N/A 1350 function PlaySmellyHumansOne   N/A 1351 {   N/A 1352        GladosPlayVcd(446)   N/A 1353 }   N/A 1354    N/A 1355 function PlaySmellyHumansTwo   N/A 1356 {   N/A 1357        GladosPlayVcd(447)   N/A 1358 }   N/A 1359    N/A 1360 function PlaySmellyHumansThree   N/A 1361 {   N/A 1362        GladosPlayVcd(448)   N/A 1363 }   N/A 1364    N/A 1365 function PlaySmellyHumansFour   N/A 1366 {   N/A 1367        GladosPlayVcd(449)   N/A 1368 }   N/A 1369    N/A 1370    N/A 1371 //--   N/A 1372 //Glados Battle specific functions   N/A 1373 //--   N/A 1374    N/A 1375 glados_gibbering <- false   N/A 1376 glados_gibbering_start <- Time   N/A 1377 glados_gibbering_next <- 0.00   N/A 1378 glados_gibbering_times <- {}   N/A 1379    N/A 1380 glados_gibbering_times[1] <- 0.7   N/A 1381 glados_gibbering_times[2] <- 1.37   N/A 1382 glados_gibbering_times[3] <- 1.22   N/A 1383 glados_gibbering_times[4] <- 1.27   N/A 1384 glados_gibbering_times[5] <- 5.29   N/A 1385 glados_gibbering_times[6] <- 4.15   N/A 1386 glados_gibbering_times[7] <- 3.35   N/A 1387    N/A 1388    N/A 1389    N/A 1390 if (curMapName=="sp_a2_core" )   N/A 1391 {   N/A 1392        sp_a2_core_xfer_left_annex <- false   N/A 1393 }   N/A 1394    N/A 1395    N/A 1396    N/A 1397 function sp_sabotage_glados_start_gibberish   N/A 1398 {   N/A 1399        //gibberish is off for now   N/A 1400        //glados_gibbering = true   N/A 1401        glados_gibbering_start = Time   N/A 1402        glados_gibbering_next = 0.00   N/A 1403 }   N/A 1404    N/A 1405 function sp_sabotage_glados_stop_gibberish   N/A 1406 {   N/A 1407        glados_gibbering = false   N/A 1408 }   N/A 1409    N/A 1410 function sp_sabotage_glados_gibberish   N/A 1411 {   N/A 1412        local i = RandomInt(1,7)   N/A 1413        if (Time - glados_gibbering_start > glados_gibbering_next)   N/A 1414        {   N/A 1415                SendToConsole( "scene_playvcd npc/glados/sp_sabotage_glados_gibberish0"+i)   N/A 1416                glados_gibbering_start = Time   N/A 1417                //glados_gibbering_next = RandomFloat(3.5, 5.0)   N/A 1418                glados_gibbering_next = glados_gibbering_times[i]   N/A 1419        }          N/A 1420 }   N/A 1421    N/A 1422    N/A 1423    N/A 1424 // ==============================   N/A 1425 // player starts vault trap   N/A 1426 // ==============================   N/A 1427 function VaultTrapStart   N/A 1428 {   N/A 1429        GladosPlayVcd(-50)   N/A 1430 }   N/A 1431    N/A 1432 // ==============================   N/A 1433 // player begins moving in relaxation vault   N/A 1434 // ==============================   N/A 1435 function VaultTrapStartMoving   N/A 1436 {   N/A 1437        GladosPlayVcd(-53)   N/A 1438 }   N/A 1439    N/A 1440 // ==============================   N/A 1441 // turrets are on the ground and begin their scene   N/A 1442 // ==============================   N/A 1443 function TurretScene   N/A 1444 {   N/A 1445        GladosPlayVcd(-700)   N/A 1446 }   N/A 1447    N/A 1448 // ==============================   N/A 1449 // ==============================   N/A 1450 function TurretDeathReactionDialog   N/A 1451 {   N/A 1452        GladosPlayVcd(-57)   N/A 1453        //gladosbattle_pre_05 // my turrets! N/A 1454       //gladosbattle_pre_06 // oh, you were busy back there   N/A 1455        //gladosbattle_pre_17 // i suppose we could just sit here and glare ... but i have a better idea   N/A 1456 }   N/A 1457    N/A 1458    N/A 1459    N/A 1460 // ==============================   N/A 1461 // ==============================   N/A 1462 function WheatleyBouncingDownTubeDialog   N/A 1463 {   N/A 1464        // play various "ouch.. oof... ow..." lines here  N/A 1465        // play glados dialog responding to wheatley falling. "...sigh..." N/A 1466 }  N/A 1467    N/A 1468    N/A 1469 // ==============================   N/A 1470 // ==============================   N/A 1471 function WheatleyLandsInChamberDialog   N/A 1472 {   N/A 1473        GladosPlayVcd(-61)   N/A 1474        printldebug("==========HELLO!!!!!!!!!!!!!!!!!!!!!")   N/A 1475        //wheatley - gladosbattle_pre01 // Hello! N/A 1476       //gladosbattle_pre_09 // i hate you so much   N/A 1477 }   N/A 1478    N/A 1479 // ==============================   N/A 1480 // ==============================   N/A 1481 function CoreDetectedDialog   N/A 1482 {   N/A 1483        //announcer - gladosbattle02 // warning: core corrupted   N/A 1484        //glados - gladosbattle_xfer04 // that's funny i don't feel corrupted. in fact i feel pretty good  N/A 1485        //announcer - gladosbattle03 // alternate core detected   N/A 1486        //wheatley pre05  // ah that's me they're talking about! N/A 1487       //announcer - gladosbattle03 // to initiate a core transfer deposit core in receptacle   N/A 1488        //ent_fire "deploy_core_receptacle_relay" trigger // deploys the core receptacle   N/A 1489        //glados - gladosbattle_xfer05 // core transfer? N/A 1490       //glados - gladosbattle_xfer06 // oh you are kidding me   N/A 1491    N/A 1492 }   N/A 1493    N/A 1494    N/A 1495 // ==============================   N/A 1496 // ==============================   N/A 1497 function WheatleyCoreSocketed   N/A 1498 {   N/A 1499    N/A 1500        StopWheatleyPluginNag   N/A 1501        GladosPlayVcd(-71) // announcer - substitute core accepted. core, are you willing to start the procedure? N/A 1502   N/A 1503 }   N/A 1504    N/A 1505 // ==============================   N/A 1506 //        called when the player reaches a catapult or enters the room to press stalemate button   N/A 1507 // ==============================   N/A 1508 function StalemateAssociateNotSoFast   N/A 1509 {   N/A 1510        StopWheatleyPluginNag   N/A 1511        GladosPlayVcd(-84)   N/A 1512 }   N/A 1513    N/A 1514    N/A 1515 // ==============================   N/A 1516 // ==============================   N/A 1517 function CoreTransferInitiated   N/A 1518 {   N/A 1519        // start the core particle system   N/A 1520        nuke   N/A 1521        EntFire("glados_shutdown_particles_relay", "trigger", 0, 0 )   N/A 1522        GladosPlayVcd(-88) //Stalemate Resolved. Core Transfer Initiated. N/A 1523 }  N/A 1524    N/A 1525 // ==============================   N/A 1526 // ==============================   N/A 1527 function WheatleyCoreTransferStart   N/A 1528 {   N/A 1529        sp_a2_core_xfer_left_annex = true   N/A 1530        //nuke   N/A 1531        GladosPlayVcd(-4) // Here I go! N/A 1532 }  N/A 1533    N/A 1534 function sp_a2_core_leave_annex_nag   N/A 1535 {   N/A 1536        if (!sp_a2_core_xfer_left_annex)   N/A 1537        {   N/A 1538                GladosPlayVcd(-45)   N/A 1539        }   N/A 1540 }   N/A 1541    N/A 1542 // ==============================   N/A 1543 // ==============================   N/A 1544 function PitHandsGrabGladosHead   N/A 1545 {   N/A 1546        GladosPlayVcd(-89) // Get your hands off me! N/A 1547 }  N/A 1548    N/A 1549 // ==============================   N/A 1550 // ==============================   N/A 1551 function PullGladosIntoPit   N/A 1552 {   N/A 1553        GladosPlayVcd(-90) // CHELL! STOP THIS! I AM YOUR MOTHER! N/A 1554 }  N/A 1555    N/A 1556 // ==============================   N/A 1557 // ==============================   N/A 1558 function CoreTransferCompleted   N/A 1559 {   N/A 1560        GladosPlayVcd(-9)  // Wow! Check ME out, Partner! .. Look how small you are! N/A 1561 }  N/A 1562    N/A 1563 // ==============================   N/A 1564 // ==============================   N/A 1565 function PlayerEnteredElevator   N/A 1566 {   N/A 1567        StopWheatleyElevatorNag   N/A 1568        CorePlayerInElevator = 1 // this will prevent the elevator nag from being triggered by subsequent IO   N/A 1569        EntFire("@exit_elevator_music_relay","trigger", 0, 0 )   N/A 1570        GladosPlayVcd(-13) // I knew it was going to be cool being in charge.. N/A 1571   N/A 1572        // delete many of the small_pos arms   N/A 1573        EntFire("small_pos1", "kill", 0, 0 )   N/A 1574        EntFire("small_pos3", "kill", 0, 0 )   N/A 1575        EntFire("small_pos4", "kill", 0, 0 )   N/A 1576        EntFire("small_pos7", "kill", 0, 0 )   N/A 1577        EntFire("small_pos9", "kill", 0, 0 )   N/A 1578        EntFire("small_pos10", "kill", 0, 0 )   N/A 1579 }   N/A 1580    N/A 1581    N/A 1582 // ==============================   N/A 1583 // ==============================   N/A 1584 function DialogDuringPotatosManufacture   N/A 1585 {   N/A 1586        GladosPlayVcd(-33)   N/A 1587 }   N/A 1588    N/A 1589 // ==============================   N/A 1590 // ==============================   N/A 1591 function PotatosPresentation   N/A 1592 {   N/A 1593        GladosPlayVcd(-34)   N/A 1594 }   N/A 1595    N/A 1596 // ==============================   N/A 1597 // ==============================   N/A 1598 function ElevatorMoronScene   N/A 1599 {   N/A 1600        GladosPlayVcd(-37)   N/A 1601 }   N/A 1602    N/A 1603 // ==============================   N/A 1604 // ==============================   N/A 1605 function ElevatorConclusion   N/A 1606 {   N/A 1607        GladosPlayVcd(-44)   N/A 1608 }   N/A 1609    N/A 1610    N/A 1611 //--   N/A 1612 //sp_sabotage_factory functions   N/A 1613 //--   N/A 1614    N/A 1615 function sabotage_factory_WatchTheLine   N/A 1616 {   N/A 1617        GladosPlayVcd(441)   N/A 1618 }   N/A 1619    N/A 1620 function sabotage_factory_ReachedHackingSpot   N/A 1621 {   N/A 1622        GladosPlayVcd(442)   N/A 1623 }   N/A 1624    N/A 1625 function sabotage_factory_PlayerReachedWheatley   N/A 1626 {   N/A 1627        WheatleyStopNag   N/A 1628        GladosPlayVcd(443)   N/A 1629 }   N/A 1630    N/A 1631 function sabotage_factory_PlayerReachedExitDoor   N/A 1632 {   N/A 1633        WheatleyStopNag   N/A 1634        GladosPlayVcd(444)   N/A 1635 }          N/A 1636    N/A 1637    N/A 1638 //--   N/A 1639 //sp_sabotage_factory - Science Fair functions   N/A 1640 //--   N/A 1641 function ScienceFairGoingTheRightWay   N/A 1642 {   N/A 1643        GladosPlayVcd( -100 )   N/A 1644 }   N/A 1645    N/A 1646 function ScienceFairBringDaughter   N/A 1647 {   N/A 1648        GladosPlayVcd( -101 )   N/A 1649 }   N/A 1650    N/A 1651 function JustToReassureYou   N/A 1652 {   N/A 1653        GladosPlayVcd( -102 )   N/A 1654 }   N/A 1655    N/A 1656 function DefinitelySureThisWay   N/A 1657 {   N/A 1658        GladosPlayVcd( -103 )   N/A 1659 }   N/A 1660    N/A 1661    N/A 1662 //--   N/A 1663 //sp_catapult_fling_sphere_peek functions   N/A 1664 //--   N/A 1665    N/A 1666 function sp_catapult_fling_sphere_peek   N/A 1667 {   N/A 1668                switch (peekctr)   N/A 1669                {   N/A 1670                        case 0:   N/A 1671                                GladosPlayVcd(335)   N/A 1672                                break   N/A 1673                        case 2:   N/A 1674                                GladosPlayVcd(362)   N/A 1675                                break   N/A 1676                        case 4:   N/A 1677                                GladosPlayVcd(363)   N/A 1678                                break   N/A 1679                }          N/A 1680                peekctr+=1   N/A 1681 }   N/A 1682    N/A 1683    N/A 1684 //--   N/A 1685 //New test functions   N/A 1686 //--   N/A 1687 function GladosTest1(arg)   N/A 1688 {   N/A 1689        foreach (index, scene in arg)   N/A 1690        {   N/A 1691                if (scene.item)   N/A 1692                {   N/A 1693                        arg.remove(index)   N/A 1694                }   N/A 1695        }   N/A 1696 }   N/A 1697    N/A 1698    N/A 1699 //--   N/A 1700 //Scenes List Functions START   N/A 1701 //        -This is the list of currently playing scenes   N/A 1702 //--   N/A 1703    N/A 1704 class scene {   N/A 1705        //constructor   N/A 1706        constructor(a, caller)   N/A 1707        {   N/A 1708                index = a   N/A 1709                owner = caller   N/A 1710                currentCharacter = ""   N/A 1711                waitSceneStart = 0 //1 means we're waiting for the current vcd to finish so we can play the next vcd in the chain   N/A 1712                waiting = 0    N/A 1713                waitVcdCurrent = null   N/A 1714                waitStartTime = Time   N/A 1715                waitLength = Time   N/A 1716                waitNext = null   N/A 1717                waitExitingEarly = false   N/A 1718                waitExitingEarlyStartTime = Time   N/A 1719                waitExitingEarlyThreshold = 0.00 //How many seconds sould the VCD play before moving on to the next one   N/A 1720                waitDelayingUntil = null   N/A 1721                waitPreDelayed = false   N/A 1722                waitPreDelayedEntry = null   N/A 1723                waitNoDingOff = false   N/A 1724                waitNoDingOn = false   N/A 1725                waitVcdTeam = -1   N/A 1726                waitFiredVcds = []   N/A 1727                nagminsecs = 0   N/A 1728                nagmaxsecs = 0   N/A 1729                nags = []   N/A 1730                isNag = false   N/A 1731                nagpool = []   N/A 1732                naglastfetched = null   N/A 1733                nagrandom = false   N/A 1734                nagrandomonrepeat = false   N/A 1735                nagtimeslistcompleted = 0   N/A 1736                nagrepeat = false   N/A 1737                naginchain = false   N/A 1738        }   N/A 1739    N/A 1740        function nagsClear   N/A 1741        {   N/A 1742                naglastfetched = null   N/A 1743                nags.clear   N/A 1744        }   N/A 1745    N/A 1746        function nagpoolClear   N/A 1747        {   N/A 1748                nagpool.clear   N/A 1749        }   N/A 1750    N/A 1751    N/A 1752        function addFiredVcd(team)   N/A 1753        {   N/A 1754                waitFiredVcds.append(team)   N/A 1755        }   N/A 1756    N/A 1757        function deleteFiredVcd(team)   N/A 1758        {   N/A 1759                local idx, val   N/A 1760                local fnd = null   N/A 1761                foreach (idx, val in waitFiredVcds)   N/A 1762                {   N/A 1763                        if (val == team)   N/A 1764                        {   N/A 1765                                fnd = idx   N/A 1766                                break   N/A 1767                        }   N/A 1768                }          N/A 1769                if (fnd != null)   N/A 1770                {   N/A 1771                        waitFiredVcds.remove(fnd)   N/A 1772                }   N/A 1773        }   N/A 1774    N/A 1775    N/A 1776        //property   N/A 1777        index = 0;   N/A 1778        owner = null;   N/A 1779        currentCharacter = "";   N/A 1780        waitSceneStart = 0; //1 means we're waiting for the current vcd to finish so we can play the next vcd in the chain   N/A 1781        waiting = 0;    N/A 1782        waitVcdCurrent = null; //SceneTable index of last launched vcd   N/A 1783        waitStartTime = 0;   N/A 1784        waitLength = 0;   N/A 1785        waitNext = null;   N/A 1786        waitExitingEarly = false;   N/A 1787        waitExitingEarlyStartTime = 0;   N/A 1788        waitExitingEarlyThreshold = 0.00; //How many seconds sould the VCD play before moving on to the next one   N/A 1789        waitDelayingUntil = null;   N/A 1790        waitPreDelayed = false;   N/A 1791        waitPreDelayedEntry = null;   N/A 1792        waitNoDingOff = false;   N/A 1793        waitNoDingOn = false;   N/A 1794        waitFires = [];   N/A 1795        waitVcdTeam = -1;   N/A 1796        waitFiredVcds = [];   N/A 1797        isNag = false;   N/A 1798        nags = [];   N/A 1799        nagpool = [];   N/A 1800        nagminsecs = 0;   N/A 1801        nagmaxsecs = 0;   N/A 1802        naglastfetched = null;   N/A 1803        nagrandom = false;   N/A 1804        nagrandomonrepeat = false;   N/A 1805        nagtimeslistcompleted = 0;   N/A 1806        nagrepeat = false;   N/A 1807        naginchain = false;   N/A 1808 }   N/A 1809    N/A 1810    N/A 1811 function scenequeue_AddScene(arg,char)   N/A 1812 {   N/A 1813        local idx, val,delme   N/A 1814        delme=null   N/A 1815        foreach (idx, val in scenequeue)   N/A 1816        {   N/A 1817                if (SceneTable[idx].char==char)   N/A 1818                {   N/A 1819                        delme = idx   N/A 1820                }   N/A 1821                if (idx == arg)   N/A 1822                {   N/A 1823                        printldebug(">>>>>>>>>>Scene "+arg+" is already in the queue")   N/A 1824                        return null   N/A 1825                }   N/A 1826        }   N/A 1827        if (delme != null)   N/A 1828        {   N/A 1829                printldebug(">>>>>>>>>>DELETING SCENE "+delme)   N/A 1830                scenequeue_DeleteScene(delme)   N/A 1831        }   N/A 1832        scenequeue[arg] <- scene(arg, this)   N/A 1833        scenequeue_Dump   N/A 1834        return scenequeue[arg]   N/A 1835 }   N/A 1836    N/A 1837 function scenequeue_DeleteScene(arg)   N/A 1838 {   N/A 1839        local idx, val   N/A 1840        foreach (idx, val in scenequeue)   N/A 1841        {   N/A 1842                if (idx == arg)   N/A 1843                {   N/A 1844                        printldebug(">>>>>>>>>>Scene "+arg+" deleted!")   N/A 1845                        delete scenequeue[arg]   N/A 1846                        return true   N/A 1847                }   N/A 1848        }   N/A 1849        return null   N/A 1850 }   N/A 1851    N/A 1852 function scenequeue_Dump   N/A 1853 {   N/A 1854    N/A 1855        printldebug(">>>>>>>>>>Scene Dump at "+Time)   N/A 1856        foreach (idx, val in scenequeue)   N/A 1857        {   N/A 1858                printldebug(">>>>>>>>>>Scene "+idx+" ADDED at "+val.waitStartTime+" Type "+ typeof val)   N/A 1859        }          N/A 1860 }   N/A 1861    N/A 1862 //--   N/A 1863 //Scene Queue Functions END   N/A 1864 //--   N/A 1865    N/A 1866 //--   N/A 1867 //Nag Table Functions START   N/A 1868 //--   N/A 1869    N/A 1870 function nags_init(inst,scenetableentry)   N/A 1871 {   N/A 1872        local i = 0   N/A 1873        inst.nagsClear   N/A 1874        if ("idleminsecs" in SceneTable[scenetableentry])   N/A 1875        {   N/A 1876                inst.nagminsecs = SceneTable[scenetableentry].idleminsecs   N/A 1877                if ("idlemaxsecs" in SceneTable[scenetableentry])   N/A 1878                {   N/A 1879                        inst.nagmaxsecs = SceneTable[scenetableentry].idlemaxsecs   N/A 1880                }   N/A 1881                else   N/A 1882                {   N/A 1883                        inst.nagmaxsecs = inst.nagminsecs   N/A 1884                }   N/A 1885        }   N/A 1886    N/A 1887        if ("idlerandomonrepeat" in SceneTable[scenetableentry])   N/A 1888        {   N/A 1889                inst.nagrandomonrepeat = true   N/A 1890        }   N/A 1891    N/A 1892        if ("idlerepeat" in SceneTable[scenetableentry])   N/A 1893        {   N/A 1894                inst.nagrepeat = true   N/A 1895        }   N/A 1896    N/A 1897        if ("idlerandom" in SceneTable[scenetableentry])   N/A 1898        {   N/A 1899                inst.nagrandom = true   N/A 1900        }   N/A 1901    N/A 1902        local igroup = SceneTable[scenetableentry].idlegroup   N/A 1903        local idx, val,oig=0   N/A 1904        foreach (idx, val in SceneTable)   N/A 1905        {   N/A 1906                if (!("idlegroup" in val))   N/A 1907                        continue   N/A 1908                if (val.idlegroup != igroup)   N/A 1909                        continue   N/A 1910                local rar = 101, mnum = 0   N/A 1911                if ("idlerarity" in val)   N/A 1912                {   N/A 1913                        rar = val.idlerarity   N/A 1914                }   N/A 1915                if ("idlemaxplays" in val)   N/A 1916                {   N/A 1917                        mnum = val.idlemaxplays   N/A 1918                }   N/A 1919                //Skip vcds that are part of a chain (and not the first link in the chain)   N/A 1920                if ("idleunder" in val)   N/A 1921                {   N/A 1922                        continue   N/A 1923                }   N/A 1924                if ("idleorderingroup" in val)   N/A 1925                {   N/A 1926                        oig=val.idleorderingroup   N/A 1927                }   N/A 1928                else   N/A 1929                {   N/A 1930                        oig=0   N/A 1931                }   N/A 1932                inst.nags.append({SceneTableIndex=idx, rarity = rar, maxplays = mnum, totplays = 0,orderingroup = oig})   N/A 1933        }   N/A 1934        inst.nags.sort(nag_array_compare)   N/A 1935        inst.isNag = true   N/A 1936        inst.nagtimeslistcompleted = 0   N/A 1937        nags_createpool(inst)   N/A 1938 }   N/A 1939    N/A 1940 function nags_createpool(inst)   N/A 1941 {   N/A 1942        inst.nagpoolClear   N/A 1943        local idx, val   N/A 1944        local takeit = false   N/A 1945        local tempa = []   N/A 1946        foreach (idx, val in inst.nags)   N/A 1947        {   N/A 1948                takeit=false   N/A 1949                if (val.totplays >= val.maxplays && val.maxplays>0)   N/A 1950                {   N/A 1951                        continue   N/A 1952                }   N/A 1953                if (RandomInt(1,100)<val.rarity)   N/A 1954                {   N/A 1955                        takeit=true   N/A 1956                }          N/A 1957                if (takeit)   N/A 1958                {   N/A 1959                        tempa.append(val)   N/A 1960                }   N/A 1961        }   N/A 1962        local r   N/A 1963        //The pool can still be empty at this point if only rare lines were available and none of them "made their roll". N/A 1964       if (tempa.len == 0)   N/A 1965                return   N/A 1966    N/A 1967        if (inst.nagrandom || (inst.nagrandomonrepeat && inst.nagtimeslistcompleted > 0))   N/A 1968        {   N/A 1969                //Make sure the first entry in the new list isn't the same as the last vcd played. N/A 1970               //This ensures no repeats. N/A 1971               if (tempa.len>1 && inst.naglastfetched!=null)   N/A 1972                {   N/A 1973                        while (true)   N/A 1974                        {   N/A 1975                                r=RandomInt(0,tempa.len-1)   N/A 1976                                if (tempa[r].SceneTableIndex != inst.naglastfetched)   N/A 1977                                {   N/A 1978                                        inst.nagpool.append(tempa[r])   N/A 1979                                        tempa.remove(r)   N/A 1980                                        break   N/A 1981                                }   N/A 1982                        }   N/A 1983                }   N/A 1984                //Now build the rest of the pool   N/A 1985                while (tempa.len>0)   N/A 1986                {   N/A 1987                        r=RandomInt(0,tempa.len-1)   N/A 1988                        inst.nagpool.append(tempa[r])   N/A 1989                        tempa.remove(r)   N/A 1990                }   N/A 1991        }   N/A 1992        else   N/A 1993        {   N/A 1994                foreach(idx, val in tempa)   N/A 1995                {   N/A 1996                        inst.nagpool.append(val)   N/A 1997                }   N/A 1998        }          N/A 1999 }   N/A 2000    N/A 2001 function nags_nagpooldump(inst)   N/A 2002 {   N/A 2003        local idx, val   N/A 2004        foreach (idx, val in inst.nagpool)   N/A 2005                printldebug("*********NAG "+idx+" : "+val.SceneTableIndex)   N/A 2006 }   N/A 2007    N/A 2008 function nags_fetch(inst)   N/A 2009 {   N/A 2010        if (inst.nagpool.len == 0)   N/A 2011        {   N/A 2012                if (inst.nagrepeat)   N/A 2013                {   N/A 2014                        inst.nagtimeslistcompleted += 1   N/A 2015                        nags_createpool(inst)   N/A 2016                        if (inst.nagpool.len == 0)   N/A 2017                                return null   N/A 2018                }   N/A 2019                else   N/A 2020                {   N/A 2021                        return null   N/A 2022                }          N/A 2023        }   N/A 2024        local ret = inst.nagpool[0].SceneTableIndex   N/A 2025        foreach( idx, val in inst.nags)   N/A 2026        {   N/A 2027                if (val.SceneTableIndex == ret)   N/A 2028                {   N/A 2029                        val.totplays+=1   N/A 2030                        break   N/A 2031                }   N/A 2032        }   N/A 2033        //nags_nagpooldump(inst)   N/A 2034        inst.nagpool.remove(0)   N/A 2035        inst.naglastfetched = ret   N/A 2036        return ret   N/A 2037 }   N/A 2038    N/A 2039 function GladosStopNag(arg = 0)   N/A 2040 {   N/A 2041        nag_stop("glados",arg)   N/A 2042 }   N/A 2043    N/A 2044 function WheatleyStopNag(arg = 0)   N/A 2045 {   N/A 2046        nag_stop("wheatley",arg)   N/A 2047 }   N/A 2048    N/A 2049 function Core01StopNag(arg = 0)   N/A 2050 {   N/A 2051        nag_stop("core01",arg)   N/A 2052 }   N/A 2053    N/A 2054 function Core02StopNag(arg = 0)   N/A 2055 {   N/A 2056        nag_stop("core02",arg)   N/A 2057 }   N/A 2058    N/A 2059 function Core03StopNag(arg = 0)   N/A 2060 {   N/A 2061        nag_stop("core03",arg)   N/A 2062 }   N/A 2063    N/A 2064    N/A 2065 function nag_stop(char, stoptype)   N/A 2066 {   N/A 2067        local idx, val   N/A 2068        local todel = null   N/A 2069        foreach (idx, val in scenequeue)   N/A 2070        {   N/A 2071                if (val.isNag && val.currentCharacter == char)   N/A 2072                {   N/A 2073                        todel=idx   N/A 2074                        break   N/A 2075                }   N/A 2076        }   N/A 2077        if (todel != null)   N/A 2078        {   N/A 2079                scenequeue_DeleteScene(todel)          N/A 2080        }   N/A 2081 }   N/A 2082    N/A 2083 function nag_array_compare(a,b)   N/A 2084 {   N/A 2085        if(a.orderingroup>b.orderingroup) return 1   N/A 2086        else if(a.orderingroup<b.orderingroup) return -1   N/A 2087        return 0;   N/A 2088 }   N/A 2089    N/A 2090    N/A 2091 //--   N/A 2092 //Nag Table Functions END   N/A 2093 //--   N/A 2094    N/A 2095    N/A 2096 function TrustFlingCatapultTurretNoticesPlayer   N/A 2097 {   N/A 2098        GladosPlayVcd(439, null, "catapulted_turret")   N/A 2099 }   N/A 2100    N/A 2101 //--   N/A 2102 //Elevator Stoppage in bridge over goo   N/A 2103 //--   N/A 2104    N/A 2105 function sp_a2_laser_over_goo_elevator_stoppage   N/A 2106 {   N/A 2107        GladosPlayVcd(465)   N/A 2108        // @trigger_this_to_stop_elevator   N/A 2109        // @trigger_this_to_start_elevator   N/A 2110 }   N/A 2111    N/A 2112    N/A 2113 //--   N/A 2114 //sp_a1_intro7 functions   N/A 2115 //--   N/A 2116 if (curMapName=="sp_a1_intro7")   N/A 2117 {   N/A 2118        sp_a1_intro7_popped <- false   N/A 2119        sp_a1_intro7_camethrough <- false   N/A 2120        sp_a1_intro7_pickedup <- false   N/A 2121        sp_a1_intro7_pickedupcount <- 0   N/A 2122        sp_a1_intro7_pluggedin <- false   N/A 2123        sp_a1_intro7_turnedaway <- false   N/A 2124        sp_a1_intro7_sayingnotdead <- false   N/A 2125        sp_a1_intro7_saidnotdead <- false   N/A 2126 }          N/A 2127    N/A 2128 function sp_a1_intro7_HeyUpHere   N/A 2129 {   N/A 2130        GladosPlayVcd(466)   N/A 2131 }   N/A 2132    N/A 2133 function sp_a1_intro7_YouFoundIt   N/A 2134 {   N/A 2135        EntFire("spherebot_train_1_chassis_1","MoveToPathNode","spherebot_train_1_path_11",8.5)   N/A 2136        GladosPlayVcd(467)   N/A 2137 }   N/A 2138    N/A 2139 function sp_a1_intro7_PopPortal   N/A 2140 {   N/A 2141        if (!sp_a1_intro7_popped)   N/A 2142        {   N/A 2143                GladosPlayVcd(469)   N/A 2144        }          N/A 2145 }   N/A 2146    N/A 2147    N/A 2148 function sp_a1_intro7_PopPortalNag   N/A 2149 {   N/A 2150        if (!sp_a1_intro7_popped)   N/A 2151        {   N/A 2152                GladosPlayVcd(468)   N/A 2153        }   N/A 2154 }   N/A 2155    N/A 2156 function sp_a1_intro7_ComeThroughNag   N/A 2157 {   N/A 2158        if (!sp_a1_intro7_camethrough)   N/A 2159        {   N/A 2160                GladosPlayVcd(470)   N/A 2161        }   N/A 2162 }   N/A 2163    N/A 2164    N/A 2165 function sp_a1_intro7_PoppedAPortal   N/A 2166 {   N/A 2167        EntFire("portal_detector","Disable","",0.0)   N/A 2168        EntFire("@glados","runscriptcode","sp_a1_intro7_ComeThroughNag",4.0)   N/A 2169        WheatleyStopNag   N/A 2170        sp_a1_intro7_popped = true   N/A 2171 }   N/A 2172    N/A 2173 function sp_a1_intro7_JumpToOtherSide   N/A 2174 {   N/A 2175        WheatleyStopNag   N/A 2176        sp_a1_intro7_camethrough = true   N/A 2177 }   N/A 2178    N/A 2179 function sp_a1_intro7_ManagementRail   N/A 2180 {   N/A 2181        //WheatleyStopNag   N/A 2182        GladosPlayVcd(471)   N/A 2183 }   N/A 2184    N/A 2185 function sp_a1_intro7_OnThree   N/A 2186 {   N/A 2187        GladosPlayVcd(472)   N/A 2188 }   N/A 2189    N/A 2190 function sp_a1_intro7_Impact   N/A 2191 {   N/A 2192        GladosPlayVcd(473)   N/A 2193 }   N/A 2194    N/A 2195    N/A 2196 function sp_a1_intro7_NotDeadStart   N/A 2197 {   N/A 2198        sp_a1_intro7_sayingnotdead = true   N/A 2199 }   N/A 2200    N/A 2201 function sp_a1_intro7_NotDeadEnd   N/A 2202 {   N/A 2203        sp_a1_intro7_sayingnotdead = false   N/A 2204        sp_a1_intro7_saidnotdead = true   N/A 2205        if (sp_a1_intro7_pickedup)   N/A 2206        {   N/A 2207                nuke   N/A 2208                GladosPlayVcd(572)   N/A 2209        }   N/A 2210 }   N/A 2211    N/A 2212    N/A 2213 function sp_a1_intro7_PickMeUpNag   N/A 2214 {   N/A 2215        if (!sp_a1_intro7_pickedup)   N/A 2216        {   N/A 2217                GladosPlayVcd(474)   N/A 2218        }   N/A 2219 }   N/A 2220    N/A 2221 function sp_a1_intro7_PickUp   N/A 2222 {   N/A 2223        sp_a1_intro7_pickedup = true   N/A 2224        switch (sp_a1_intro7_pickedupcount)   N/A 2225        {   N/A 2226                case 0:   N/A 2227                        sp_a1_intro7_pickedupcount += 1   N/A 2228                        //before the "I'm not dead!" line has started playing  N/A 2229                        if ((!sp_a1_intro7_sayingnotdead) && (!sp_a1_intro7_saidnotdead))   N/A 2230                        {   N/A 2231                                nuke   N/A 2232                                GladosPlayVcd(571)   N/A 2233                        }   N/A 2234                        else   N/A 2235                        {   N/A 2236                                //the "I'm not dead!" line finished playing before the pickup happened  N/A 2237                                if ( !((!sp_a1_intro7_saidnotdead) && sp_a1_intro7_sayingnotdead))   N/A 2238                                {   N/A 2239                                        WheatleyStopNag   N/A 2240                                        GladosPlayVcd(475)   N/A 2241                                }          N/A 2242                        }          N/A 2243                        break   N/A 2244                case 1:   N/A 2245                        sp_a1_intro7_pickedupcount += 1   N/A 2246                        nuke   N/A 2247                        GladosPlayVcd(577)   N/A 2248                        break   N/A 2249        }          N/A 2250 }   N/A 2251    N/A 2252 function sp_a1_intro7_PlugMeInNag   N/A 2253 {   N/A 2254        if (!sp_a1_intro7_pluggedin)   N/A 2255        {   N/A 2256                GladosPlayVcd(476)   N/A 2257        }   N/A 2258 }   N/A 2259    N/A 2260 function sp_a1_intro7_NoWatching   N/A 2261 {   N/A 2262        sp_a1_intro7_pluggedin = true   N/A 2263        WheatleyStopNag   N/A 2264        GladosPlayVcd(477)   N/A 2265 }   N/A 2266    N/A 2267 function sp_a1_intro7_NoWatchingNag   N/A 2268 {   N/A 2269        if (!sp_a1_intro7_turnedaway)   N/A 2270        {   N/A 2271                GladosPlayVcd(481)   N/A 2272        }   N/A 2273 }   N/A 2274    N/A 2275 function sp_a1_intro7_TurnAroundNow   N/A 2276 {   N/A 2277        sp_a1_intro7_turnedaway = true   N/A 2278        WheatleyStopNag   N/A 2279        GladosPlayVcd(478)   N/A 2280 }   N/A 2281    N/A 2282 function sp_a1_intro7_BamSecretPanel   N/A 2283 {   N/A 2284        sp_a1_intro7_turnedaway = true   N/A 2285        WheatleyStopNag   N/A 2286        GladosPlayVcd(479)   N/A 2287 }   N/A 2288    N/A 2289 function sp_a1_intro7_GloriousFreedom   N/A 2290 {   N/A 2291        GladosPlayVcd(480)   N/A 2292 }   N/A 2293    N/A 2294 function sp_a1_intro7_DontLeaveMeNag   N/A 2295 {   N/A 2296 }   N/A 2297    N/A 2298    N/A 2299    N/A 2300 //--   N/A 2301 //sp_a1_wakeup functions   N/A 2302 //--   N/A 2303    N/A 2304 if (curMapName=="sp_a1_wakeup")   N/A 2305 {   N/A 2306        sp_a1_wakeup_gantryexpositionover <- false   N/A 2307        sp_a1_wakeup_gantryexpositioncounter <- 0   N/A 2308        sp_a1_wakeup_humanexpositionover <- false   N/A 2309        sp_a1_wakeup_In_Breaker_Room <- false   N/A 2310        sp_a1_wakeup_Looked_Down <- false   N/A 2311 }          N/A 2312    N/A 2313 function sp_a1_wakeup_start_map      N/A 2314 {   N/A 2315        GladosPlayVcd(482)   N/A 2316 }   N/A 2317    N/A 2318 function sp_a1_wakeup_gantry_exposition_end   N/A 2319 {   N/A 2320        sp_a1_wakeup_gantryexpositionover = true   N/A 2321 }   N/A 2322    N/A 2323 function sp_a1_wakeup_inside_observation      N/A 2324 {   N/A 2325        if (sp_a1_wakeup_gantryexpositionover)   N/A 2326        {   N/A 2327                sp_a1_wakeup_gantryexpositionover = false   N/A 2328                switch (sp_a1_wakeup_gantryexpositioncounter)   N/A 2329                {   N/A 2330                        case 0:   N/A 2331                                sp_a1_wakeup_gantryexpositioncounter+=1   N/A 2332                                GladosPlayVcd(483)   N/A 2333                                break   N/A 2334                        case 1:   N/A 2335                                sp_a1_wakeup_gantryexpositioncounter+=1   N/A 2336                                GladosPlayVcd(484)   N/A 2337                                break   N/A 2338                        case 2:   N/A 2339                                sp_a1_wakeup_gantryexpositioncounter+=1   N/A 2340                                GladosPlayVcd(485)   N/A 2341                                break   N/A 2342                        case 3:   N/A 2343                                sp_a1_wakeup_gantryexpositioncounter+=1   N/A 2344                                GladosPlayVcd(486)   N/A 2345                                break   N/A 2346                }                  N/A 2347        }   N/A 2348 }   N/A 2349    N/A 2350 function sp_a1_wakeup_gantry_door_open      N/A 2351 {   N/A 2352        GladosPlayVcd(487)   N/A 2353 }   N/A 2354    N/A 2355 function sp_a1_wakeup_there_she_is   N/A 2356 {   N/A 2357                GladosPlayVcd(488)   N/A 2358 }   N/A 2359    N/A 2360 function sp_a1_wakeup_human_exposition_end   N/A 2361 {   N/A 2362        sp_a1_wakeup_gantryexpositionend = true   N/A 2363 }   N/A 2364    N/A 2365 function sp_a1_wakeup_down_the_stairs   N/A 2366 {   N/A 2367                GladosPlayVcd(489)   N/A 2368 }   N/A 2369    N/A 2370 function sp_a1_wakeup_JumpNags   N/A 2371 {   N/A 2372        GladosPlayVcd(581)   N/A 2373 }   N/A 2374    N/A 2375 function sp_a1_wakeup_Falling   N/A 2376 {   N/A 2377        nuke   N/A 2378        GladosPlayVcd(579)   N/A 2379 }   N/A 2380    N/A 2381 function sp_a1_wakeup_Landed   N/A 2382 {   N/A 2383        GladosPlayVcd(580)   N/A 2384 }   N/A 2385    N/A 2386 function sp_a1_wakeup_come_through_here   N/A 2387 {   N/A 2388                if (sp_a1_wakeup_Looked_Down)   N/A 2389                {   N/A 2390                        GladosPlayVcd(586)   N/A 2391                }   N/A 2392 }   N/A 2393    N/A 2394 function sp_a1_wakeup_Do_Not_Look_Down   N/A 2395 {   N/A 2396                GladosPlayVcd(491)   N/A 2397 }   N/A 2398    N/A 2399 function sp_a1_wakeup_Do_Not_Look_Down_Over   N/A 2400 {   N/A 2401        sp_a1_wakeup_Looked_Down = true   N/A 2402        EntFire("@ComeThroughHereTrigger","enable","",0.2)   N/A 2403 }   N/A 2404    N/A 2405    N/A 2406 function sp_a1_wakeup_This_Is_Breaker_Room   N/A 2407 {   N/A 2408                GladosPlayVcd(492)   N/A 2409 }   N/A 2410    N/A 2411 function sp_a1_wakeup_Lets_Go_In   N/A 2412 {   N/A 2413                if (!sp_a1_wakeup_In_Breaker_Room)   N/A 2414                {   N/A 2415                        GladosPlayVcd(585)   N/A 2416                }          N/A 2417 }   N/A 2418    N/A 2419 function sp_a1_wakeup_Do_Not_Touch   N/A 2420 {   N/A 2421                sp_a1_wakeup_In_Breaker_Room = true   N/A 2422                GladosPlayVcd(493)   N/A 2423 }   N/A 2424    N/A 2425 function sp_a1_wakeup_Lights_On   N/A 2426 {   N/A 2427                GladosPlayVcd(494)   N/A 2428 }   N/A 2429    N/A 2430 function sp_a1_wakeup_Oops   N/A 2431 {   N/A 2432        GladosPlayVcd(542)   N/A 2433 }   N/A 2434    N/A 2435 //--   N/A 2436 //Wheatley Elevator Scene (currently after sp_a2_column_blocker)   N/A 2437 //--   N/A 2438    N/A 2439    N/A 2440 function Wheatley_Elevator_Scene_Start   N/A 2441 {   N/A 2442                GladosPlayVcd(495)   N/A 2443 }   N/A 2444    N/A 2445 function Wheatley_Elevator_Scene_Ow   N/A 2446 {   N/A 2447                GladosPlayVcd(496)   N/A 2448 }   N/A 2449    N/A 2450 //--   N/A 2451 //Jailbreak - sp_a2_bts1 & bts2   N/A 2452 //--   N/A 2453    N/A 2454 if (curMapName=="sp_a2_bts1")   N/A 2455 {   N/A 2456        sp_a2_bts1_FakeEntered <- false   N/A 2457 }          N/A 2458    N/A 2459    N/A 2460    N/A 2461 function JailbreakGladosSomethingWrong   N/A 2462 {   N/A 2463        GladosPlayVcd(301)   N/A 2464 }   N/A 2465    N/A 2466 function JailbreakWheatleyHeyLady   N/A 2467 {   N/A 2468        GladosPlayVcd(497)   N/A 2469 }   N/A 2470    N/A 2471 function JailbreakICanHearYou   N/A 2472 {   N/A 2473        nuke   N/A 2474        EntFire( "@sphere", "SetIdleSequence", "sphere_damaged_glance_concerned", 0 )   N/A 2475        GladosPlayVcd(498)   N/A 2476 }   N/A 2477    N/A 2478 function JailbreakWheatleyCloseChamber   N/A 2479 {   N/A 2480        WheatleyStopNag          N/A 2481        GladosPlayVcd(500)   N/A 2482 }   N/A 2483    N/A 2484 function WheatleyKeepMoving   N/A 2485 {   N/A 2486        //WheatleyStopNag          N/A 2487        //GladosPlayVcd(501)   N/A 2488 }   N/A 2489    N/A 2490 function WheatleyGoGoGoNag   N/A 2491 {   N/A 2492        GladosPlayVcd(502)   N/A 2493 }   N/A 2494    N/A 2495 function JailbreakLastTestIntro   N/A 2496 {   N/A 2497        WheatleyStopNag          N/A 2498        GladosPlayVcd(503)   N/A 2499 }   N/A 2500    N/A 2501 function JailbreakLastChamberMain   N/A 2502 {   N/A 2503        WheatleyStopNag          N/A 2504        GladosPlayVcd(504)   N/A 2505 }   N/A 2506    N/A 2507 function JailbreakLastTestDeer   N/A 2508 {   N/A 2509        sp_a2_bts1_FakeEntered = true   N/A 2510        WheatleyStopNag          N/A 2511        GladosPlayVcd(505)   N/A 2512 }   N/A 2513    N/A 2514 function JailBreakHowStupid   N/A 2515 {   N/A 2516        if (!sp_a2_bts1_FakeEntered)   N/A 2517        {   N/A 2518                WheatleyStopNag          N/A 2519                GladosPlayVcd(506)   N/A 2520        }          N/A 2521 }   N/A 2522    N/A 2523 function JailbreakBridgeDisappear   N/A 2524 {   N/A 2525        WheatleyStopNag          N/A 2526        GladosPlayVcd(507)   N/A 2527 }   N/A 2528    N/A 2529 function JailbreakLookOutTurrets   N/A 2530 {   N/A 2531        WheatleyStopNag          N/A 2532        GladosPlayVcd(508)   N/A 2533 }   N/A 2534    N/A 2535 function JailBreak2Trapped   N/A 2536 {   N/A 2537        WheatleyStopNag          N/A 2538        GladosPlayVcd(573)   N/A 2539    N/A 2540 }   N/A 2541    N/A 2542 function JailBreak2Gunfire   N/A 2543 {   N/A 2544        GladosPlayVcd(574)   N/A 2545 }   N/A 2546    N/A 2547 function bts2_wheatley_comeon_prompt   N/A 2548 {   N/A 2549        GladosPlayVcd(587)   N/A 2550 }   N/A 2551    N/A 2552 function JailBreak2AlmostOut   N/A 2553 {   N/A 2554        GladosPlayVcd(575)   N/A 2555 }   N/A 2556    N/A 2557 function JailBreak2BringingDown   N/A 2558 {   N/A 2559        GladosPlayVcd(576)   N/A 2560 }   N/A 2561    N/A 2562 function JailbreakHurryHurry   N/A 2563 {   N/A 2564        WheatleyStopNag          N/A 2565        GladosPlayVcd(509)   N/A 2566 }   N/A 2567    N/A 2568 function JailbreakGetInTheLift   N/A 2569 {   N/A 2570        WheatleyStopNag          N/A 2571        GladosPlayVcd(510)   N/A 2572 }   N/A 2573    N/A 2574 function jailbreak_player_in_exit_elevator   N/A 2575 {   N/A 2576        WheatleyStopNag          N/A 2577        GladosPlayVcd(511)   N/A 2578 }   N/A 2579    N/A 2580 function Jailbreak2ThisWay   N/A 2581 {   N/A 2582        WheatleyStopNag          N/A 2583        GladosPlayVcd(512)   N/A 2584 }   N/A 2585    N/A 2586 function JailbreakGoGo   N/A 2587 {   N/A 2588        WheatleyStopNag          N/A 2589        GladosPlayVcd(513)   N/A 2590 }   N/A 2591    N/A 2592 function JailbreakComeOnComeOn   N/A 2593 {   N/A 2594        WheatleyStopNag          N/A 2595        GladosPlayVcd(514)   N/A 2596 }   N/A 2597    N/A 2598    N/A 2599 //--   N/A 2600 //Turret Factory -- sp_a2_bts4   N/A 2601 //--   N/A 2602    N/A 2603 if (curMapName=="sp_a2_bts4")   N/A 2604 {   N/A 2605        sp_a2_bts4_StillThinkingNagStage <- 0   N/A 2606        sp_a2_bts4_StillThinkingNagOK <- false   N/A 2607        sp_a2_bts4_StillThinkingNagIdx <- 0   N/A 2608        sp_a2_bts4_StillThinkingNagTime <- 0   N/A 2609        sp_a2_bts4_MentionedSwap <- false   N/A 2610        sp_a2_bts4_At_Window <- false   N/A 2611        sp_a2_bts4_At_Big_Potato <- false   N/A 2612        sp_a2_bts4_At_Volcano <- false   N/A 2613        sp_a2_bts4_Intro_Talking <- false   N/A 2614        sp_a2_bts4_Science_Fair_Busy <- false   N/A 2615        sp_a2_bts4_Did_Big_Potato <- false   N/A 2616        sp_a2_bts4_Did_Volcano <- 0   N/A 2617    N/A 2618 }          N/A 2619    N/A 2620    N/A 2621 function FactoryWheatleyHey   N/A 2622 {   N/A 2623        GladosPlayVcd(515)   N/A 2624 }   N/A 2625    N/A 2626 function FactoryFollowMe   N/A 2627 {   N/A 2628        GladosPlayVcd(516)   N/A 2629 }   N/A 2630    N/A 2631 function FactoryAlmostThere   N/A 2632 {   N/A 2633        GladosPlayVcd(518)   N/A 2634 }   N/A 2635    N/A 2636    N/A 2637 function FactoryTahDah   N/A 2638 {   N/A 2639        GladosPlayVcd(517)   N/A 2640 }   N/A 2641    N/A 2642 function FactoryScannerIntro   N/A 2643 {   N/A 2644        sp_a2_bts4_At_Window = true   N/A 2645        if (!sp_a2_bts4_Intro_Talking)   N/A 2646        {   N/A 2647                GladosPlayVcd(519)   N/A 2648        }   N/A 2649 }   N/A 2650    N/A 2651 function FactoryScannerSpeech   N/A 2652 {   N/A 2653        GladosPlayVcd(519)   N/A 2654 }   N/A 2655    N/A 2656 function FactoryCheckAtWindowEnd   N/A 2657 {   N/A 2658        sp_a2_bts4_Intro_Talking = false   N/A 2659        if (sp_a2_bts4_At_Window)   N/A 2660        {   N/A 2661                FactoryScannerSpeech   N/A 2662        }   N/A 2663 }   N/A 2664    N/A 2665 function FactoryCheckAtWindowStart   N/A 2666 {   N/A 2667        sp_a2_bts4_Intro_Talking = true   N/A 2668        if (sp_a2_bts4_At_Window)   N/A 2669        {   N/A 2670                FactoryScannerSpeech   N/A 2671        }   N/A 2672 }   N/A 2673    N/A 2674    N/A 2675 function FactoryControlDoorHackIntro   N/A 2676 {   N/A 2677        GladosPlayVcd(520)   N/A 2678 }   N/A 2679    N/A 2680 function FactoryControlRoomHackSuccess   N/A 2681 {   N/A 2682        WheatleyStopNag          N/A 2683        GladosPlayVcd(521)   N/A 2684 }   N/A 2685    N/A 2686 function FactoryFirstTurretTaken   N/A 2687 {   N/A 2688        WheatleyStopNag          N/A 2689        GladosPlayVcd(522)   N/A 2690 }   N/A 2691    N/A 2692 function FactoryFirstTurretPulled   N/A 2693 {   N/A 2694        //WheatleyStopNag          N/A 2695        //GladosPlayVcd(522)   N/A 2696 }   N/A 2697    N/A 2698    N/A 2699 function FactoryEnableThinkingNag   N/A 2700 {   N/A 2701        printldebug("%%%%%%%%%%%%%%%%ENABLE STILL THINKING NAG")   N/A 2702        sp_a2_bts4_StillThinkingNagOK = true   N/A 2703 }   N/A 2704    N/A 2705 function FactoryDisableThinkingNag   N/A 2706 {   N/A 2707        printldebug("%%%%%%%%%%%%%%%%DISABLE STILL THINKING NAG")   N/A 2708        sp_a2_bts4_StillThinkingNagOK = false   N/A 2709 }   N/A 2710    N/A 2711 function FactoryStillThinkingNag   N/A 2712 {   N/A 2713        printldebug("%%%%%%%%%%%%%%%%STILL THINKING NAG")   N/A 2714        switch (sp_a2_bts4_StillThinkingNagStage)   N/A 2715        {   N/A 2716                case 0:   N/A 2717                        if (!sp_a2_bts4_StillThinkingNagOK)   N/A 2718                        {   N/A 2719                                return   N/A 2720                        }   N/A 2721                        if (!(characterCurscene("wheatley")==null))   N/A 2722                        {   N/A 2723                                sp_a2_bts4_StillThinkingNagTime = Time   N/A 2724                                return   N/A 2725                        }          N/A 2726                        if (Time-sp_a2_bts4_StillThinkingNagTime > 5 && RandomInt(1,100) > 50)   N/A 2727                        {   N/A 2728                                sp_a2_bts4_StillThinkingNagIdx+=1   N/A 2729                                sp_a2_bts4_StillThinkingNagTime=Time   N/A 2730                                switch (sp_a2_bts4_StillThinkingNagIdx)   N/A 2731                                {   N/A 2732                                        case 1:   N/A 2733                                                GladosPlayVcd(523)   N/A 2734                                                break   N/A 2735                                        case 2:   N/A 2736                                                GladosPlayVcd(524)   N/A 2737                                                break   N/A 2738                                        case 3:   N/A 2739                                                GladosPlayVcd(525)   N/A 2740                                                break   N/A 2741                                        case 4:   N/A 2742                                                GladosPlayVcd(526)   N/A 2743                                                break   N/A 2744                                        case 5:   N/A 2745                                                GladosPlayVcd(527)   N/A 2746                                                break   N/A 2747                                        case 6:   N/A 2748                                                GladosPlayVcd(528)   N/A 2749                                                break   N/A 2750                                        case 7:   N/A 2751                                                sp_a2_bts4_MentionedSwap = true   N/A 2752                                                GladosPlayVcd(529)   N/A 2753                                                break   N/A 2754                                        case 8:   N/A 2755                                                sp_a2_bts4_MentionedSwap = true   N/A 2756                                                GladosPlayVcd(530)   N/A 2757                                                break   N/A 2758                                        default:   N/A 2759                                                sp_a2_bts4_MentionedSwap = true   N/A 2760                                                GladosPlayVcd(531)   N/A 2761                                                break   N/A 2762                                }   N/A 2763                        }   N/A 2764                        break   N/A 2765                case 1:   N/A 2766        }   N/A 2767 }          N/A 2768    N/A 2769    N/A 2770 function FactoryWhereAreYouGoing   N/A 2771 {   N/A 2772        if (!sp_a2_bts4_MentionedSwap)   N/A 2773        {   N/A 2774                GladosPlayVcd(532)   N/A 2775        }   N/A 2776 }   N/A 2777    N/A 2778 function FactoryWhereAreYouGoingTwo   N/A 2779 {   N/A 2780        if (!sp_a2_bts4_MentionedSwap)   N/A 2781        {   N/A 2782                GladosPlayVcd(533)   N/A 2783        }          N/A 2784 }   N/A 2785    N/A 2786    N/A 2787 function FactoryBroughtBackDefectiveTurret   N/A 2788 {   N/A 2789        printldebug("$$$$$$$$$$$$$CRAP TURRET TRIGGER")   N/A 2790        sp_a2_bts4_StillThinkingNagStage = 2   N/A 2791        if (sp_a2_bts4_MentionedSwap)   N/A 2792        {   N/A 2793                GladosPlayVcd(535)   N/A 2794        }   N/A 2795        else   N/A 2796        {   N/A 2797                GladosPlayVcd(534)   N/A 2798        }   N/A 2799 }   N/A 2800    N/A 2801 function FactoryWheatleyShoutout   N/A 2802 {   N/A 2803        if (!sp_a2_bts4_MentionedSwap)   N/A 2804        {   N/A 2805                GladosPlayVcd(541)   N/A 2806        }   N/A 2807 }   N/A 2808    N/A 2809 function FactoryEnterScannerRoomWithTurret   N/A 2810 {   N/A 2811        if (!sp_a2_bts4_MentionedSwap)   N/A 2812        {   N/A 2813                GladosPlayVcd(540)   N/A 2814        }   N/A 2815 }   N/A 2816    N/A 2817 function FactorySuccess   N/A 2818 {   N/A 2819        sp_a2_bts4_StillThinkingNagStage = 2   N/A 2820        if (sp_a2_bts4_MentionedSwap)   N/A 2821        {   N/A 2822                GladosPlayVcd(539)   N/A 2823        }   N/A 2824        else   N/A 2825        {   N/A 2826                GladosPlayVcd(538)   N/A 2827        }   N/A 2828 }   N/A 2829    N/A 2830    N/A 2831 function ScienceFairBusy   N/A 2832 {   N/A 2833        sp_a2_bts4_Science_Fair_Busy = true   N/A 2834 }   N/A 2835    N/A 2836 function ScienceFairNotBusy   N/A 2837 {   N/A 2838        sp_a2_bts4_Science_Fair_Busy = false   N/A 2839        if (sp_a2_bts4_At_Volcano)   N/A 2840        {   N/A 2841                PlayerNearScienceFairVolcano   N/A 2842                return   N/A 2843        }   N/A 2844        if (sp_a2_bts4_At_Big_Potato)   N/A 2845        {   N/A 2846                PlayerLookingAtScienceFairPotato   N/A 2847                return   N/A 2848        }   N/A 2849 }   N/A 2850    N/A 2851    N/A 2852 function PlayerNearScienceFairVolcano   N/A 2853 {   N/A 2854        sp_a2_bts4_At_Volcano = true   N/A 2855        if (!sp_a2_bts4_Science_Fair_Busy)   N/A 2856        {   N/A 2857                switch (sp_a2_bts4_Did_Volcano)   N/A 2858                {   N/A 2859                        case 0:   N/A 2860                                sp_a2_bts4_Did_Volcano = 1   N/A 2861                                GladosPlayVcd(583)   N/A 2862                                break   N/A 2863                        case 1:   N/A 2864                                sp_a2_bts4_Did_Volcano = 2   N/A 2865                                GladosPlayVcd(584)   N/A 2866                                break   N/A 2867                }                  N/A 2868        }          N/A 2869 }          N/A 2870    N/A 2871 function PlayerLeavingScienceFairVolcano   N/A 2872 {   N/A 2873        sp_a2_bts4_At_Volcano = false   N/A 2874 }   N/A 2875    N/A 2876    N/A 2877 function PlayerLookingAtScienceFairPotato // fires once player looks at potato plant   N/A 2878 {   N/A 2879        sp_a2_bts4_At_Big_Potato = true   N/A 2880        if (!sp_a2_bts4_Science_Fair_Busy)   N/A 2881        {   N/A 2882                if (!sp_a2_bts4_Did_Big_Potato)   N/A 2883                {   N/A 2884                        sp_a2_bts4_Did_Big_Potato = true   N/A 2885                        GladosPlayVcd(582)   N/A 2886                }          N/A 2887        }          N/A 2888 }   N/A 2889    N/A 2890    N/A 2891 function PlayerNotLookingAtScienceFairPotato // fires if player looks away from plant after looking at it   N/A 2892 {   N/A 2893                sp_a2_bts4_At_Big_Potato = false   N/A 2894 }   N/A 2895    N/A 2896    N/A 2897 //--   N/A 2898 // BTS4 conveyor turret functions   N/A 2899 //--   N/A 2900    N/A 2901 // ========================================================   N/A 2902 // Called when the player gets near the turret for the first time   N/A 2903 // ========================================================   N/A 2904    N/A 2905 if (curMapName=="sp_a2_bts4")   N/A 2906 {   N/A 2907        sp_a2_bts4_redemption_turret_held <- false   N/A 2908        sp_a2_bts4_redemption_turret_babble_index <- 0   N/A 2909        sp_a2_bts4_redemption_turret_babbling <- false   N/A 2910 }          N/A 2911    N/A 2912    N/A 2913 function SabotageFactoryRecycledTurretNoticesPlayer   N/A 2914 {   N/A 2915        GladosPlayVcd(439, null, "conveyor_turret_body")   N/A 2916 }   N/A 2917    N/A 2918    N/A 2919 // ========================================================   N/A 2920 // SP_A2_BTS4 ACHIEVEMENT - ACH.SAVE_REDEMPTION_TURRET   N/A 2921 // ========================================================   N/A 2922 function bts4_redemption_line_turret_achievement   N/A 2923 {          N/A 2924        // award achievement after turret is done speaking   N/A 2925        EntFire("achievement_redemption_line", "fireevent", 0, 0 )   N/A 2926 }   N/A 2927    N/A 2928 // ========================================================   N/A 2929 // Called every time the turret is picked up   N/A 2930 // ========================================================   N/A 2931 function bts4_redemption_line_turret_pickup   N/A 2932 {   N/A 2933        sp_a2_bts4_redemption_turret_held = true   N/A 2934        if (!sp_a2_bts4_redemption_turret_babbling)   N/A 2935        {   N/A 2936                GladosPlayVcd(614, null, "conveyor_turret_body")   N/A 2937        }          N/A 2938 }   N/A 2939    N/A 2940 // ========================================================   N/A 2941 // Called every time the turret is dropped   N/A 2942 // NOTE: when turret gets fizzled it is also dropped   N/A 2943 // so this function will get called   N/A 2944 // ========================================================   N/A 2945 function bts4_redemption_line_turret_drop   N/A 2946 {   N/A 2947        sp_a2_bts4_redemption_turret_held = false   N/A 2948 }   N/A 2949    N/A 2950 function bts4_redemption_line_turret_babble_start   N/A 2951 {   N/A 2952        sp_a2_bts4_redemption_turret_babbling = true   N/A 2953 }   N/A 2954    N/A 2955 function bts4_redemption_line_turret_babble_end   N/A 2956 {   N/A 2957        local dly = RandomInt(2,5)   N/A 2958        sp_a2_bts4_redemption_turret_babbling = false   N/A 2959        if (sp_a2_bts4_redemption_turret_held)   N/A 2960        {   N/A 2961                EntFire("@glados","runscriptcode","bts4_redemption_line_turret_babble",dly)   N/A 2962        }   N/A 2963 }   N/A 2964    N/A 2965    N/A 2966 function bts4_redemption_line_turret_babble   N/A 2967 {   N/A 2968        if (!sp_a2_bts4_redemption_turret_babbling)   N/A 2969        {   N/A 2970                if (sp_a2_bts4_redemption_turret_held)   N/A 2971                {   N/A 2972                        if (sp_a2_bts4_redemption_turret_babble_index < 8)   N/A 2973                        {   N/A 2974                                sp_a2_bts4_redemption_turret_babble_index+=1   N/A 2975                                GladosPlayVcd(614+sp_a2_bts4_redemption_turret_babble_index, null, "conveyor_turret_body")   N/A 2976                        }          N/A 2977                }   N/A 2978        }          N/A 2979 }   N/A 2980    N/A 2981    N/A 2982 // ========================================================   N/A 2983 // Called if turret is not saved and goes through conveyor exit   N/A 2984 // ========================================================   N/A 2985 function bts4_redemption_line_turret_not_saved   N/A 2986 {   N/A 2987        GladosCharacterStopScene("conveyor_turret_body")   N/A 2988        GladosPlayVcd(613, null, "conveyor_turret_body")   N/A 2989 }   N/A 2990    N/A 2991 // ========================================================   N/A 2992 // Called if player and turret are approaching the fizzler   N/A 2993 // NOTE: if the player leaves and comes back this could be triggered   N/A 2994 // again! N/A 2995 // ========================================================  N/A 2996 function bts4_redemption_line_fizzler_approach   N/A 2997 {   N/A 2998    N/A 2999 }   N/A 3000    N/A 3001 // ========================================================   N/A 3002 // Called if turret gets fizzled   N/A 3003 // ========================================================   N/A 3004 function bts4_redemption_line_turret_fizzled          N/A 3005 {   N/A 3006        GladosCharacterStopScene("conveyor_turret_body")   N/A 3007        GladosPlayVcd(613, null, "conveyor_turret_body")   N/A 3008 }   N/A 3009    N/A 3010 // ========================================================   N/A 3011 // Called when player gets into dummy shoot area   N/A 3012 // ========================================================   N/A 3013 function bts4_redemption_line_turret_safe   N/A 3014 {   N/A 3015    N/A 3016 }   N/A 3017    N/A 3018    N/A 3019    N/A 3020 //--   N/A 3021 //Turret Factory -- sp_a2_intro - incinerator   N/A 3022 //--   N/A 3023    N/A 3024 function sp_a2_intro_SecondSpeech   N/A 3025 {   N/A 3026        if (characterCurscene("glados")==null)   N/A 3027        {   N/A 3028                GladosPlayVcd(206)   N/A 3029        }   N/A 3030        else   N/A 3031        {   N/A 3032                GladosPlayVcd(543)   N/A 3033        }   N/A 3034 }   N/A 3035    N/A 3036 function sp_a2_intro_ClearArms   N/A 3037 {   N/A 3038        if (characterCurscene("glados")==null)   N/A 3039        {   N/A 3040                GladosPlayVcd(208)   N/A 3041        }   N/A 3042        else   N/A 3043        {   N/A 3044                GladosPlayVcd(544)   N/A 3045        }   N/A 3046 }   N/A 3047    N/A 3048    N/A 3049    N/A 3050    N/A 3051 //--   N/A 3052 //sp_a1_intro1   N/A 3053 //--   N/A 3054    N/A 3055 if (curMapName=="sp_a1_intro1")   N/A 3056 {   N/A 3057        sp_a1_intro1_fizzler_triggered <- false   N/A 3058        sp_a1_intro1_fizzler_said <- false   N/A 3059        sp_a1_intro1_fizzler_passed <- false   N/A 3060 }   N/A 3061    N/A 3062 function sp_a1_intro1_fizzler_intro   N/A 3063 {   N/A 3064        sp_a1_intro1_fizzler_triggered = true   N/A 3065        if (characterCurscene("glados")==null)   N/A 3066        {   N/A 3067                sp_a1_intro1_fizzler_said = true   N/A 3068                GladosPlayVcd(553)   N/A 3069        }   N/A 3070 }   N/A 3071    N/A 3072 function sp_a1_intro1_fizzler_passed   N/A 3073 {   N/A 3074        if (!sp_a1_intro1_fizzler_said)   N/A 3075        {   N/A 3076                sp_a1_intro1_fizzler_passed = true   N/A 3077                if (characterCurscene("glados")==null)   N/A 3078                {   N/A 3079                        sp_a1_intro1_fizzler_said = true   N/A 3080                        GladosPlayVcd(630)   N/A 3081                }   N/A 3082        }   N/A 3083 }   N/A 3084    N/A 3085 function sp_a1_intro1_fizzler_test   N/A 3086 {   N/A 3087        if (sp_a1_intro1_fizzler_triggered && !sp_a1_intro1_fizzler_said)   N/A 3088        {   N/A 3089                sp_a1_intro1_fizzler_said = true   N/A 3090                if (sp_a1_intro1_fizzler_passed)   N/A 3091                {   N/A 3092                        GladosPlayVcd(630)   N/A 3093                }   N/A 3094                else   N/A 3095                {   N/A 3096                        GladosPlayVcd(553)   N/A 3097                }          N/A 3098        }   N/A 3099 }   N/A 3100    N/A 3101 //--   N/A 3102 //sp_a1_intro3   N/A 3103 //--   N/A 3104    N/A 3105 //Triggers when you drop into the "Mind the Gap" puzzle   N/A 3106 function sp_a1_intro3_turret_live_fire   N/A 3107 {   N/A 3108        GladosPlayVcd(623)   N/A 3109 }   N/A 3110    N/A 3111    N/A 3112 //--   N/A 3113 //sp_a1_intro6   N/A 3114 //--   N/A 3115    N/A 3116 function sp_a1_intro6_PuzzleOneCompleted   N/A 3117 {   N/A 3118        printldebug("Insert puzzle 1 completed dialog here.")   N/A 3119 }   N/A 3120    N/A 3121    N/A 3122    N/A 3123 //--   N/A 3124 //sp_a2_fizzler_training   N/A 3125 //--   N/A 3126 function sp_a2_fizzler_training_Have_To_Go   N/A 3127 {   N/A 3128        GladosPlayVcd(546)   N/A 3129 }   N/A 3130    N/A 3131 //--   N/A 3132 //sp_a4_turret_tbeam functions   N/A 3133 //--   N/A 3134    N/A 3135 function Finale02_turret_tbeam_abort1   N/A 3136 {   N/A 3137        GladosPlayVcd(556)   N/A 3138 }   N/A 3139    N/A 3140 function Finale02_turret_tbeam_2   N/A 3141 {   N/A 3142        GladosPlayVcd(557)   N/A 3143 }   N/A 3144    N/A 3145 function Finale02_turret_tbeam_abort2   N/A 3146 {   N/A 3147        GladosPlayVcd(558)   N/A 3148 }   N/A 3149    N/A 3150 function Finale02_turret_tbeam_3   N/A 3151 {   N/A 3152        GladosPlayVcd(559)   N/A 3153 }   N/A 3154    N/A 3155 function Finale02_turret_tbeam_abort3   N/A 3156 {   N/A 3157        GladosPlayVcd(560)   N/A 3158 }   N/A 3159    N/A 3160 //stub function from co-op   N/A 3161 function BotDeath(arg,arg2)   N/A 3162 {   N/A 3163 }   N/A 3164    N/A 3165 //sp_a1_intro6_first half of chamber   N/A 3166 function MidpointPuzzleCompleted   N/A 3167 {   N/A 3168        GladosPlayVcd(626)   N/A 3169 }   N/A 3170    N/A 3171    N/A 3172    N/A 3173 //--   N/A 3174 // Control Potatos light   N/A 3175 //--   N/A 3176    N/A 3177 function PotatosTurnOff   N/A 3178 {   N/A 3179        GetPlayer.TurnOffPotatos;   N/A 3180 }   N/A 3181    N/A 3182 function PotatosTurnOn   N/A 3183 {   N/A 3184        GetPlayer.TurnOnPotatos;   N/A 3185 }   N/A 3186    N/A 3187