maozs3946 发表于 2019-11-3 15:07

这游戏是不是该开发个类似市场的元素,可以交换各种物资,要不有时候真心不好玩。

本帖最后由 maozs3946 于 2019-11-3 15:18 编辑

如题,感觉挖来挖去有些资源很多没有用处,有些又很少不够用,不太好平衡,
呼吁官方能开发个类似市场的元素吧,设计一个中间通用元素,比如生物质软泥,可用来转换资源,来解决强迫症和持续发展问题。
就好比给打印仓添加功能可以回收和打印元素,各种资源给打印仓转换为中间物,再消耗中间物加工新物质,这多好。
下面分享一下我的dnspy修改,使用碎石机和分子锻造台来完成的代码
碎石机把大部分元素都加工成沙子,分子锻造台再合成各种常用元素。

maozs3946 发表于 2019-11-3 15:21

分子锻造台代码    // Token: 0x0600674E RID: 26446
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
      go.AddOrGet<DropAllWorkable>();
      go.AddOrGet<BuildingComplete>().isManuallyOperated = false;
      ComplexFabricator complexFabricator = go.AddOrGet<ComplexFabricator>();
      complexFabricator.resultState = ComplexFabricator.ResultState.Heated;
      complexFabricator.heatedTemperature = 313.15f;
      complexFabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid;
      complexFabricator.duplicantOperated = false;
      go.AddOrGet<FabricatorIngredientStatusManager>();
      go.AddOrGet<CopyBuildingSettings>();
      Workable workable = go.AddOrGet<ComplexFabricatorWorkable>();
      BuildingTemplates.CreateComplexFabricatorStorage(go, complexFabricator);
      workable.overrideAnims = new KAnimFile[]
      {
            Assets.GetAnim("anim_interacts_supermaterial_refinery_kanim")
      };
      Prioritizable.AddRef(go);
      ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Petroleum.CreateTag(), 100f)
      };
      ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.SuperCoolant.CreateTag(), 100f)
      };
      ComplexRecipe complexRecipe = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", array, array2), array, array2);
      complexRecipe.time = 80f;
      complexRecipe.description = STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.SUPERCOOLANT_RECIPE_DESCRIPTION;
      complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
      complexRecipe.fabricators = new List<Tag>
      {
            TagManager.Create("SupermaterialRefinery")
      };
      ComplexRecipe.RecipeElement[] array3 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Katairite.CreateTag(), 100f)
      };
      ComplexRecipe.RecipeElement[] array4 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.SuperInsulator.CreateTag(), 100f)
      };
      ComplexRecipe complexRecipe2 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", array3, array4), array3, array4);
      complexRecipe2.time = 80f;
      complexRecipe2.description = STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.SUPERINSULATOR_RECIPE_DESCRIPTION;
      complexRecipe2.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
      complexRecipe2.fabricators = new List<Tag>
      {
            TagManager.Create("SupermaterialRefinery")
      };
      ComplexRecipe.RecipeElement[] array5 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Niobium.CreateTag(), 100f)
      };
      ComplexRecipe.RecipeElement[] array6 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.TempConductorSolid.CreateTag(), 100f)
      };
      ComplexRecipe complexRecipe3 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", array5, array6), array5, array6);
      complexRecipe3.time = 80f;
      complexRecipe3.description = STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.TEMPCONDUCTORSOLID_RECIPE_DESCRIPTION;
      complexRecipe3.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
      complexRecipe3.fabricators = new List<Tag>
      {
            TagManager.Create("SupermaterialRefinery")
      };
      ComplexRecipe.RecipeElement[] array7 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Polypropylene.CreateTag(), 100f)
      };
      ComplexRecipe.RecipeElement[] array8 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.ViscoGel.CreateTag(), 100f)
      };
      ComplexRecipe complexRecipe4 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", array7, array8), array7, array8);
      complexRecipe4.time = 80f;
      complexRecipe4.description = STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.VISCOGEL_RECIPE_DESCRIPTION;
      complexRecipe4.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
      complexRecipe4.fabricators = new List<Tag>
      {
            TagManager.Create("SupermaterialRefinery")
      };
      ComplexRecipe.RecipeElement[] array9 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Sand.CreateTag(), 100f)
      };
      ComplexRecipe.RecipeElement[] array10 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Algae.CreateTag(), 100f)
      };
      ComplexRecipe complexRecipe5 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", array9, array10), array9, array10);
      complexRecipe5.time = 80f;
      complexRecipe5.description = STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.VISCOGEL_RECIPE_DESCRIPTION;
      complexRecipe5.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
      complexRecipe5.fabricators = new List<Tag>
      {
            TagManager.Create("SupermaterialRefinery")
      };
      ComplexRecipe.RecipeElement[] array11 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Sand.CreateTag(), 100f)
      };
      ComplexRecipe.RecipeElement[] array12 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Carbon.CreateTag(), 100f)
      };
      ComplexRecipe complexRecipe6 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", array11, array12), array11, array12);
      complexRecipe6.time = 80f;
      complexRecipe6.description = STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.VISCOGEL_RECIPE_DESCRIPTION;
      complexRecipe6.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
      complexRecipe6.fabricators = new List<Tag>
      {
            TagManager.Create("SupermaterialRefinery")
      };
      ComplexRecipe.RecipeElement[] array13 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Sand.CreateTag(), 100f)
      };
      ComplexRecipe.RecipeElement[] array14 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Polypropylene.CreateTag(), 100f)
      };
      ComplexRecipe complexRecipe7 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", array13, array14), array13, array14);
      complexRecipe7.time = 80f;
      complexRecipe7.description = STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.VISCOGEL_RECIPE_DESCRIPTION;
      complexRecipe7.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
      complexRecipe7.fabricators = new List<Tag>
      {
            TagManager.Create("SupermaterialRefinery")
      };
      ComplexRecipe.RecipeElement[] array15 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Sand.CreateTag(), 100f)
      };
      ComplexRecipe.RecipeElement[] array16 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(SimHashes.Dirt.CreateTag(), 100f)
      };
      ComplexRecipe complexRecipe8 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", array15, array16), array15, array16);
      complexRecipe8.time = 80f;
      complexRecipe8.description = STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.VISCOGEL_RECIPE_DESCRIPTION;
      complexRecipe8.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
      complexRecipe8.fabricators = new List<Tag>
      {
            TagManager.Create("SupermaterialRefinery")
      };
    }

    // Token: 0x0600674F RID: 26447 RVA: 0x000408D1 File Offset: 0x0003EAD1
    public override void DoPostConfigureComplete(GameObject go)
    {
      go.GetComponent<KPrefabID>().prefabSpawnFn += delegate(GameObject game_object)
      {
            ComplexFabricatorWorkable component = game_object.GetComponent<ComplexFabricatorWorkable>();
            component.WorkerStatusItem = Db.Get().DuplicantStatusItems.Processing;
            component.AttributeConverter = Db.Get().AttributeConverters.MachinerySpeed;
            component.AttributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.PART_DAY_EXPERIENCE;
            component.SkillExperienceSkillGroup = Db.Get().SkillGroups.Technicals.Id;
            component.SkillExperienceMultiplier = SKILLS.PART_DAY_EXPERIENCE;
      };
    }

