Exemple #1
0
    static Vector2[] FaceUVs(int ID, BlockData.Direction direction)
    {
        Vector2[] UVs = new Vector2[4];

        BlockData.TexturePosition tilePos;
        if (BlockLoader.GetBlock(ID).texturePosition != null && BlockLoader.GetBlock(ID).texturePosition.Length > (int)direction)
        {
            tilePos = BlockLoader.GetBlock(ID).texturePosition[(int)direction];
        }
        else
        {
            tilePos = new BlockData.TexturePosition(0, 0);
        }

        UVs[0] = new Vector2(BlockData.TILE_SIZE * tilePos.x + BlockData.TILE_SIZE,
                             BlockData.TILE_SIZE * tilePos.y);
        UVs[1] = new Vector2(BlockData.TILE_SIZE * tilePos.x + BlockData.TILE_SIZE,
                             BlockData.TILE_SIZE * tilePos.y + BlockData.TILE_SIZE);
        UVs[2] = new Vector2(BlockData.TILE_SIZE * tilePos.x,
                             BlockData.TILE_SIZE * tilePos.y + BlockData.TILE_SIZE);
        UVs[3] = new Vector2(BlockData.TILE_SIZE * tilePos.x,
                             BlockData.TILE_SIZE * tilePos.y);

        return(UVs);
    }
Exemple #2
0
        //Initializes all of the drawable content
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Loads sprite content for items
            ItemsSpriteFactory.Instance.LoadAllTextures(Content);

            //Load sprite content for projectiles
            ProjectileSpriteFactory.Instance.LoadAllTextures(Content);

            //Enemy sprite content for items
            EnemySpriteFactory.Instance.LoadAllTextures(Content);

            //NPC sprite content for items
            NPCSpriteFactory.Instance.LoadAllTextures(Content);

            //Loads sprite content for blocks
            BlockSpriteFactory.Instance.LoadAllTextures(Content);

            //Loads content for all items
            ItemLoader.LoadContent();

            //Loads content for all enemies and npcs
            EnemyLoader.LoadContent();

            //Loads content for all blocks
            BlockLoader.LoadContent();
        }
Exemple #3
0
 public SerializableBlock(Block block)
 {
     _type      = BlockLoader.ConvertToEnum(block.GetType());
     _position  = block.Position;
     _health    = block.Health;
     _stability = block.Stability;
 }
Exemple #4
0
    private void CreateBlock(BlockLoader container, Block prefab, Vector3 pos)
    {
        Block instanceBlock = (Block)Instantiate(prefab, pos, Quaternion.identity);

        instanceBlock.id = container.blocks.Count;
        container.blocks.Add(instanceBlock);
        instanceBlock.SetBlock(container.transform, prefab.name);
    }
Exemple #5
0
        public Block ToObject()
        {
            var block = BlockLoader.CreateBlock(_type, _position);

            block.Health    = _health;
            block.Stability = _stability;

            return(block);
        }
 private void FinishBlock()
 {
     customBlock.Prefab.SetActive(false);
     if (Passed)
     {
         BlockLoader.FixBlockUnlockTable(customBlock);
     }
     UnityEngine.GameObject.Destroy(this.gameObject);
 }
Exemple #7
0
 protected void LoadBlock(Block block)
 {
     if (block.objs == null)
     {
         ModConsole.AddMessage(LogType.Error, "[BlockLoader]: Tried to load '" + block.name + "', but it's outdated.", "BlockLoader automatically stopped loading process.");
         return;
     }
     BlockLoader.AddModBlock(block);
 }
Exemple #8
0
        protected override void Initialize()
        {
            Player = new Player();
            Ball   = new Ball(4f);
            Blocks = BlockLoader.CreateBlocks(24, 6, 40);

            ScreenWidth  = graphics.PreferredBackBufferWidth;
            ScreenHeight = graphics.PreferredBackBufferHeight;
            base.Initialize();
        }
Exemple #9
0
    void Awake()
    {
        if (instance != null)
        {
            Debug.LogError("Already a BlockLoader in scene. Disabling", this);
            this.enabled = false;
            return;
        }
        instance = this;

        InitializeBlocks();
    }
Exemple #10
0
        private IEnumerator BuildBlocks(Chunk chunk, IncrementalTimer timer)
        {
            foreach (var builder in _blockBuilders)
            {
                var position = builder.Position;

                var blockType      = BlockTypes.None;
                var featureToBuild = FeatureTypes.None;

                if (builder.IsFill)
                {
                    builder.SetType(FillBlock);
                }

                blockType      = builder.GetBlock();
                featureToBuild = builder.GetFeature();;

                Block block = null;
                if (blockType != BlockTypes.None)
                {
                    block = BlockLoader.CreateBlock(blockType, position);
                    chunk.Register(block);
                }

                if (featureToBuild != FeatureTypes.None)
                {
                    var feature = FeatureLoader.CreateFeature(featureToBuild, position);
                    chunk.Register(feature);

                    if (block != null)
                    {
                        feature.Assign(block);
                    }
                    feature.Assign(builder.Space);

                    feature.Initialize();
                }

                if (timer.CheckIncrement(Time.realtimeSinceStartup))
                {
                    yield return(null);

                    timer.AdvanceIncrement(Time.realtimeSinceStartup);
                }
            }
        }
Exemple #11
0
    public static bool BreakBlock(RaycastHit hit, bool adjacent = false)
    {
        ChunkRenderer chunkRenderer = hit.collider.GetComponent <ChunkRenderer>();

        if (chunkRenderer == null)
        {
            return(false);
        }

        Vector3Int pos = GetBlockPos(hit, adjacent);

        int blockID = chunkRenderer.chunkData.GetBlock(pos.x, pos.y, pos.z);

        BlockLoader.GetBlock(blockID).Break(new Vector3(pos.x, pos.y, pos.z));
        chunkRenderer.chunkData.SetBlock(pos.x, pos.y, pos.z, 0);

        return(true);
    }
Exemple #12
0
//	void OnLevelWasLoaded()
//	{
//		print ("fgfgfgfg");
//		RefreshScene ();
//	}

