DBG <- 1 FORCE_GUN_AND_HALLWAY <- 0 // Maps here don't have to be in MapPlayOrder CHAPTER_TITLES <- [ { map = "sp_fizzled_panels", title_text = "3 Maps by soptipp1", subtitle_text = "Fizzled Panels", displayOnSpawn = true, displaydelay = 1.0 }, { map = "sp_enrichment_1", title_text = "3 Maps by lpfreaky90", subtitle_text = "Enrichment", displayOnSpawn = true, displaydelay = 1.0 }, { map = "sp_edifice", title_text = "by Omnicoder", subtitle_text = "Edifice", displayOnSpawn = true, displaydelay = 1.0 }, ] // Display the chapter title on spawn if it is flagged to show up on spawn function TryDisplayChapterTitle() { printl("TryDisplayChapterTitle()") foreach (index, level in CHAPTER_TITLES) { if (level.map == GetMapName() && level.displayOnSpawn ) { printl( "Display Title" + level.title_text + " Subtitle " + level.subtitle_text ) EntFire( "@chapter_title_text", "SetTextColor2", "50 90 116 128", 0.0 ) EntFire( "@chapter_title_text", "SetPosY", "0.32", 0.0 ) EntFire( "@chapter_title_text", "SetText", level.title_text, 0.0 ) EntFire( "@chapter_title_text", "display", "", level.displaydelay ) EntFire( "@chapter_title_text", "SetTextColor", "210 210 210 128", 0.0 ) EntFire( "@chapter_subtitle_text", "SetTextColor", "210 210 210 128", 0.0 ) EntFire( "@chapter_subtitle_text", "SetTextColor2", "50 90 116 128", 0.0 ) EntFire( "@chapter_subtitle_text", "SetPosY", "0.35", 0.0 ) EntFire( "@chapter_subtitle_text", "settext", level.subtitle_text, 0.0 ) EntFire( "@chapter_subtitle_text", "display", "", level.displaydelay ) } } } initialized <- false // This is the order to play the maps // end_of_playtest allows multiple series of maps to exit in the middle // portalgun = "NOGUN", "ONEGUN", "TWOGUN", "POTATOGUN" MapPlayOrder<- [ { name = "sp_fizzled_panels", end_of_playtest = false, portalgun = "TWOGUN" }, { name = "sp_fizzled_panels_ch2", end_of_playtest = false, portalgun = "TWOGUN" }, { name = "sp_fizzled_panels_ch3", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "sp_enrichment_1", end_of_playtest = false, portalgun = "TWOGUN" }, { name = "sp_enrichment_2", end_of_playtest = false, portalgun = "TWOGUN" }, { name = "sp_enrichment_3", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "sp_attc", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "nys1", end_of_playtest = false, portalgun = "TWOGUN" }, { name = "nys2", end_of_playtest = false, portalgun = "TWOGUN" }, { name = "nys3", end_of_playtest = false, portalgun = "TWOGUN" }, { name = "nys4", end_of_playtest = false, portalgun = "TWOGUN" }, { name = "nys5", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "aperturescienceflingtest", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "the_room_v2", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "sp_aly_crushers008", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "sp_madness_1", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "sp_portal_raider_toxic_b2", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "sp_andro_strain_v1_3", end_of_playtest = true, portalgun = "TWOGUN" }, { name = "sp_chander_test_05", end_of_playtest = true, portalgun = "TWOGUN" }, ] // -------------------------------------------------------- // OnPostTransition - we just transitioned, teleport us to the correct place. // -------------------------------------------------------- function OnPostTransition() { local foundMap = false foreach (index, map in MapPlayOrder) { if (GetMapName() == MapPlayOrder[index].name) { foundMap = false // hook up our entry elevator if( index - 1 >= 0 ) { if( MapPlayOrder[index-1].name.find("@") == null ) { printl( "Teleporting to default start pos" ) EntFire( "@elevator_entry_teleport", "Teleport", 0, 0 ) EntFire( "@arrival_teleport", "Teleport", 0, 0 ) } else { printl( "Trying to teleport to " + MapPlayOrder[index - 1].name + "_teleport" ) EntFire( MapPlayOrder[index - 1].name + "_entry_teleport", "Teleport", 0, 0.0 ) } } break } } if (foundMap == false ) { EntFire( "@elevator_entry_teleport", "Teleport", 0, 0 ) EntFire( "@arrival_teleport", "Teleport", 0, 0 ) } } // -------------------------------------------------------- // Think // -------------------------------------------------------- function Think() { if (initialized) { return } initialized = true DumpMapList() local portalGunCommand = "" local portalGunSecondCommand = "" local foundMap = false foreach (index, map in MapPlayOrder) { if (GetMapName() == MapPlayOrder[index].name) { if (MapPlayOrder[index].portalgun == "ONEGUN") { portalGunCommand = "give_portalgun" } else if (MapPlayOrder[index].portalgun == "TWOGUN") { portalGunCommand = "give_portalgun" portalGunSecondCommand = "upgrade_portalgun" } else if (MapPlayOrder[index].portalgun == "POTATOGUN") { portalGunCommand = "give_portalgun" portalGunSecondCommand = "upgrade_potatogun" } break } } TryDisplayChapterTitle() if (portalGunCommand != "" ) { printl( "=======================Trying to run " + portalGunCommand ) EntFire( "command", "Command", portalGunCommand, 0.0 ) EntFire( "@command", "Command", portalGunCommand, 0.0 ) } if (portalGunSecondCommand != "") { printl( "=======================Trying to run " + portalGunSecondCommand ) EntFire( "command", "Command", portalGunSecondCommand, 0.1 ) EntFire( "@command", "Command", portalGunSecondCommand, 0.1 ) } } // -------------------------------------------------------- // DumpMapList // -------------------------------------------------------- function DumpMapList() { if(DBG) { local mapcount = 0 printl("================DUMPING MAP PLAY ORDER") foreach( index, map in MapPlayOrder ) { // weed out our transitions if( MapPlayOrder[index].name.find("@") == null ) { if( GetMapName() == MapPlayOrder[index].name ) { printl( mapcount + " " + MapPlayOrder[index].name + " <--- You Are Here" ) } else { printl( mapcount + " " + MapPlayOrder[index].name ) } mapcount++ } } printl( mapcount + " maps total." ) printl("================END DUMP") } } // -------------------------------------------------------- // TransitionFromMap // -------------------------------------------------------- function TransitionFromMap() { local next_map = null local end_of_playtest = false foreach( index, map in MapPlayOrder ) { if( GetMapName() == MapPlayOrder[index].name ) { // make good local skipIndex = index for(local i=0;i<2;i+=1) { if( skipIndex + 1 < MapPlayOrder.len() ) { if( MapPlayOrder[skipIndex + 1].name.find("@") != null ) { skipIndex++ } else { break } } } if( ( skipIndex + 1 < MapPlayOrder.len() ) && !map.end_of_playtest ) { next_map = MapPlayOrder[ skipIndex + 1 ].name if(DBG) printl( "Map " + GetMapName() + " connects to " + next_map ) if ( Entities.FindByName( null, "@changelevel" ) == null ) { if(DBG) printl( "('@changelevel' entity missing, using 'map' command instead)" ) SendToConsole( "map " + next_map ); } else { EntFire( "@changelevel", "Changelevel", next_map, 0.0 ) } } end_of_playtest = map.end_of_playtest break } } if ( next_map == null || end_of_playtest ) { if(DBG) printl( "Map " + GetMapName() + " is the last map" ) EntFire( "end_of_playtest_text", "display", 0 ) EntFire( "@end_of_playtest_text", "display", 0 ) EntFire( "@command", "Command", "disconnect", 5.0 ) } printl( "" ) } // this lets the elevator know that we are ready to transition. function TransitionReady() { ::TransitionReady <- 1 }