maozs3946 发表于 2019-11-3 15:25

碎石机代码
// Token: 0x060066B0 RID: 26288 RVA: 0x001EC2AC File Offset: 0x001EA4AC
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
      go.AddOrGet<DropAllWorkable>();
      go.AddOrGet<BuildingComplete>().isManuallyOperated = false;
      ComplexFabricator complexFabricator = go.AddOrGet<ComplexFabricator>();
      complexFabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid;
      complexFabricator.duplicantOperated = false;
      go.AddOrGet<FabricatorIngredientStatusManager>();
      go.AddOrGet<CopyBuildingSettings>();
      ComplexFabricatorWorkable complexFabricatorWorkable = go.AddOrGet<ComplexFabricatorWorkable>();
      BuildingTemplates.CreateComplexFabricatorStorage(go, complexFabricator);
      complexFabricatorWorkable.overrideAnims = new KAnimFile[]
      {
            Assets.GetAnim("anim_interacts_rockrefinery_kanim")
      };
      complexFabricatorWorkable.workingPstComplete = "working_pst_complete";
      Tag tag = SimHashes.Sand.CreateTag();
      foreach (Element element in ElementLoader.elements.FindAll((Element e) => e.HasTag(GameTags.Crushable)))
      {
            ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[]
            {
                new ComplexRecipe.RecipeElement(element.tag, 100f)
            };
            ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[]
            {
                new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Niobium).tag, 5f),
                new ComplexRecipe.RecipeElement(tag, 95f)
            };
            string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("RockCrusher", element.tag);
            string text = ComplexRecipeManager.MakeRecipeID("RockCrusher", array, array2);
            ComplexRecipe complexRecipe = new ComplexRecipe(text, array, array2);
            complexRecipe.time = 40f;
            complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.RECIPE_DESCRIPTION, element.name, tag.ProperName());
            complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult;
            complexRecipe.fabricators = new List<Tag>
            {
                TagManager.Create("RockCrusher")
            };
            ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, text);
      }
      foreach (Element element2 in ElementLoader.elements.FindAll((Element e) => e.IsSolid && e.HasTag(GameTags.Metal)))
      {
            Element lowTempTransition = element2.highTempTransition.lowTempTransition;
            if (lowTempTransition != element2)
            {
                ComplexRecipe.RecipeElement[] array3 = new ComplexRecipe.RecipeElement[]
                {
                  new ComplexRecipe.RecipeElement(element2.tag, 100f)
                };
                ComplexRecipe.RecipeElement[] array4 = new ComplexRecipe.RecipeElement[]
                {
                  new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Niobium).tag, 5f),
                  new ComplexRecipe.RecipeElement(tag, 95f)
                };
                string obsolete_id2 = ComplexRecipeManager.MakeObsoleteRecipeID("RockCrusher", lowTempTransition.tag);
                string text2 = ComplexRecipeManager.MakeRecipeID("RockCrusher", array3, array4);
                ComplexRecipe complexRecipe2 = new ComplexRecipe(text2, array3, array4);
                complexRecipe2.time = 40f;
                complexRecipe2.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.METAL_RECIPE_DESCRIPTION, lowTempTransition.name, element2.name);
                complexRecipe2.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult;
                complexRecipe2.fabricators = new List<Tag>
                {
                  TagManager.Create("RockCrusher")
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id2, text2);
            }
      }
      Element element3 = ElementLoader.FindElementByHash(SimHashes.Lime);
      ComplexRecipe.RecipeElement[] array5 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement("EggShell", 5f)
      };
      ComplexRecipe.RecipeElement[] array6 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Lime).tag, 5f)
      };
      string obsolete_id3 = ComplexRecipeManager.MakeObsoleteRecipeID("RockCrusher", element3.tag);
      string text3 = ComplexRecipeManager.MakeRecipeID("RockCrusher", array5, array6);
      ComplexRecipe complexRecipe3 = new ComplexRecipe(text3, array5, array6);
      complexRecipe3.time = 40f;
      complexRecipe3.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.LIME_RECIPE_DESCRIPTION, SimHashes.Lime.CreateTag().ProperName(), MISC.TAGS.EGGSHELL);
      complexRecipe3.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult;
      complexRecipe3.fabricators = new List<Tag>
      {
            TagManager.Create("RockCrusher")
      };
      ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id3, text3);
      Element element4 = ElementLoader.FindElementByHash(SimHashes.Lime);
      ComplexRecipe.RecipeElement[] array7 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement("BabyCrabShell", 1f)
      };
      ComplexRecipe.RecipeElement[] array8 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(element4.tag, 5f)
      };
      ComplexRecipe complexRecipe4 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("RockCrusher", array7, array8), array7, array8);
      complexRecipe4.time = 40f;
      complexRecipe4.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.LIME_RECIPE_DESCRIPTION, SimHashes.Lime.CreateTag().ProperName(), ITEMS.INDUSTRIAL_PRODUCTS.CRAB_SHELL.NAME);
      complexRecipe4.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult;
      complexRecipe4.fabricators = new List<Tag>
      {
            TagManager.Create("RockCrusher")
      };
      Element element5 = ElementLoader.FindElementByHash(SimHashes.Lime);
      ComplexRecipe.RecipeElement[] array9 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement("CrabShell", 1f)
      };
      ComplexRecipe.RecipeElement[] array10 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(element5.tag, 10f)
      };
      ComplexRecipe complexRecipe5 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("RockCrusher", array9, array10), array9, array10);
      complexRecipe5.time = 40f;
      complexRecipe5.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.LIME_RECIPE_DESCRIPTION, SimHashes.Lime.CreateTag().ProperName(), ITEMS.INDUSTRIAL_PRODUCTS.CRAB_SHELL.NAME);
      complexRecipe5.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult;
      complexRecipe5.fabricators = new List<Tag>
      {
            TagManager.Create("RockCrusher")
      };
      ComplexRecipe.RecipeElement[] array11 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Fossil).tag, 100f)
      };
      ComplexRecipe.RecipeElement[] array12 = new ComplexRecipe.RecipeElement[]
      {
            new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Lime).tag, 5f),
            new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.SedimentaryRock).tag, 95f)
      };
      ComplexRecipe complexRecipe6 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("RockCrusher", array11, array12), array11, array12);
      complexRecipe6.time = 40f;
      complexRecipe6.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.LIME_FROM_LIMESTONE_RECIPE_DESCRIPTION, SimHashes.Fossil.CreateTag().ProperName(), SimHashes.SedimentaryRock.CreateTag().ProperName(), SimHashes.Lime.CreateTag().ProperName());
      complexRecipe6.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult;
      complexRecipe6.fabricators = new List<Tag>
      {
            TagManager.Create("RockCrusher")
      };
      Prioritizable.AddRef(go);
    }

ftf1024 发表于 2019-11-4 21:45

你是电 你是光 你是唯一的神话,,,,,,,你是魔鬼吗?? 收下我的膝盖
页: [1]
查看完整版本: 这游戏是不是该开发个类似市场的元素,可以交换各种物资,要不有时候真心不好玩。