//    void OnLevelWasLoaded(int level){
//        if(is_will_load){
//            is_will_load = false;
//            object data_obj = ReadData(save_file_name);
//            if(data_obj!=null){
//                data = (SaveData) data_obj;
//            }
//            RefreshScene();
//			print ("elaaaaa");
//        }
//    }

    public void RefreshScene()
    {
        GameObject[] containers = GameObject.FindGameObjectsWithTag("block_container");
        GameObject   player     = GameObject.FindGameObjectWithTag("Player");
        GameObject   camera     = GameObject.FindGameObjectWithTag("MainCamera");
        Heart        heart      = GameObject.FindGameObjectWithTag("life").GetComponentInChildren <Heart>();

        // Debug.Log("block loader length: "+containers.Length);
        BlockLoader[] loaders = new BlockLoader[containers.Length];
        for (int i = 0; i < loaders.Length; i++)
        {
            loaders[i] = containers[i].GetComponent <BlockLoader>();
        }
        loaders.ForEach(loader => loader.ClearClickedBlocks());
        loaders.ForEach(loader => loader.CreateBlocks());
        player.transform.position = data.characterPosition.Vector3();
        camera.transform.position = data.cameraPos.Vector3();
        heart.SetSpriteIdx(data.health_index);
    }
 private void RunBlock()
 {
     Passed = BlockLoader.Register(customBlock);
     Singleton.DoOnceAfterStart(FinishBlock);
 }
