// -------------------------------------- // // MAP CONSTRUCTOR by domino54 // // script version: 2015-07-12 // // -------------------------------------- // /** * This plugin GENERATES RANDOM MAP MADAFAKAS!!! */ #RequireContext CEditorPlugin #Include "MathLib" as ML #Const Version "2015-07-12" #Const ScriptName "MapConstructor.Script.txt" // ---------------------------------- // // Constants // ---------------------------------- // // ---------------------------------- // // Generator // ---------------------------------- // #Const C_CheckpointFrequency 6 ///< Default checkpoint apperance frequency #Const C_CurveMaxFrequency 1 ///< Default curve apperance frequency #Const C_PropsMaxFrequency 2 ///< Default props apperance frequency #Const C_STurnMaxFrequency 8 ///< Default s-turn apperance frequency #Const C_DecoChanceSide .875 ///< Default chance of spawning side decoration #Const C_DecoChancePillar .875 ///< Default chance of spawning pillar decoration #Const C_DecoExtraAmount 100 ///< Default amount of extra decoration blocks /// Sizes of the environments #Const C_Dimensions [ "Canyon" => ["Sunrise" => 32, "Day" => 32, "Sunset" => 32, "Night" => 32], "Stadium" => ["Sunrise" => 32, "Day" => 32, "Sunset" => 32, "Night" => 32, "64x64Sunrise" => 64, "64x64Day" => 64, "64x64Sunset" => 64, "64x64Night" => 64], "Valley" => ["Sunrise48" => 48, "Day48" => 48, "Sunset48" => 48, "Night48" => 48] ] // ---------------------------------- // // Blocks // ---------------------------------- // // ---------------------------------- // // Spawn blocks #Const C_BlockModels_Spawn [ // ---------------------------------- // // Canyon "RoadMainStart", // ---------------------------------- // // Stadium "StadiumRoadMainStartLine", // ---------------------------------- // // Valley "Road2WayStart" ] // ---------------------------------- // // Checkpoint blocks #Const C_BlockModels_Checkpoint [ // ---------------------------------- // // Canyon "RoadMainCheckpoint" => [<-1, 0, 0>, <0, 0, 0>], // ---------------------------------- // // Stadium "StadiumRoadMainCheckpoint" => [<-1, 0, 0>, <0, 0, 0>], "StadiumRoadMainCheckpointUp" => [<-1, 0, 0>, <0, 1, 0>], "StadiumRoadMainCheckpointDown" => [<-1, -1, 0>, <0, 0, 0>], // ---------------------------------- // // Valley "Road2WayCheckpoint" => [<-1, 0, 0>, <0, 0, 0>] ] // ---------------------------------- // // Finish blocks #Const C_BlockModels_Finish [ // ---------------------------------- // // Canyon "RoadMainFinish", // ---------------------------------- // // Stadium "StadiumRoadMainFinishLine", // ---------------------------------- // // Valley "Road2WayFinish" ] // ---------------------------------- // // Multilap blocks #Const C_BlockModels_Laps [ // ---------------------------------- // // Canyon "RoadMainMultilap", // ---------------------------------- // // Stadium "StadiumRoadMainStartFinishLine", // ---------------------------------- // // Valley "Road2WayMultilap" ] // ---------------------------------- // // Podium blocks #Const C_BlockModels_Podium [ // ---------------------------------- // // Canyon "Podium", // ---------------------------------- // // Stadium "StadiumPodium", // ---------------------------------- // // Valley "PodiumDirt", "PodiumParking" ] // ---------------------------------- // /** Road curve blocks * * "CurveBlockName" => [, ] */ #Const C_BlockModels_Curve [ // ---------------------------------- // // Canton "RoadMainGTDiag2X2A" => [<-2, 0, 0>, <0, 0, 1>], "RoadMainGTDiag2X2MirrorA" => [<-2, 0, -1>, <0, 0, 0>], "RoadMainGTDiag2X2Down" => [<-2, 0, 0>, <0, 0, 1>], "RoadMainGTDiag2X2DownMirror" => [<-2, 0, -1>, <0, 0, 0>], // ---------------------------------- // // Stadium "StadiumRoadMainGTDiag2x2" => [<-2, 0, 0>, <0, 0, 1>], "StadiumRoadMainGTDiag2x2Mirror" => [<-2, 0, -1>, <0, 0, 0>], "StadiumRoadMainGTDiag3x2" => [<-3, 0, 0>, <0, 0, 1>], "StadiumRoadMainGTDiag3x2Mirror" => [<-3, 0, -1>, <0, 0, 0>], // ---------------------------------- // // Valley "Road2WayDiag2" => [<-2, 0, -1>, <0, 0, 0>], "Road2WayDiag2Mirror" => [<-2, 0, 0>, <0, 0, 1>] ] // ---------------------------------- // /** Road props blocks * * "PropBlockName" => [, ] */ #Const C_BlockModels_Prop [ // ---------------------------------- // // Canyon "RoadMainStraightDown" => [<-1, 0, 0>, <0, 0, 0>], "RoadMainStraightUp" => [<-1, 0, 0>, <0, 0, 0>], "RoadMainTreePineBigStraight" => [<-1, 0, 0>, <0, 0, 0>], // ---------------------------------- // // Stadium "StadiumHolePillar" => [<-1, 0, 0>, <0, 0, 0>], "StadiumHolePillar2Front" => [<-1, 0, 0>, <0, 0, 0>], "StadiumHolePillar2Line" => [<-1, 0, 0>, <0, 0, 0>], "StadiumHolePillar3" => [<-1, 0, 0>, <0, 0, 0>], "StadiumHole" => [<-1, 0, 0>, <0, 0, 0>], "StadiumRoadStretch" => [<-1, 0, 0>, <0, 0, 0>], "StadiumRoadMainSlopeBase" => [<-1, 0, 0>, <0, 1, 0>], "StadiumRoadMainSlopeStraight" => [<-1, 0, 0>, <0, 1, 0>], "StadiumRoadMainSlopeBase1x2" => [<-2, 0, 0>, <0, 1, 0>], "StadiumRoadMainTurboDown" => [<-1, -1, 0>, <0, 0, 0>], "StadiumHolePillarSlope" => [<-1, 0, 0>, <0, 1, 0>], "StadiumHoleSlope" => [<-1, 0, 0>, <0, 1, 0>], "StadiumRoadStretchSlope" => [<-1, 0, 0>, <0, 1, 0>], "StadiumBump1Slope" => [<-1, -1, 0>, <0, 0, 0>], "StadiumTrenchXRoadMain" => [<-1, -1, 0>, <0, 1, 0>], // ---------------------------------- // // Valley "Road2WayWithoutPole" => [<-1, 0, 0>, <0, 0, 0>], "Road2WayWithBirds" => [<-1, 0, 0>, <0, 0, 0>] ] #Const C_BlockModels_STurn [ // ---------------------------------- // // Canyon "RoadMainGTCurve2" => [ ::CardinalDirections::North => [<-1, 0, -2>, <0, 0, 0>], ::CardinalDirections::East => [<-1, 0, 0>, <0, 0, 1>], ::CardinalDirections::South => [<-2, 0, -1>, <0, 0, 0>], ::CardinalDirections::West => [<-2, 0, 0>, <0, 0, 2>] ], // ---------------------------------- // // Stadium "StadiumRoadMainGTCurve2" => [ ::CardinalDirections::North => [<-1, 0, -2>, <0, 0, 0>], ::CardinalDirections::East => [<-1, 0, 0>, <0, 0, 1>], ::CardinalDirections::South => [<-2, 0, -1>, <0, 0, 0>], ::CardinalDirections::West => [<-2, 0, 0>, <0, 0, 2>] ], "StadiumRoadMainGTCurve3" => [ ::CardinalDirections::North => [<-2, 0, -3>, <0, 0, 0>], ::CardinalDirections::East => [<-3, 0, 0>, <0, 0, 2>], ::CardinalDirections::South => [<-3, 0, -2>, <0, 0, 0>], ::CardinalDirections::West => [<-3, 0, 0>, <1, 0, 3>] ], // ---------------------------------- // // Valley "Road2WayWithoutPole" => [ ::CardinalDirections::North => [<-1, 0, -2>, <0, 0, 0>], ::CardinalDirections::East => [<-1, 0, 0>, <0, 0, 1>], ::CardinalDirections::South => [<-2, 0, -1>, <0, 0, 0>], ::CardinalDirections::West => [<-2, 0, 0>, <0, 0, 2>] ] ] // ---------------------------------- // // Global decoration blocks #Const C_BlockModels_Deco [ // ---------------------------------- // // Canyon "DecoTreesBig1X1", "DecoTreesMedium1X1", "DecoRocksMedium1X1", "DecoCactusMedium1X1", "DecoBushesMedium1X1", "DecoTreePineBig1X1", "DecoReffineryX2", "DecoTechnicsAntenna", "RoadMainSupport", // ---------------------------------- // // Stadium "StadiumRoadMain", "StadiumPlatformRoad", "StadiumPlatformGridStraight", "StadiumPlatformSlope2Straight", "StadiumCircuitPillar5", "StadiumRoadDirt", "StadiumRoadDirtHigh", "StadiumSculptBridgePillar", "StadiumSculptBridgePillarMirror", "StadiumSculptBridgeSlopeStart", "StadiumSculptBridgeSlopeStartMirror", "StadiumSculptBridgeStraightSmall", "StadiumTubeRoadDown", "StadiumFabricStraight1x1", "StadiumFabricCornerOut", "StadiumInflatableCastle", "StadiumInflatableCastleDoor", "StadiumInflatableCastleBig", "StadiumInflatableCactus", "StadiumInflatableSnowTree", "StadiumInflatablePalmTree", "StadiumControlRoadGlass", "StadiumControlRoadPub", "StadiumControlRoadCamera", "StadiumControlLightBase", "StadiumTubeRoadLightSystem", "StadiumTubeRoadSoundSystem", "StadiumSculptA", "StadiumSculptB", "StadiumSculptC", // ---------------------------------- // // Valley "RoadDirt", "ArenaParkRoofBase", "ArenaParkBaseGrassCenter", "DecoAeolian", "DecoTrees", "DecoTreesMed", "DecoTreesSmall", "DecoMayorHouse", "DecoHomeSmall", "DecoHomeBig", "DecoChurch", "DecoHomeBigB", "DecoOldBusStop", "TechnicsScreen1x2", "PowerLinesStraight1x4", "DecoFarmC" ] // ---------------------------------- // // Global tube block #Const C_BlockModels_Tube [ // ---------------------------------- // // Canyon "RoadMainSupport", // ---------------------------------- // // Stadium "StadiumTube", // ---------------------------------- // // Valley "Road2WayStraightSupport" ] // ---------------------------------- // /** Sideaway decoration trigger blocks * * "RoadBlockName" => [] */ #Const C_DecoTriggers_Side [ // ---------------------------------- // // Canyon "RoadMainStart" => [<0, 0, 1>, <0, 0, -1>], "RoadMainCheckpoint" => [<0, 0, 1>, <0, 0, -1>], "RoadMainFinish" => [<0, 0, 1>, <0, 0, -1>], "RoadMainGTDiag2X2A" => [<1, 0, 1>, <0, 0, -2>, <0, 0, 1>, <1, 0, -2>], "RoadMainGTDiag2X2MirrorA" => [<0, 0, 2>, <1, 0, -1>, <0, 0, -1>, <1, 0, -2>], "RoadMainGTDiag2X2Down" => [<1, 0, 1>, <0, 0, -2>, <0, 0, 1>, <0, 0, 1>], "RoadMainGTDiag2X2DownMirror" => [<0, 0, 2>, <1, 0, -1>, <0, 0, -1>, <1, 0, -2>], "RoadMainStraightDown" => [<0, 0, 1>, <0, 0, -1>], "RoadMainStraightUp" => [<0, 0, 1>, <0, 0, -1>], "RoadMainTreePineBigStraight" => [<0, 0, 1>, <0, 0, -1>], // ---------------------------------- // // Stadium "StadiumRoadMainStartLine" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadMainCheckpoint" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadMainCheckpointUp" => [<0, 1, 1>, <0, 1, -1>], "StadiumRoadMainCheckpointDown" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadMainFinishLine" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadMainGTDiag2x2" => [<0, 0, 1>, <0, 0, -2>, <1, 0, 1>, <1, 0, -2>], "StadiumRoadMainGTDiag2x2Mirror" => [<0, 0, 2>, <0, 0, -1>, <1, 0, 2>, <1, 0, -1>], "StadiumRoadMainGTDiag3x2" => [<0, 0, 1>, <0, 0, -2>, <1, 0, 1>, <1, 0, -2>, <3, 0, 1>, <3, 0, -2>], "StadiumRoadMainGTDiag3x2Mirror" => [<0, 0, 2>, <0, 0, -1>, <1, 0, 2>, <1, 0, -1>, <3, 0, 2>, <3, 0, -1>], "StadiumHolePillar" => [<0, 0, 1>, <0, 0, -1>], "StadiumHolePillar2Front" => [<0, 0, 1>, <0, 0, -1>], "StadiumHolePillar2Line" => [<0, 0, 1>, <0, 0, -1>], "StadiumHolePillar3" => [<0, 0, 1>, <0, 0, -1>], "StadiumHole" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadStretch" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadMainSlopeBase" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadMainSlopeStraight" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadMainSlopeBase1x2" => [<0, -1, 1>, <0, -1, -1>, <1, 0, 1>, <1, 0, -1>], "StadiumRoadMainTurboDown" => [<0, 0, 1>, <0, 0, -1>], "StadiumHolePillarSlope" => [<0, 0, 1>, <0, 0, -1>], "StadiumHoleHoleSlope" => [<0, 0, 1>, <0, 0, -1>], "StadiumRoadStretchSlope" => [<0, 0, 1>, <0, 0, -1>], "StadiumBump1Slope" => [<0, 0, 1>, <0, 0, -1>], "StadiumTrenchXRoadMain" => [<0, 0, 1>, <0, 0, -1>], // ---------------------------------- // // Valley "Road2WayStart" => [<0, 0, 1>, <0, 0, -1>], "Road2WayCheckpoint" => [<0, 0, 1>, <0, 0, -1>], "Road2WayFinish" => [<-1, 0, 2>, <-1, 0, -2>, <0, 0, 2>, <0, 0, -2>], "Road2WayDiag2Mirror" => [<-1, 0, 2>, <-1, 0, -2>, <0, 0, 2>, <0, 0, -2>], "Road2WayWithoutPole" => [<0, 0, 1>, <0, 0, -1>], "Road2WayWithBirds" => [<0, 0, 1>, <0, 0, -1>] ] // ---------------------------------- // /** Pillar decoration trigger blocks * * "RoadBlockName" => ["DecorationBlocksNames"] */ #Const C_DecoTriggers_Pillar [ // ---------------------------------- // // Stadium "StadiumHolePillar" => [ "StadiumTubeRoadLightSystem", "StadiumTubeRoadSoundSystem" ], "StadiumHolePillar2Front" => [ "StadiumControlRoadGlass", "StadiumControlLightBase", "StadiumControlRoadCamera" ], "StadiumHolePillar2Line" => [ "StadiumControlRoadGlass", "StadiumControlLightBase", "StadiumControlRoadCamera" ], "StadiumHolePillar3" => [ "StadiumControlRoadGlass", "StadiumControlLightBase", "StadiumControlRoadCamera" ] ] // ---------------------------------- // /** Blocks that generate tubes under them * * "BlockName" => [] */ #Const C_TubeTriggers [ "StadiumRoadMainCheckpoint" => [<0, -1, 0>], "StadiumRoadMainCheckpointUp" => [<0, -2, 0>], "StadiumRoadMainCheckpointDown" => [<0, -1, 0>], "StadiumRoadMainFinishLine" => [<0, -1, 0>], "StadiumRoadMainGTDiag2x2" => [<1, -1, -1>, <0, -1, 0>], "StadiumRoadMainGTDiag2x2Mirror" => [<1, -1, 1>, <0, -1, 0>], "StadiumRoadMainGTDiag3x2" => [<2, -1, -1>, <0, -1, 0>], "StadiumRoadMainGTDiag3x2Mirror" => [<2, -1, 1>, <0, -1, 0>], "StadiumHolePillar" => [<0, -1, 0>], "StadiumHolePillar2Front" => [<0, -1, 0>], "StadiumHolePillar2Line" => [<0, -1, 0>], "StadiumHolePillar3" => [<0, -1, 0>], "StadiumRoadStretch" => [<0, -1, 0>], "StadiumHolePillarSlope" => [<0, -2, 0>] ] // ---------------------------------- // // Decoration blocks in air #Const C_DecoBlocks_Air [ // ---------------------------------- // // Stadium "StadiumRoadMain", "StadiumPlatformRoad", "StadiumPlatformGridStraight", "StadiumPlatformSlope2Straight", "StadiumCircuitPillar5", "StadiumSculptBridgePillar", "StadiumSculptBridgePillarMirror", "StadiumSculptBridgeStraightSmall", "StadiumTubeRoadDown", "StadiumControlRoadGlass", "StadiumControlRoadPub", "StadiumControlRoadCamera", "StadiumControlLightBase", "StadiumTubeRoadLightSystem", "StadiumTubeRoadSoundSystem" ] // ---------------------------------- // // Extra decoration blocks #Const C_DecoBlocks_Extra [ // ---------------------------------- // // Canyon "DecoTreesBig1X1", "DecoTreesMedium1X1", "DecoRocksMedium1X1", "DecoCactusMedium1X1", "DecoBushesMedium1X1", "DecoTreePineBig1X1", // ---------------------------------- // // Stadium "StadiumRoadMain", "StadiumCircuitPillar5", "StadiumRoadDirt", "StadiumRoadDirtHigh", "StadiumSculptBridgeSlopeStart", "StadiumSculptBridgeSlopeStartMirror", "StadiumTubePillarCap", "StadiumTubeRoadDown", "StadiumInflatableCastle", "StadiumInflatableCastleBig", "StadiumInflatableCactus", "StadiumInflatableSnowTree", "StadiumInflatablePalmTree", // ---------------------------------- // // Valley "RoadDirt", "DecoTrees", "DecoTreesMed", "DecoTreesSmall" ] // ---------------------------------- // // These blocks require special rotation #Const C_BlockSpecialRotation [ // ---------------------------------- // // Stadium "StadiumRoadStretch" => ::CardinalDirections::West, "StadiumBump1Slope" => ::CardinalDirections::West, "StadiumTrenchXRoadMain" => ::CardinalDirections::North, "StadiumPodium" => ::CardinalDirections::South ] // ---------------------------------- // // Place tube under block // ---------------------------------- // ***PlaceTube*** *** if (PrevBlockPosition.Y > CollectionGroundY && BlockModelTube != Null && C_TubeTriggers.existskey(CurBlock.Name)) { foreach (Offset in C_TubeTriggers[CurBlock.Name]) { declare PlacedTube = PlaceBlock(BlockModelTube, PrevBlockPosition + Offset, RandomDirection()); } } *** // ---------------------------------- // // Functions // ---------------------------------- // // ---------------------------------- // /** Get layer Map Constructor button * * @return Manialink page with Map Constructor interface */ Text GetLayerMapConstructor() { return """