Template:PatchDiff/October 4, 2011 Patch/update/scripts/vscripts/transitions/sp elevator motifs.nut

N/A 1 ElevatorMotifs <-  N/A 2 [   N/A 3        { map = "sp_a1_intro1", speed = 200 },   N/A 4        { map = "sp_a1_intro2", speed = 200 },        // this is what we do for continual elevator shafts   N/A 5        { map = "sp_a1_intro3", speed = 200 },        // this is what we do for continual elevator shafts   N/A 6        { map = "sp_a1_intro5", speed = 200 },        // this is what we do for continual elevator shafts   N/A 7        { map = "sp_a1_intro6", speed = 200 },        // this is what we do for continual elevator shafts   N/A 8        { map = "sp_a2_bridge_intro", speed = 200  },   N/A 9 //        { map = "sp_a2_laser_over_goo", speed = 300, motifs = [ "@shaft_stoppage_1", "transition", ] },   N/A 10        { map = "sp_a2_column_blocker", speed = 200 },   N/A 11        { map = "sp_a2_trust_fling", speed = 300 },   N/A 12    N/A 13    N/A 14        { map = "sp_a2_intro", speed = 125 },          N/A 15        { map = "sp_a2_laser_intro", speed = 200 },   N/A 16        { map = "sp_a2_laser_stairs", speed = 200 },   N/A 17        { map = "sp_a2_dual_lasers", speed = 200 },   N/A 18        { map = "sp_a2_catapult_intro", speed = 200 },   N/A 19        { map = "sp_a2_pit_flings", speed = 200 },   N/A 20 //        { map = "sp_a2_fizzler_intro", speed = 200 },   N/A 21        { map = "sp_a2_sphere_peek", speed = 200 },   N/A 22        { map = "sp_a2_ricochet", speed = 200 },   N/A 23        { map = "sp_a2_bridge_the_gap", speed = 200},   N/A 24        { map = "sp_a2_turret_intro", speed = 200 },   N/A 25        { map = "sp_a2_laser_relays", speed = 200 },   N/A 26        { map = "sp_a2_turret_blocker", speed = 200 },   N/A 27        { map = "sp_a2_laser_vs_turret", speed = 200 },   N/A 28        { map = "sp_a2_pull_the_rug", speed = 200 },   N/A 29        { map = "sp_a2_ring_around_turrets", speed = 200 },   N/A 30        { map = "sp_a2_laser_chaining", speed = 200 },   N/A 31        { map = "sp_a2_triple_laser", speed = 200 },   N/A 32        { map = "sp_a3_jump_intro", speed = 120 },   N/A 33        { map = "sp_a3_bomb_flings", speed = 120 },   N/A 34        { map = "sp_a3_crazy_box", speed = 120 },   N/A 35        { map = "sp_a3_speed_ramp", speed = 120 },   N/A 36        { map = "sp_a3_speed_flings", speed = 120 },   N/A 37        { map = "sp_a4_intro", speed = 200 },   N/A 38        { map = "sp_a4_tb_intro", speed = 200 },   N/A 39        { map = "sp_a4_tb_trust_drop", speed = 200 },   N/A 40        { map = "sp_a4_tb_wall_button", speed = 200 },   N/A 41        { map = "sp_a4_tb_polarity", speed = 200 },   N/A 42        { map = "sp_a4_tb_catch", speed = 100 },   N/A 43        { map = "sp_a4_stop_the_box", speed = 200 },   N/A 44        { map = "sp_a4_laser_catapult", speed = 200 },   N/A 45        { map = "sp_a4_speed_tb_catch", speed = 200 },   N/A 46        { map = "sp_a4_jump_polarity", speed = 200 },   N/A 47 ]   N/A 48    N/A 49 function StartMoving   N/A 50 {   N/A 51        try   N/A 52        {   N/A 53                TryDLC1InstalledOrCatch   N/A 54                SendToConsole( "map_wants_save_disable 1" )   N/A 55        }   N/A 56        catch (e)   N/A 57        {   N/A 58                printl( "=======================Riding elevator not installed fall through." )  N/A 59        }   N/A 60    N/A 61        local foundLevel = false   N/A 62    N/A 63        foreach (index, level in ElevatorMotifs)   N/A 64        {   N/A 65                if (level.map == GetMapName && ("speed" in level) )   N/A 66                {   N/A 67                        printl( "Starting elevator " + self.GetName + " with speed " + level.speed )   N/A 68                        EntFire(self.GetName,"SetSpeedReal",level.speed,0.0)   N/A 69                        foundLevel = true   N/A 70                }   N/A 71        }   N/A 72    N/A 73        if (foundLevel == false)   N/A 74        {   N/A 75                printl( "Using default elevator speed 300" )   N/A 76                EntFire(self.GetName,"SetSpeedReal","300",0.0)   N/A 77        }   N/A 78 }   N/A 79    N/A 80 function ReadyForTransition   N/A 81 {   N/A 82        // see if we need to teleport to somewhere else or   N/A 83        PrepareTeleport   N/A 84 }   N/A 85    N/A 86 function FailSafeTransition   N/A 87 {   N/A 88        // fire whichever one of these we have. N/A 89       EntFire("@transition_from_map","Trigger","",0.0)   N/A 90        EntFire("@transition_with_survey","Trigger","",0.0)   N/A 91 }   N/A 92    N/A 93 function PrepareTeleport   N/A 94 {          N/A 95        local foundLevel = false   N/A 96    N/A 97        if ( ::TransitionFired == 1 )   N/A 98                return   N/A 99    N/A 100        foreach (index, level in ElevatorMotifs)   N/A 101        {   N/A 102                if ( level.map == GetMapName )   N/A 103                {   N/A 104                        if ("motifs" in level)   N/A 105                        {   N/A 106                                printl( "Trying to connect to motif " + level.motifs[::MotifIndex] )   N/A 107    N/A 108                                if( level.motifs[::MotifIndex] == "transition" )   N/A 109                                {   N/A 110                                        EntFire("@transition_with_survey","Trigger","",0.0)   N/A 111                                        EntFire("@transition_from_map","Trigger","",0.0)   N/A 112                                        return   N/A 113                                }   N/A 114                                else   N/A 115                                {   N/A 116                                        EntFire(self.GetName,"SetRemoteDestination",level.motifs[::MotifIndex],0.0)   N/A 117                                        if( ::MotifIndex == 0 )   N/A 118                                        {   N/A 119                                                EntFire("departure_elevator-elevator_1","Stop","",0.05)   N/A 120                                        }   N/A 121                                }   N/A 122                                foundLevel = true   N/A 123                        }   N/A 124                        else   N/A 125                        {   N/A 126                                if( ::TransitionReady == 1 )   N/A 127                                {   N/A 128                                        ::TransitionFired <- 1   N/A 129                                        EntFire("@transition_from_map","Trigger","",0.0)   N/A 130                                        EntFire("@transition_with_survey","Trigger","",0.0)   N/A 131                                }   N/A 132                                // just bail, we don't need to do anything weird here. N/A 133                               return;   N/A 134                        }   N/A 135                }   N/A 136        }   N/A 137    N/A 138        if (foundLevel == false)   N/A 139        {   N/A 140 //                printl("**********************************")   N/A 141 //                printl("Level not found in elevator_motifs")   N/A 142 //                printl("**********************************")   N/A 143                {   N/A 144                        ::TransitionFired <- 1   N/A 145                        EntFire("@transition_with_survey","Trigger","",0.0)   N/A 146                        EntFire("@transition_from_map","Trigger","",0.0)   N/A 147                        printl("Level not found in elevator_motifs defaulting to transition")   N/A 148                }   N/A 149    N/A 150                // just bail, we don't need to do anything weird here. N/A 151               return;   N/A 152        }   N/A 153    N/A 154        EntFire(self.GetName,"Enable",0.0)          N/A 155        ::MotifIndex += 1   N/A 156 }   N/A 157    N/A 158 function OnPostSpawn   N/A 159 {   N/A 160        ::MotifIndex <- 0   N/A 161        ::TransitionReady <- 0   N/A 162        ::TransitionFired <- 0   N/A 163 }