Exemple #14
0
        public static void CreateBlocks()
        {
            Harmony mod = new Harmony("aceba1.fusionblock");

            mod.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());

            Texture2D rtex1 = GameObjectJSON.ImageFromFile(Properties.Resources.reactor_tex_1),
                      rtex2 = GameObjectJSON.ImageFromFile(Properties.Resources.reactor_tex_2),
                      rtex3 = GameObjectJSON.ImageFromFile(Properties.Resources.reactor_tex_3);
            Material gso_main = GameObjectJSON.GetObjectFromGameResources <Material>("GSO_Main"), bf_main = GameObjectJSON.GetObjectFromGameResources <Material>("BF_Main"), rf_main = GameObjectJSON.MaterialFromShader().SetTexturesToMaterial(rtex1, rtex2, rtex3, false), rf_glow = GameObjectJSON.MaterialFromShader("Legacy Shaders/Particles/Additive").SetTexturesToMaterial(rtex3);


            {
                new BlockPrefabBuilder("GSOBlock_111")
                .SetBlockID(98341)
                .SetName("Fusion Block").SetDescription("<i>(Vanilla-safe when merged)</i> Press this up to another of its kind and it will merge the two techs!\n" +
                                                        "Both techs must be facing the same direction, and the block must be oriented to lock together like puzzle pieces. " +
                                                        "Once that's done, it will fuse into a standard block!")
                .SetMass(0.5f).SetHP(125).SetGrade(1)
                .SetSize(IntVector3.one, BlockPrefabBuilder.AttachmentPoints.Bottom)
                .SetPrice(144)
                .SetFaction(FactionSubTypes.GSO).SetCategory(BlockCategories.Accessories)
                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.fusionblock)))
                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.Fusion_Block), true, gso_main)
                .AddComponent <ModuleFuseHalf>(out ModuleFuseHalf moduleFuse)
                .RegisterLater();
                moduleFuse.ModelForwardPairing      = -1;
                moduleFuse.ModelForwardSignificance = true;
                moduleFuse.MakeSubstitiute          = true;
                moduleFuse.SubstituteType           = BlockTypes.GSOBlock_111;
                moduleFuse.JoinOffset = Vector3.zero;

                CustomRecipe.RegisterRecipe(
                    new CustomRecipe.RecipeInput[] {
                    new CustomRecipe.RecipeInput(0),     // Fibrewood
                    new CustomRecipe.RecipeInput(4),     // Plumbite
                    new CustomRecipe.RecipeInput(2, 2)   // Rubber Jelly
                }, new CustomRecipe.RecipeOutput[] {
                    new CustomRecipe.RecipeOutput(98341)
                });
            }
            {
                new BlockPrefabBuilder("GSOBlock_111")
                .SetBlockID(98342)
                .SetName("Fusion Bolt").SetDescription("<i>(Vanilla-safe when merged)</i> Press this up to another of its kind and it will merge the two techs!\n" +
                                                       "Both techs must be facing the same direction, and the block must be facing eachother. " +
                                                       "Once that's done, it will fuse into an exploding bolt!\n\nExploding may still occur while unfused")
                .SetMass(0.125f).SetHP(50).SetGrade(3)
                .SetSize(IntVector3.one, BlockPrefabBuilder.AttachmentPoints.Bottom)
                .SetPrice(324)
                .SetFaction(FactionSubTypes.GSO).SetCategory(BlockCategories.Accessories)
                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.fusionbolt)))
                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.Fusion_Bolt), true, gso_main)
                .AddComponent <ModuleFuseHalf>(out ModuleFuseHalf moduleFuse)
                .AddComponent <ModuleDetachableLink>()
                .RegisterLater();
                moduleFuse.ModelForwardSignificance = false;
                moduleFuse.MakeSubstitiute          = true;
                moduleFuse.SubstituteType           = BlockTypes.GSO_Exploder_A_111;
                moduleFuse.JoinOffset = Vector3.zero;

                CustomRecipe.RegisterRecipe(
                    new CustomRecipe.RecipeInput[] {
                    new CustomRecipe.RecipeInput(1),     // Fibron Chunk
                    new CustomRecipe.RecipeInput(9),     // Carbius Brick
                    new CustomRecipe.RecipeInput(2, 2)   // Rubber Jelly
                }, new CustomRecipe.RecipeOutput[] {
                    new CustomRecipe.RecipeOutput(98342)
                });
            }
            {
                new BlockPrefabBuilder("BF_Block_111")
                .SetBlockID(98343)
                .SetName("Fusion Plate").SetDescription("<i>(Vanilla-safe when merged)</i> Press this up to another of its kind and it will merge the two techs!\n" +
                                                        "Both techs must be facing the same direction, and the block must be facing eachother. " +
                                                        "Once that's done, the halves will melt away and the techs will be merged!")
                .SetMass(0.45f).SetHP(150).SetGrade(1)
                .SetSize(IntVector3.one, BlockPrefabBuilder.AttachmentPoints.Bottom)
                .SetPrice(312)
                .SetFaction(FactionSubTypes.BF).SetCategory(BlockCategories.Accessories)
                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.fusionplate)))
                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.Fusion_Plate), true, bf_main)
                .AddComponent <ModuleFuseHalf>(out ModuleFuseHalf moduleFuse)
                .RegisterLater();
                moduleFuse.ModelForwardSignificance = false;
                moduleFuse.MakeSubstitiute          = false;
                moduleFuse.JoinOffset = Vector3.down;

                CustomRecipe.RegisterRecipe(
                    new CustomRecipe.RecipeInput[] {
                    new CustomRecipe.RecipeInput(32),     // Luxian Crystal
                    new CustomRecipe.RecipeInput(43),     // Fibre Plating
                    new CustomRecipe.RecipeInput(2, 2)    // Rubber Jelly
                }, new CustomRecipe.RecipeOutput[] {
                    new CustomRecipe.RecipeOutput(98343)
                }, NameOfFabricator: "bffab");
            }
            {
                new BlockPrefabBuilder("HEBlock_111")
                .SetBlockID(98350)
                .SetName("Reactor Passive Blast Block").SetDescription("A dense heat-resistent block, that can permit the flow of rodius through all APs on it.")
                .SetMass(3f).SetHP(400).SetGrade(2)
                .SetSize(IntVector3.one, BlockPrefabBuilder.AttachmentPoints.All)
                .SetPrice(400)
                .SetFaction(FactionSubTypes.HE).SetCategory(BlockCategories.Base)
                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.reactor_blast_block_passive)))
                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.ReactorBlastBlockPassive), true, rf_main)
                .AddComponent(out Reactors.ModuleReactorHolder moduleReactor)
                .SetDamageableType(ManDamage.DamageableType.Rock)
                .RegisterLater();
                moduleReactor.ThisCapacity = 0.5f;
            }
            {
                new BlockPrefabBuilder("HEBlock_111")
                .SetBlockID(98356)
                .SetName("Reactor Passive Cell Block").SetDescription("A dense heat-resistent block, which can hold more rodius within it than a passive blast block. Optimal for storage.")
                .SetMass(6f).SetHP(400).SetGrade(2)
                .SetSize(new IntVector3(1, 2, 1))
                .SetAPsManual(new Vector3[] { new Vector3(0, -0.5f, 0f), new Vector3(0, 1.5f, 0f) })
                .SetPrice(1200)
                .SetFaction(FactionSubTypes.HE).SetCategory(BlockCategories.Base)
                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.reactor_cell)))
                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.ReactorCellPassive), true, rf_main)
                .AddComponent(out Reactors.ModuleReactorHolder moduleReactor)
                .SetDamageableType(ManDamage.DamageableType.Rock)
                .RegisterLater();
                moduleReactor.ThisCapacity = 4f;
            }
            {
                new BlockPrefabBuilder("HEBlock_111")
                .SetBlockID(98351)
                .SetName("Reactor Blast Block").SetDescription("A dense heat-resistent block that can widthstand the jets radiated by a reactor ring. Or a flamethrower.")
                .SetMass(3f).SetHP(550).SetGrade(2)
                .SetSize(IntVector3.one, BlockPrefabBuilder.AttachmentPoints.All)
                .SetPrice(400)
                .SetFaction(FactionSubTypes.HE).SetCategory(BlockCategories.Base)
                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.reactor_blast_block)))
                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.ReactorBlastBlock), true, rf_main)
                .SetDamageableType(ManDamage.DamageableType.Rock)
                .RegisterLater();
            }
            {
                var coolerPrefab = new BlockPrefabBuilder("HEBlock_111")
                                   .SetBlockID(98353)
                                   .SetName("Reactor Cooler").SetDescription("It's a spinny!")
                                   .SetMass(1f).SetHP(500).SetGrade(2)
                                   .SetSize(IntVector3.one, BlockPrefabBuilder.AttachmentPoints.Bottom)
                                   .SetPrice(400)
                                   .SetFaction(FactionSubTypes.HE).SetCategory(BlockCategories.Accessories)
                                   .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.reactor_cooler)))
                                   .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.ReactorCooler), true, rf_main)
                                   .AddComponent(out Reactors.ModuleReactorCooler moduleCooler)
                                   .SetDamageableType(ManDamage.DamageableType.Rock);

                var fan = new GameObject("m_Spinner");
                fan.AddComponent <MeshFilter>().sharedMesh       = GameObjectJSON.MeshFromData(Properties.Resources.ReactorCoolerFan);
                fan.AddComponent <MeshRenderer>().sharedMaterial = rf_main;
                fan.layer = Globals.inst.layerTank;
                var spinner = fan.AddComponent <Spinner>();
                var tS      = typeof(Spinner);
                tS.GetField("m_Speed", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(spinner, 5f);
                tS.GetField("m_AutoSpin", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(spinner, true);
                tS.GetField("m_SpinUpTime", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(spinner, 0.75f);
                spinner.m_RotationAxis      = new Axis(Axis.AxisType.Y);
                spinner.m_SteerAxis         = new Axis(Axis.AxisType.Y);
                fan.transform.parent        = coolerPrefab.Prefab.transform;
                fan.transform.localPosition = Vector3.zero;

                coolerPrefab.RegisterLater();
            }
            {
                var mesh   = GameObjectJSON.MeshFromData(Properties.Resources.ReactorRingIV);
                var ringIV = new BlockPrefabBuilder("HE_Battery_211")
                             .SetBlockID(98354)
                             .SetName("Reactor Ring IV").SetDescription("This is a rodite generator. It pulls rodite from the connected passive blocks and produces electrical energy. It also lets off jets of heat from the spinning core, which may melt your tech")
                             .SetMass(8f).SetHP(1000).SetGrade(2)
                             .SetSizeManual(new IntVector3[]
                {
                    new IntVector3(0, 0, 0), new IntVector3(0, 0, 1), new IntVector3(0, 0, 2), new IntVector3(1, 0, 2),
                    new IntVector3(2, 0, 2), new IntVector3(2, 0, 1), new IntVector3(2, 0, 0), new IntVector3(1, 0, 0),
                }, new Vector3[]
                {
                    new Vector3(1f, -.5f, 0f), new Vector3(2f, -.5f, 1f), new Vector3(1f, -.5f, 2f), new Vector3(0f, -.5f, 1f),
                    new Vector3(1f, .5f, 0f), new Vector3(2f, .5f, 1f), new Vector3(1f, .5f, 2f), new Vector3(0f, .5f, 1f),

                    new Vector3(1f, 0f, -0.5f), new Vector3(2.5f, 0f, 1f), new Vector3(1f, 0f, 2.5f), new Vector3(-.5f, 0f, 1f),
                })
                             .SetPrice(400)
                             .SetFaction(FactionSubTypes.HE).SetCategory(BlockCategories.Base)
                             .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.reactor_ring_iv)))
                             .SetModel(mesh, false, rf_main)
                             .AddComponent(out Reactors.ModuleReactorRing moduleEnergy)
                             .SetDamageableType(ManDamage.DamageableType.Rock)
                             .SetCenterOfMass(new Vector3(1f, 0f, 1f));

                AddBoxCollider(ringIV.Prefab, new Vector3(1f, 0f, -.05f), Vector3.zero, new Vector3(1.15f, 1f, .7f));
                AddBoxCollider(ringIV.Prefab, new Vector3(1f, 0f, 2.05f), Vector3.zero, new Vector3(1.15f, 1f, .7f));
                AddBoxCollider(ringIV.Prefab, new Vector3(-.05f, 0f, 1f), Vector3.zero, new Vector3(.7f, 1f, 1.15f));
                AddBoxCollider(ringIV.Prefab, new Vector3(2.05f, 0f, 1f), Vector3.zero, new Vector3(.7f, 1f, 1.15f));
                AddBoxCollider(ringIV.Prefab, new Vector3(1.73f, 0f, 0.27f), new Vector3(0, -45, 0), new Vector3(1.15f, 1f, .7f));
                AddBoxCollider(ringIV.Prefab, new Vector3(0.27f, 0f, 1.73f), new Vector3(0, -45, 0), new Vector3(1.15f, 1f, .7f));
                AddBoxCollider(ringIV.Prefab, new Vector3(0.27f, 0f, 0.27f), new Vector3(0, 45, 0), new Vector3(1.15f, 1f, .7f));
                AddBoxCollider(ringIV.Prefab, new Vector3(1.73f, 0f, 1.73f), new Vector3(0, 45, 0), new Vector3(1.15f, 1f, .7f));

                moduleEnergy.ThisCapacity     = 1f;
                moduleEnergy.UseAPIDs         = false;
                moduleEnergy.DrainPerSecond   = 0.04f;
                moduleEnergy.JetCapsule1      = new Vector3(1f, 0.2f, 1f);
                moduleEnergy.JetCapsule2      = new Vector3(1f, -0.2f, 1f);
                moduleEnergy.JetCapsuleRad    = 1f;
                moduleEnergy.JetCapsuleDamage = 45f;
                Component.DestroyImmediate(ringIV.Prefab.GetComponentInChildren <EnergyGauge>());
                var power = ringIV.Prefab.GetComponent <ModuleEnergyStore>();
                power.m_Capacity           = 400;
                power.m_AcceptRemoteCharge = false;

                var daage = ringIV.Prefab.GetComponent <ModuleDamage>();
                daage.deathExplosion = Transform.Instantiate(daage.deathExplosion);
                var damage = daage.deathExplosion.GetComponent <Explosion>();
                damage.m_MaxDamageStrength       = 1400;
                damage.m_EffectRadius            = 8;
                damage.m_EffectRadiusMaxStrength = 6;
                var particles = daage.deathExplosion.GetComponentsInChildren <ParticleSystem>();
                foreach (var particle in particles)
                {
                    var m = particle.main;
                    m.startSpeedMultiplier *= 2f;
                    m.startSizeMultiplier  *= 3f;
                    m.startColor            = rf_ExplosionColor;
                }

                var jet = new GameObject("BlastJet");
                jet.AddComponent <MeshFilter>().sharedMesh       = GameObjectJSON.MeshFromData(Properties.Resources.ReactorRingIVJet);
                jet.AddComponent <MeshRenderer>().sharedMaterial = rf_glow;
                jet.transform.parent        = ringIV.Prefab.transform;
                jet.transform.localPosition = new Vector3(1f, 0f, 1f);

                ringIV.RegisterLater();
            }
            {
                var mesh  = GameObjectJSON.MeshFromData(Properties.Resources.ReactorRingX);
                var ringX = new BlockPrefabBuilder("HE_Battery_211")
                            .SetBlockID(98355)
                            .SetName("Reactor Ring X").SetDescription("This is a more powerful rodite generator. It pulls rodite from the connected passive blocks and produces electrical energy. It also lets off jets of heat from the spinning core, which may melt your tech")
                            .SetMass(16f).SetHP(2000).SetGrade(2)
                            .SetSizeManual(new IntVector3[]
                {
                    new IntVector3(0, 0, 0), new IntVector3(0, 0, 1), new IntVector3(0, 0, 2), new IntVector3(1, 0, 2),
                    new IntVector3(2, 0, 2), new IntVector3(2, 0, 1), new IntVector3(2, 0, 0), new IntVector3(1, 0, 0),

                    new IntVector3(0, 1, 0), new IntVector3(0, 1, 1), new IntVector3(0, 1, 2), new IntVector3(1, 1, 2),
                    new IntVector3(2, 1, 2), new IntVector3(2, 1, 1), new IntVector3(2, 1, 0), new IntVector3(1, 1, 0),
                }, new Vector3[]
                {
                    new Vector3(1f, -.5f, 0f), new Vector3(2f, -.5f, 1f), new Vector3(1f, -.5f, 2f), new Vector3(0f, -.5f, 1f),
                    new Vector3(1f, 1.5f, 0f), new Vector3(2f, 1.5f, 1f), new Vector3(1f, 1.5f, 2f), new Vector3(0f, 1.5f, 1f),

                    new Vector3(1f, 0f, -0.5f), new Vector3(2.5f, 0f, 1f), new Vector3(1f, 0f, 2.5f), new Vector3(-.5f, 0f, 1f),
                    new Vector3(1f, 1f, -0.5f), new Vector3(2.5f, 1f, 1f), new Vector3(1f, 1f, 2.5f), new Vector3(-.5f, 1f, 1f),
                })
                            .SetPrice(400)
                            .SetFaction(FactionSubTypes.HE).SetCategory(BlockCategories.Base)
                            .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.reactor_ring_x)))
                            .SetModel(mesh, false, rf_main)
                            .AddComponent(out Reactors.ModuleReactorRing moduleReactor)
                            .SetDamageableType(ManDamage.DamageableType.Rock)
                            .SetCenterOfMass(new Vector3(1f, 0.5f, 1f));

                AddBoxCollider(ringX.Prefab, new Vector3(1f, 0.5f, -.50f), Vector3.zero, new Vector3(1.15f, 2f, .7f));
                AddBoxCollider(ringX.Prefab, new Vector3(1f, 0.5f, 2.05f), Vector3.zero, new Vector3(1.15f, 2f, .7f));
                AddBoxCollider(ringX.Prefab, new Vector3(-.05f, 0.5f, 1f), Vector3.zero, new Vector3(.7f, 2f, 1.15f));
                AddBoxCollider(ringX.Prefab, new Vector3(2.05f, 0.5f, 1f), Vector3.zero, new Vector3(.7f, 2f, 1.15f));
                AddBoxCollider(ringX.Prefab, new Vector3(1.73f, 0f, 0.27f), new Vector3(0, -45, 0), new Vector3(1.15f, 2f, .7f));
                AddBoxCollider(ringX.Prefab, new Vector3(0.27f, 0f, 1.73f), new Vector3(0, -45, 0), new Vector3(1.15f, 2f, .7f));
                AddBoxCollider(ringX.Prefab, new Vector3(0.27f, 0f, 0.27f), new Vector3(0, 45, 0), new Vector3(1.15f, 2f, .7f));
                AddBoxCollider(ringX.Prefab, new Vector3(1.73f, 0f, 1.73f), new Vector3(0, 45, 0), new Vector3(1.15f, 2f, .7f));

                moduleReactor.ThisCapacity     = 1f;
                moduleReactor.DrainPerSecond   = 0.1f;
                moduleReactor.JetCapsule1      = new Vector3(1f, 1.2f, 1f);
                moduleReactor.JetCapsule2      = new Vector3(1f, -0.2f, 1f);
                moduleReactor.JetCapsuleRad    = 1f;
                moduleReactor.JetCapsuleDamage = 60f;
                Component.DestroyImmediate(ringX.Prefab.GetComponentInChildren <EnergyGauge>());
                var power = ringX.Prefab.GetComponent <ModuleEnergyStore>();
                power.m_Capacity           = 1000;
                power.m_AcceptRemoteCharge = false;

                var daage = ringX.Prefab.GetComponent <ModuleDamage>();
                daage.deathExplosion = Transform.Instantiate(daage.deathExplosion);
                var damage = daage.deathExplosion.GetComponent <Explosion>();
                damage.m_MaxDamageStrength       = 2500;
                damage.m_EffectRadius            = 12;
                damage.m_EffectRadiusMaxStrength = 10;
                var particles = daage.deathExplosion.GetComponentsInChildren <ParticleSystem>();
                foreach (var particle in particles)
                {
                    var m = particle.main;
                    m.startSpeedMultiplier *= 3f;
                    m.startSizeMultiplier  *= 4f;
                    m.startColor            = rf_ExplosionColor;
                }

                var jet = new GameObject("BlastJet");
                jet.AddComponent <MeshFilter>().sharedMesh       = GameObjectJSON.MeshFromData(Properties.Resources.ReactorRingXJet);
                jet.AddComponent <MeshRenderer>().sharedMaterial = rf_glow;
                jet.transform.parent        = ringX.Prefab.transform;
                jet.transform.localPosition = new Vector3(1f, 0f, 1f);

                ringX.RegisterLater();
            }
            {
                var mesh         = GameObjectJSON.MeshFromData(Properties.Resources.ReactorLoaderPassive);
                var loaderPrefab = new BlockPrefabBuilder("GSO_Generator_211")//"BF_PlasmaFurnace_333")
                                   .SetBlockID(98352)
                                   .SetName("Reactor Resource Loader").SetDescription("This is the rodite loader for any reactor setup on a tech.\n<b>There is only one passive AP on the bottom of this block.</b> Attach this to another passive AP to power ring generators with rodite ore or capsules.")
                                   .SetMass(3f).SetHP(400).SetGrade(2)
                                   .SetSize(new IntVector3(1, 2, 1))
                                   .SetAPsManual(new Vector3[]
                {
                    new Vector3(0, -0.5f, 0),
                    new Vector3(0, 0, -0.5f),
                    new Vector3(0, 0, 0.5f),
                    new Vector3(-0.5f, 0, 0),
                    new Vector3(0.5f, 0, 0),
                })
                                   .SetPrice(400)
                                   .SetFaction(FactionSubTypes.HE).SetCategory(BlockCategories.Base)
                                   .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.reactor_loader)))
                                   .SetModel(mesh, false, rf_main)
                                   .AddComponent(out Reactors.ModuleReactorLoader moduleReactor)
                                   .SetDamageableType(ManDamage.DamageableType.Rock)
                                   .SetCenterOfMass(Vector3.zero);

                AddBoxCollider(loaderPrefab.Prefab, new Vector3(0f, -0.175f, 0f), Vector3.zero, new Vector3(1f, 0.65f, 1f));
                AddBoxCollider(loaderPrefab.Prefab, new Vector3(0.28f, 0.5f, 0.28f), Vector3.zero, new Vector3(.2f, 1.6f, .2f));
                AddBoxCollider(loaderPrefab.Prefab, new Vector3(0.28f, 0.5f, -0.28f), Vector3.zero, new Vector3(.2f, 1.6f, .2f));
                AddBoxCollider(loaderPrefab.Prefab, new Vector3(-0.28f, 0.5f, -0.28f), Vector3.zero, new Vector3(.2f, 1.6f, .2f));
                AddBoxCollider(loaderPrefab.Prefab, new Vector3(-0.28f, 0.5f, 0.28f), Vector3.zero, new Vector3(.2f, 1.6f, .2f));

                moduleReactor.ThisCapacity = 2.5f;
                moduleReactor.APIDs        = new int[] { 0 };
                moduleReactor.UseAPIDs     = true;
                ModuleItemConsume consume = loaderPrefab.Prefab.GetComponent <ModuleItemConsume>();
                Component.DestroyImmediate(loaderPrefab.Prefab.GetComponent <ModuleAnchor>());
                //loaderPrefab.Prefab.transform.Find("BF_PlasmaFurnace_333").localPosition = new Vector3(0, 0, 0);

                Type         MIC = typeof(ModuleItemConsume);
                BindingFlags BF  = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic;
                FieldInfo //NTBA = MIC.GetField("m_NeedsToBeAnchored", BF),
                    CS  = MIC.GetField("m_Consume", BF),
                    IP  = MIC.GetField("m_Input", BF),
                    EM  = MIC.GetField("m_EnergyMultiplier", BF),
                    OBP = typeof(ModuleItemHolder).GetField("m_OverrideBasePositons", BF),
                    RLN = typeof(ModuleRecipeProvider).GetField("m_RecipeListNames", BF);
                try
                {
                    RLN.SetValue(loaderPrefab.Prefab.GetComponent <ModuleRecipeProvider>(), new RecipeManager.RecipeNameWrapper[] { new RecipeManager.RecipeNameWrapper()
                                                                                                                                    {
                                                                                                                                        name = Reactors.ModuleReactorLoader.RecipeName
                                                                                                                                    } });
                    //NTBA.SetValue(consume, false);
                    EM.SetValue(consume, 0f);
                    (IP.GetValue(consume) as ModuleItemHolder.StackHandle).localPos = new Vector3(0, 0.37f, 0);
                    (CS.GetValue(consume) as ModuleItemHolder.StackHandle).localPos = new Vector3(0, -0.5f, 0);
                    Vector3[] overrideBasePositions = OBP.GetValue(loaderPrefab.Prefab.GetComponent <ModuleItemHolder>()) as Vector3[];
                    overrideBasePositions[0] = new Vector3(0, 0.37f, 0);
                    overrideBasePositions[1] = new Vector3(0, -0.5f, 0);
                }
                catch (Exception E) { do
                                      {
                                          Console.WriteLine(E); E = E.InnerException;
                                      } while (E.InnerException != null); }
                loaderPrefab.RegisterLater();
                BlockLoader.DelayAfterSingleton(AddRoditeRecipeList);
            }
            {
                new BlockPrefabBuilder("BF_Block_111")
                .SetBlockID(98344)
                .SetName("Reusable Fusion Bolt").SetDescription("Press this up to another of its kind and it will merge the two techs!\n" +
                                                                "Both techs must be facing the same direction, and the block must be facing eachother. " +
                                                                "Once that's done, the halves join together to form one tech, and can be separated")
                .SetMass(0.6f).SetHP(200).SetGrade(1)
                .SetSize(IntVector3.one, BlockPrefabBuilder.AttachmentPoints.Bottom)
                .SetPrice(624)
                .SetFaction(FactionSubTypes.BF).SetCategory(BlockCategories.Accessories)
                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.ionicboltopen)))
                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.Ionic_Bolt_Open), true, bf_main)
                .AddComponent(out ModuleFuseHalf moduleFuse)
                .RegisterLater();
                moduleFuse.ModelForwardSignificance = false;
                moduleFuse.MakeSubstitiute          = true;
                moduleFuse.SubstituteType           = (BlockTypes)98345;
                moduleFuse.JoinOffset = Vector3.zero;

                CustomRecipe.RegisterRecipe(
                    new CustomRecipe.RecipeInput[] {
                    new CustomRecipe.RecipeInput(32, 2),   // Luxian Crystal
                    new CustomRecipe.RecipeInput(43, 2),   // Fibre Plating
                    new CustomRecipe.RecipeInput(2, 4)     // Rubber Jelly
                }, new CustomRecipe.RecipeOutput[] {
                    new CustomRecipe.RecipeOutput(98344)
                }, NameOfFabricator: "bffab");
            }
            {
                new BlockPrefabBuilder("BF_Block_111")
                .SetBlockID(98345)
                .SetName("Reusable Fusion Bolt Pair").SetDescription("This is a joined pair of Resusable Fusion Bolts. They can be separated like a normal bolt")
                .SetMass(1.2f).SetHP(400).SetGrade(1)
                .SetSize(IntVector3.one)
                .SetAPsManual(new Vector3[] {
                    Vector3.down * 0.5f,
                    Vector3.up * 0.5f
                })
                .SetPrice(1248)
                .SetFaction(FactionSubTypes.BF).SetCategory(BlockCategories.Accessories)
                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.ionicbolt)))
                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.Ionic_Bolt), true, bf_main)
                .AddComponent(out ModuleFuseHalf moduleFuse)
                .AddComponent <ModuleDetachableLink>()
                .RegisterLater();
                moduleFuse.Separator      = true;
                moduleFuse.SubstituteType = (BlockTypes)98344;

                CustomRecipe.RegisterRecipe(
                    new CustomRecipe.RecipeInput[] {
                    new CustomRecipe.RecipeInput(32, 4),   // Luxian Crystal
                    new CustomRecipe.RecipeInput(43, 4),   // Fibre Plating
                    new CustomRecipe.RecipeInput(2, 8)     // Rubber Jelly
                }, new CustomRecipe.RecipeOutput[] {
                    new CustomRecipe.RecipeOutput(98345)
                }, NameOfFabricator: "bffab");
            }
        }
