高级玩家

- 贡献度
- 0
- 金元
- 3930
- 积分
- 393
- 精华
- 0
- 注册时间
- 2014-9-1
|
如题,比如碎石机这样需要复制人操作的建筑如何能用dnspy修改为像窑炉那样加好材料自动就会运行的呢?
窑炉的代码
string id = "Kiln";
int width = 2;
int height = 2;
string anim = "kiln_kanim";
int hitpoints = 100;
float construction_time = 30f;
float[] tier = TUNING.BUILDINGS.CONSTRUCTION_MASS_KG.TIER3;
string[] all_METALS = MATERIALS.ALL_METALS;
float melting_point = 800f;
BuildLocationRule build_location_rule = BuildLocationRule.OnFloor;
EffectorValues tier2 = NOISE_POLLUTION.NOISY.TIER5;
BuildingDef buildingDef = BuildingTemplates.CreateBuildingDef(id, width, height, anim, hitpoints, construction_time, tier, all_METALS, melting_point, build_location_rule, TUNING.BUILDINGS.DECOR.PENALTY.TIER1, tier2, 0.2f);
buildingDef.Overheatable = false;
buildingDef.RequiresPowerInput = false;
buildingDef.ExhaustKilowattsWhenActive = 16f;
buildingDef.SelfHeatKilowattsWhenActive = 4f;
buildingDef.AudioCategory = "HollowMetal";
return buildingDef;
}
// Token: 0x060062ED RID: 25325 RVA: 0x001D9E90 File Offset: 0x001D8090
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
{
go.GetComponent<KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
go.AddOrGet<DropAllWorkable>();
go.AddOrGet<BuildingComplete>().isManuallyOperated = false;
ComplexFabricator complexFabricator = go.AddOrGet<ComplexFabricator>();
complexFabricator.resultState = ComplexFabricator.ResultState.Heated;
complexFabricator.heatedTemperature = 353.15f;
complexFabricator.duplicantOperated = false;
complexFabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid;
go.AddOrGet<FabricatorIngredientStatusManager>();
go.AddOrGet<CopyBuildingSettings>();
BuildingTemplates.CreateComplexFabricatorStorage(go, complexFabricator);
this.ConfgiureRecipes();
Prioritizable.AddRef(go);
碎石机的代码
string id = "RockCrusher";
int width = 4;
int height = 4;
string anim = "rockrefinery_kanim";
int hitpoints = 30;
float construction_time = 60f;
float[] tier = TUNING.BUILDINGS.CONSTRUCTION_MASS_KG.TIER5;
string[] all_METALS = MATERIALS.ALL_METALS;
float melting_point = 2400f;
BuildLocationRule build_location_rule = BuildLocationRule.OnFloor;
EffectorValues tier2 = NOISE_POLLUTION.NOISY.TIER6;
BuildingDef buildingDef = BuildingTemplates.CreateBuildingDef(id, width, height, anim, hitpoints, construction_time, tier, all_METALS, melting_point, build_location_rule, TUNING.BUILDINGS.DECOR.PENALTY.TIER2, tier2, 0.2f);
buildingDef.RequiresPowerInput = true;
buildingDef.EnergyConsumptionWhenActive = 120f;
buildingDef.SelfHeatKilowattsWhenActive = 4f;
buildingDef.ViewMode = OverlayModes.Power.ID;
buildingDef.AudioCategory = "HollowMetal";
buildingDef.AudioSize = "large";
return buildingDef;
}
// 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 = true;
ComplexFabricator complexFabricator = go.AddOrGet<ComplexFabricator>();
complexFabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid;
complexFabricator.duplicantOperated = true;
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)
};
对比了一下代码并没有发现有自动和须人操作的概念呢,
有大神指导吗
|
|