3DMGAME 3DM首页 新闻中心 前瞻 | 评测 游戏库 热门 | 最新 攻略中心 攻略 | 秘籍 下载中心 游戏 | 汉化 购买正版 论坛

注册 登录

QQ登录

只需一步,快速开始

查看: 2288|回复: 8
打印 上一主题 下一主题

[原创] 魔改将空罐器改成手动瓶装气体装回气体管道

[复制链接]

141

主题

857

帖子

2872

积分

游戏达人

Rank: 7Rank: 7Rank: 7

贡献度
270
金元
17924
积分
2872
精华
0
注册时间
2014-11-30
跳转到指定楼层
主题
发表于 2021-10-26 15:41 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 fanvalen 于 2024-7-7 20:34 编辑

魔改的原理就是用空罐器加上气体管道出口,使空瓶不发射到周围
我在空瓶功能里设置了一个发射标志位
BottleEmptier bottleEmptier = go.AddOrGet<BottleEmptier>();
bottleEmptier.emit=false;
下面是效果和改的代码

这个是建造代码最后在tuning.buildings下添加BottleEmptierGas2,(这个要下面添加好保存了再来添加这个否则会失败)using System;
using TUNING;
using UnityEngine;


public class BottleEmptierGasConfig2 : IBuildingConfig
{
        public override BuildingDef CreateBuildingDef()
        {
                string id = "BottleEmptierGas2";
                int width = 1;
                int height = 3;
                string anim = "gas_emptying_station_kanim";
                int hitpoints = 30;
                float construction_time = 60f;
                float[] tier = BUILDINGS.CONSTRUCTION_MASS_KG.TIER2;
                string[] refined_METALS = MATERIALS.REFINED_METALS;
                float melting_point = 1600f;
                BuildLocationRule build_location_rule = BuildLocationRule.Anywhere;
                EffectorValues tier2 = NOISE_POLLUTION.NOISY.TIER1;
                BuildingDef buildingDef = BuildingTemplates.CreateBuildingDef(id, width, height, anim, hitpoints, construction_time, tier, refined_METALS, melting_point, build_location_rule, BUILDINGS.DECOR.PENALTY.TIER2, tier2, 0.2f);
                buildingDef.Floodable = false;
                buildingDef.AudioCategory = "Metal";
                buildingDef.Overheatable = false;
                buildingDef.PermittedRotations = PermittedRotations.FlipH;
                buildingDef.OutputConduitType = ConduitType.Gas;
                buildingDef.UtilityOutputOffset = new CellOffset(0, 1);
                return buildingDef;
        }


        public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
                Prioritizable.AddRef(go);
                Storage storage = go.AddOrGet<Storage>();
                storage.storageFilters = STORAGEFILTERS.GASES;
                storage.showInUI = true;
                storage.showDescriptor = true;
                storage.capacityKg = 2000f;
                go.AddOrGet<TreeFilterable>();
                BottleEmptier bottleEmptier = go.AddOrGet<BottleEmptier>();
                bottleEmptier.isGasEmptier = true;
                bottleEmptier.emptyRate = 1000f;
                bottleEmptier.isEmit = false;
                ConduitDispenser conduitDispenser = go.AddOrGet<ConduitDispenser>();
                conduitDispenser.conduitType = ConduitType.Gas;
                conduitDispenser.alwaysDispense = true;
                conduitDispenser.elementFilter = null;
        }


        public override void DoPostConfigureComplete(GameObject go)
        {
        }


        public BottleEmptierGasConfig2()
        {
        }


        public const string ID = "BottleEmptierGas2";
}

先添加public bool isEmit = true;
再修改下面
BottleEmptier里找public void Emit(float dt)改成下面这样
主要就是添加判断是否发射if (base.master.isEmit){}