Exemple #15
0
 public void SetParentLoader(BlockLoader parent)
 {
     myParent = parent;
 }
Exemple #16
0
 public void Register()
 {
     BlockLoader.Register(this);
 }
    void LoadBlocks()
    {
        BlockLoader blockLoader = GetComponent <BlockLoader>();

        grid = blockLoader.LoadBlocks();
    }
        public static void Load()
        {
            #region Blocks
            {
                Material mat = GameObjectJSON.MaterialFromShader()
                               .SetTexturesToMaterial(
                    Alpha: GameObjectJSON.ImageFromFile(Properties.Resources.bacon_material_png
                                                        )
                    );
                Material GSOMain = GameObjectJSON.GetObjectFromGameResources <Material>("GSO_Main");
                {
                    var bacon = new BlockPrefabBuilder(/*"GSOBlock(111)", true*/)
                                .SetBlockID(10000) // Eventually, IDs could be either simple numbers (with or without quotes), or strings preferably with an author/pack naming scheme. Such as "author:block"
                                .SetName("GSO Bacon strip")
                                .SetDescription("A long strip of bacon with bullet absoring grease.\n\nOriginating from back when the Nuterra API was still being worked on, and was the first block to be recovered after their vanish...\n" +
                                                "\n" +
                                                "<b>HeX</b>: uuuhhhhh\n" +
                                                "one day a pig was born\n" +
                                                "little did people know\n" +
                                                "it was the son of god\n" +
                                                "Jesus - the holy pig\n" +
                                                "was one day cruxified\n" +
                                                "he yelled\n" +
                                                "then turned into the bacon\n" +
                                                "<b>Aceba1</b>: ...I think I'll add that to the description of the block\n" +
                                                "<b>HeX</b>: yay\n" +
                                                "credit me\n" +
                                                "\n" +
                                                "  - <b>HeX</b>, 8/22/2018")
                                .SetPrice(500)
                                .SetFaction(FactionSubTypes.GSO)
                                .SetCategory(BlockCategories.Standard)
                                .SetSizeManual(
                        new IntVector3[] {
                        new IntVector3(0, 0, 0), new IntVector3(1, 0, 0), new IntVector3(2, 0, 0), new IntVector3(3, 0, 0)
                    },
                        new Vector3[] {
                        new Vector3(-.5f, 0f, 0f), new Vector3(0f, .5f, 0f), new Vector3(1f, -.5f, 0f),
                        new Vector3(2f, .5f, 0f), new Vector3(3f, -.5f, 0f), new Vector3(3.5f, 0f, 0f)
                    })
                                .SetMass(4)
                                .SetHP(3000)
                                .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.bacon), true, mat)
                                .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.bacon_icon_png)))
                                .SetDeathExplosionReference((int)BlockTypes.GSOBigBertha_845)
                                .SetRecipe(new Dictionary <ChunkTypes, int> {
                        { ChunkTypes.OleiteJelly, 4 },
                        { ChunkTypes.Wood, 4 }
                    })     // This is the cleaner way to set a recipe
                                .RegisterLater();


                    // Here is what needs to be done for the older way of making recipes below. They should both achieve the same thing

                    //CustomRecipe.RegisterRecipe( // This is the old way to make recipes
                    //    new CustomRecipe.RecipeInput[]
                    //    {
                    //        new CustomRecipe.RecipeInput((int)ChunkTypes.OleiteJelly, 4),
                    //        new CustomRecipe.RecipeInput((int)ChunkTypes.Wood, 4)
                    //    },
                    //    new CustomRecipe.RecipeOutput[]
                    //    {
                    //        new CustomRecipe.RecipeOutput(bacon.RuntimeID)
                    //    });
                } // Bacon
                {
                    var banagun = new BlockPrefabBuilder("GSOMGunFixed(111)", false);
                    banagun.SetBlockID(10001)
                    .SetName("GSO Banana gun")
                    .SetDescription("A very special banana. But not as special as you are, your banana friend tells us.\n\nBefore the official release of TerraTech 1.0, there was a mod called the <b>UltiMod</b>. A collection of mods that added things like the water mod, block replacements, 'improved' EXP joints, and various tools & keybind options. This banana gun was part of the block replacement mod, which back then only reskinned existing blocks.\nBits of code from the <b>UltiMod</b> still persist in mods after 1.0, no longer stuck under one title.\n\nWe've come a long way...")
                    .SetPrice(297)
                    .SetFaction(FactionSubTypes.GSO)
                    .SetCategory(BlockCategories.Weapons)
                    .SetHP(200)
                    .SetRecipe(ChunkTypes.PlumbiteOre, ChunkTypes.LuxiteShard, ChunkTypes.LuxiteShard);
                    // Another way to set recipes for a block. Resembles the string/array system for JSON-Blocks

                    MeshFilter[] componentsInChildren2 = banagun.TankBlock.GetComponentsInChildren <MeshFilter>(true);

                    Texture2D main  = GameObjectJSON.ImageFromFile(Properties.Resources.banana_material_png);
                    Texture2D gloss = GameObjectJSON.ImageFromFile(Properties.Resources.banana_gloss_material_png);

                    Material changemat2 = GameObjectJSON.MaterialFromShader().SetTexturesToMaterial(main, gloss);

                    foreach (MeshFilter mes in componentsInChildren2) // This somewhat mimics the JSON-Block parser...
                    {
                        string name = mes.name;
                        if (name == "m_MuzzleFlash_01")
                        {
                            mes.GetComponent <MeshRenderer>().material.SetTexture("_MainTex", GameObjectJSON.ImageFromFile(Properties.Resources.banana_blast_material_png));
                        }
                        else
                        {
                            if (name == "m_GSO_MgunFixed_111_Barrel")
                            {
                                mes.mesh = GameObjectJSON.MeshFromData(Properties.Resources.banana_barrel);
                            }
                            else if (name == "m_GSO_MgunFixed_111_Body")
                            {
                                mes.mesh = GameObjectJSON.MeshFromData(Properties.Resources.banana_body);
                            }
                            else if (name == "m_GSO_MgunFixed_111_Base")
                            {
                                mes.mesh = GameObjectJSON.MeshFromData(Properties.Resources.banana_base);
                            }
                            else
                            {
                                Component.DestroyImmediate(mes);
                                continue;
                            }
                            mes.GetComponent <MeshRenderer>().material = changemat2;
                        }
                    }
                    var firedata = banagun.Prefab.GetComponent <FireData>();
                    firedata.m_MuzzleVelocity      *= 1.6f;
                    firedata.m_BulletSprayVariance *= 0.3f;
                    firedata.m_KickbackStrength    *= 1.6f;
                    var newbullet = GameObject.Instantiate(firedata.m_BulletPrefab);
                    newbullet.gameObject.SetActive(false);
                    var lr        = newbullet.gameObject.GetComponent <LineRenderer>();
                    var colorKeys = lr.colorGradient.colorKeys;
                    for (int i = 0; i < colorKeys.Length; i++)
                    {
                        var color = colorKeys[i];
                        colorKeys[i] = new GradientColorKey(new Color(color.color.r, color.color.g, 0), color.time);
                    }
                    typeof(WeaponRound).GetField("m_Damage", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(newbullet, 100);
                    firedata.m_BulletPrefab = newbullet;
                    banagun.SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.banana_icon_png)))
                    .RegisterLater();
                } // Banana Gun
                {
                    var cockpit_s = new BlockPrefabBuilder("GSOLightStud(111)", true)
                                    .SetBlockID(9000)
                                    .SetName("GSO Top Cockpit")
                                    .SetDescription("Pop in here and have a first-person look at the world from this block! (The side with the diamond is the viewing direction)\n\nRight click and drag to look and Cycle views with R (and backwards with Shift held down)")
                                    .SetPrice(300)
                                    .SetHP(500)
                                    .SetFaction(FactionSubTypes.GSO)
                                    .SetCategory(BlockCategories.Accessories)
                                    .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.cockpit_small), true, GSOMain)
                                    .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.cockpit_small_icon_png)))
                                    .SetSize(IntVector3.one, BlockPrefabBuilder.AttachmentPoints.Bottom)
                                    .SetRecipe(new Dictionary <ChunkTypes, int> {
                        { ChunkTypes.PlumbiteOre, 2 },
                        { ChunkTypes.RoditeOre, 1 },
                        { ChunkTypes.RubberJelly, 2 }
                    });

                    var view = new GameObject("FirstPersonAnchor");
                    view.AddComponent <ModuleFirstPerson>();
                    view.transform.parent = cockpit_s.TankBlock.transform;

                    cockpit_s.RegisterLater();
                } // GSO Top FPV
                {
                    var cockpit_s2 = new BlockPrefabBuilder(BlockTypes.GSOLightStud_111, true) // "GSOLightStud(111)"
                                     .SetBlockID(9005)
                                     .SetName("GSO Sided Swerve Cockpit")
                                     .SetDescription("Just like the other cockpit, but can be mounted on the sides of things for a better look at your surroundings! Note: Orientation requires adjusting\n\nRight click and drag to look and Cycle views with R (and backwards with Shift held down)")
                                     .SetPrice(300)
                                     .SetHP(500)
                                     .SetFaction(FactionSubTypes.GSO)
                                     .SetCategory(BlockCategories.Accessories)
                                     .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.cockpit_small_2), true, GSOMain)
                                     .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.cockpit_small_2_icon_png)))
                                     .SetSizeManual(new IntVector3[] { IntVector3.zero }, new Vector3[] { Vector3.down * 0.5f, Vector3.back * 0.5f })
                                     .SetRecipe(new Dictionary <ChunkTypes, int> {
                        { ChunkTypes.PlumbiteOre, 3 },
                        { ChunkTypes.RodiusCapsule, 1 },
                        { ChunkTypes.RubberJelly, 2 }
                    });

                    var view1 = new GameObject("FirstPersonAnchor");
                    view1.AddComponent <ModuleFirstPerson>();
                    view1.transform.parent   = cockpit_s2.TankBlock.transform;
                    view1.transform.rotation = Quaternion.Euler(-90, 0, 0);

                    cockpit_s2.RegisterLater();
                } // GSO Front FPV
                {
                    var cockpit_l = new BlockPrefabBuilder(11, Vector3.one * 0.5f, true) /*"GSOLightStud(111)"*/
                                    .SetBlockID(9001)
                                    .SetName("GSO Observatory")
                                    .SetDescription("Mount this gigantic hamsterball to your tech to be right in the action!\nThis reorients itself to the direction of the cab\n\nRight click and drag to look and Cycle views with R (and backwards with Shift held down)\n\nAnother recovery from the original Nuterra API, along with the FPV Top Cockpit. This model remains intact.")
                                    .SetPrice(500)
                                    .SetHP(2500)
                                    .SetGrade(1)
                                    .SetFaction(FactionSubTypes.GSO)
                                    .SetCategory(BlockCategories.Accessories)
                                    .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.cockpit_large), true, GSOMain)
                                    .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.cockpit_large_icon_png)))
                                    .SetSize(IntVector3.one * 2, BlockPrefabBuilder.AttachmentPoints.Bottom)
                                    .SetRecipe(new Dictionary <ChunkTypes, int> {
                        { ChunkTypes.PlumbiaIngot, 6 },
                        { ChunkTypes.RodiusCapsule, 3 },
                        { ChunkTypes.ErudianCrystal, 2 },
                        { ChunkTypes.RubberJelly, 3 }
                    });

                    var view2 = new GameObject("FirstPersonAnchor");
                    view2.AddComponent <ModuleFirstPerson>().AdaptToMainRot = true;
                    view2.transform.parent        = cockpit_l.TankBlock.transform;
                    view2.transform.localPosition = Vector3.one * 0.5f;

                    cockpit_l.RegisterLater();
                } // GSO Dome FPV
                {
                    var cockpit_ven = new BlockPrefabBuilder(BlockTypes.VENLightStud_111, Vector3.forward * 0.5f, true)
                                      .SetBlockID(9002)//, "517376c14c30592c")
                                      .SetName("VEN Observatory")
                                      .SetDescription("A slim, lower observatory that could fit nice on top or below a plane\nThis reorients itself to the direction of the cab\n\nRight click and drag to look and Cycle views with R (and backwards with Shift held down)\n\nRedesign provided by <b>Mr. Starch</b>")
                                      .SetPrice(500)
                                      .SetHP(2500)
                                      .SetGrade(1)
                                      .SetFaction(FactionSubTypes.VEN)
                                      .SetCategory(BlockCategories.Accessories)
                                      .SetModel(GameObjectJSON.MeshFromData(Properties.Resources.cockpit_ven), true, GameObjectJSON.GetObjectFromGameResources <Material>("VEN_Main"))
                                      .SetIcon(GameObjectJSON.SpriteFromImage(GameObjectJSON.ImageFromFile(Properties.Resources.cockpit_ven_icon_png)))
                                      .SetSize(new IntVector3(1, 1, 2), BlockPrefabBuilder.AttachmentPoints.Bottom)
                                      .SetRecipe(new Dictionary <ChunkTypes, int> {
                        { ChunkTypes.PlumbiaIngot, 2 },
                        { ChunkTypes.RodiusCapsule, 1 },
                        { ChunkTypes.TitaniaIngot, 1 },
                        { ChunkTypes.RubberJelly, 3 }
                    });

                    var view3 = new GameObject("FirstPersonAnchor");
                    view3.AddComponent <ModuleFirstPerson>().AdaptToMainRot = true;
                    view3.transform.parent        = cockpit_ven.TankBlock.transform;
                    view3.transform.localPosition = Vector3.forward * 0.5f + Vector3.down * 0.1f;

                    cockpit_ven.RegisterLater();
                } // VEN Slim FPV
            }
            #endregion

            var thng  = new GameObject();
            var thnng = thng.AddComponent <FirstPersonCamera>();
            BlockLoader.DelayAfterSingleton(thnng.Manual_Awake);
        }