public void Emit(float dt)
                {
                        if (base.master.isEmit)
                        {
                                PrimaryElement firstPrimaryElement = this.GetFirstPrimaryElement();
                                if (firstPrimaryElement == null)
                                {
                                        return;
                                }
                                Storage component = base.GetComponent<Storage>();
                                float num = Mathf.Min(firstPrimaryElement.Mass, base.master.emptyRate * dt);
                                if (num <= 0f)
                                {
                                        return;
                                }
                                Tag prefabTag = firstPrimaryElement.GetComponent<KPrefabID>().PrefabTag;
                                float num2;
                                SimUtil.DiseaseInfo diseaseInfo;
                                float temperature;
                                component.ConsumeAndGetDisease(prefabTag, num, out num2, out diseaseInfo, out temperature);
                                Vector3 position = base.transform.GetPosition();
                                position.y += 1.8f;
                                bool flag = base.GetComponent<Rotatable>().GetOrientation() == Orientation.FlipH;
                                position.x += (flag ? -0.2f : 0.2f);
                                int num3 = Grid.PosToCell(position) + (flag ? -1 : 1);
                                if (Grid.Solid[num3])
                                {
                                        num3 += (flag ? 1 : -1);
                                }
                                Element element = firstPrimaryElement.Element;
                                byte idx = element.idx;
                                if (element.IsLiquid)
                                {
                                        FallingWater.instance.AddParticle(num3, idx, num2, temperature, diseaseInfo.idx, diseaseInfo.count, true, false, false, false);
                                        return;
                                }
                                SimMessages.ModifyCell(num3, (int)idx, temperature, num2, diseaseInfo.idx, diseaseInfo.count, SimMessages.ReplaceType.None, false, -1);
                        }
                }



我设置的标志位是public bool emit = true;
在Emit功能里做了判断
true的时候执行原来的功能
false就不执行发射



回复

使用道具 举报

141

主题

857

帖子

2872

积分

游戏达人

Rank: 7Rank: 7Rank: 7

贡献度
270
金元
17924
积分
2872
精华
0
注册时间
2014-11-30
舒服的沙发
 楼主| 发表于 2021-11-18 18:16 | 只看该作者
本帖最后由 fanvalen 于 2024-9-4 17:08 编辑

上面是气体装管
这个是液体装管必须要等上面的添加好了再添加这个
最后都要添加到tuning.buildings下加BottleEmptier2
using System;
using TUNING;
using UnityEngine;

// Token: 0x02002C2A RID: 11306
public class BottleEmptierConfig2 : IBuildingConfig
{
        // Token: 0x0600B020 RID: 45088
        public override BuildingDef CreateBuildingDef()
        {
                string id = "BottleEmptier2";
                int width = 1;
                int height = 3;
                string anim = "liquidator_kanim";
                int hitpoints = 30;
                float construction_time = 10f;
                float[] tier = BUILDINGS.CONSTRUCTION_MASS_KG.TIER4;
                string[] raw_MINERALS = MATERIALS.RAW_MINERALS;
                float melting_point = 1600f;
                BuildLocationRule build_location_rule = BuildLocationRule.Anywhere;
                EffectorValues none = NOISE_POLLUTION.NONE;
                BuildingDef buildingDef = BuildingTemplates.CreateBuildingDef(id, width, height, anim, hitpoints, construction_time, tier, raw_MINERALS, melting_point, build_location_rule, BUILDINGS.DECOR.PENALTY.TIER1, none, 0.2f);
                buildingDef.Floodable = false;
                buildingDef.AudioCategory = "Metal";
                buildingDef.Overheatable = false;
                buildingDef.PermittedRotations = PermittedRotations.FlipH;
                buildingDef.OutputConduitType = ConduitType.Liquid;
                buildingDef.UtilityOutputOffset = new CellOffset(0, 1);
                return buildingDef;
        }

        // Token: 0x0600B021 RID: 45089
        public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
                Prioritizable.AddRef(go);
                Storage storage = go.AddOrGet<Storage>();
                storage.storageFilters = STORAGEFILTERS.LIQUIDS;
                storage.showInUI = true;
                storage.showDescriptor = true;
                storage.capacityKg = 2000f;
                go.AddOrGet<TreeFilterable>();
                go.AddOrGet<BottleEmptier>();
                BottleEmptier bottleEmptier = go.AddOrGet<BottleEmptier>();
                bottleEmptier.isGasEmptier = false;
                bottleEmptier.emptyRate = 1000f;
                bottleEmptier.isEmit = false;
                ConduitDispenser conduitDispenser = go.AddOrGet<ConduitDispenser>();
                conduitDispenser.conduitType = ConduitType.Liquid;
                conduitDispenser.alwaysDispense = true;
                conduitDispenser.elementFilter = null;
        }

        // Token: 0x0600B022 RID: 45090
        public override void DoPostConfigureComplete(GameObject go)
        {
        }

        // Token: 0x0600B023 RID: 45091
        public BottleEmptierConfig2()
        {
        }

        // Token: 0x0400B061 RID: 45153
        public const string ID = "BottleEmptier2";
}


回复 支持 反对

使用道具 举报

37

主题

339

帖子

684

积分

超级玩家

Rank: 5Rank: 5

贡献度
11
金元
6403
积分
684
精华
0
注册时间
2018-9-1
硬硬的板凳
发表于 2021-12-31 10:04 | 只看该作者
本帖最后由 随便VV逛逛 于 2021-12-31 10:05 编辑
fanvalen 发表于 2021-11-18 18:16
上面是气体装管
这个是液体装管必须要等上面的添加好了再添加这个
最后都要添加到tuning.buildings下加Bott ...

能不能详细点介绍,在原建筑的基础上,再添加一个修改过的建筑啊BottleEmptierConfig2
回复 支持 反对

使用道具 举报

141

主题

857

帖子

2872

积分

游戏达人

Rank: 7Rank: 7Rank: 7

贡献度
270
金元
17924
积分
2872
精华
0
注册时间
2014-11-30
冰凉的地板
 楼主| 发表于 2021-12-31 12:58 | 只看该作者
随便VV逛逛 发表于 2021-12-31 10:04
能不能详细点介绍,在原建筑的基础上,再添加一个修改过的建筑啊BottleEmptierConfig2 ...

编辑添加类把完整代码复制进去保存,再编辑找BottleEmptierConfig2
回复 支持 反对

使用道具 举报

0

主题

56

帖子

142

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1415
积分
142
精华
0
注册时间
2017-4-19
5#
发表于 2023-4-8 07:19 | 只看该作者
is emit找不到该定义何解,以前改过一次瞎捣鼓成功了。
回复 支持 反对

使用道具 举报

141

主题

857

帖子

2872

积分

游戏达人

Rank: 7Rank: 7Rank: 7

贡献度
270
金元
17924
积分
2872
精华
0
注册时间
2014-11-30
6#
 楼主| 发表于 2023-4-8 08:35 | 只看该作者
wz1 发表于 2023-4-8 07:19
is emit找不到该定义何解,以前改过一次瞎捣鼓成功了。

你这也太早了,
先在核心功能里创建一个变量叫isemit
保存重新加载文件就可以访问了,否则读取不到
回复 支持 反对

使用道具 举报

0

主题

56

帖子

142

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1415
积分
142
精华
0
注册时间
2017-4-19
7#
发表于 2023-4-8 14:54 | 只看该作者
fanvalen 发表于 2023-4-8 08:35
你这也太早了,
先在核心功能里创建一个变量叫isemit
保存重新加载文件就可以访问了,否则读取不到

感谢大佬,之前变量给BottleEmptier 里面创建了,但是好像没打对。感谢感谢
回复 支持 反对

使用道具 举报

0

主题

56

帖子

142

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1415
积分
142
精华
0
注册时间
2017-4-19
8#
发表于 2024-8-23 00:44 | 只看该作者
这个现在还能改吗,改完发现气压服会一直充气
回复 支持 反对

使用道具 举报

0

主题

56

帖子

142

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1415
积分
142
精华
0
注册时间
2017-4-19
9#
发表于 2024-8-23 01:57 | 只看该作者
气压服解决了,发现空瓶消耗完还会在哪duangduang动,小人不会搬运添加,可能版本问题吧,
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|3DMGAME ( 京ICP备14006952号-1  沪公网安备 31011202006753号

GMT+8, 2026-3-29 14:28 , Processed in 0.030124 second(s), 18 queries , Memcached On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表