游戏达人
- 贡献度
- 208
- 金元
- 13329
- 积分
- 2165
- 精华
- 0
- 注册时间
- 2014-11-30
|
6#
楼主 |
发表于 2021-10-27 15:01
|
只看该作者
本帖最后由 fanvalen 于 2023-11-9 21:20 编辑
这是一个罐装器自动丢出瓶装气体 20kg一丢 支持8种常见气体using System;
using TUNING;
using UnityEngine;
public class GasBottlerConfig : IBuildingConfig
{
public override BuildingDef CreateBuildingDef()
{
BuildingDef buildingDef = BuildingTemplates.CreateBuildingDef("GasBottler", 3, 2, "gas_bottler_kanim", 100, 120f, BUILDINGS.CONSTRUCTION_MASS_KG.TIER4, MATERIALS.ANY_BUILDABLE, 800f, BuildLocationRule.OnFloor, BUILDINGS.DECOR.PENALTY.TIER1, NOISE_POLLUTION.NOISY.TIER0, 0.2f);
buildingDef.InputConduitType = ConduitType.Gas;
buildingDef.Floodable = false;
buildingDef.ViewMode = OverlayModes.GasConduits.ID;
buildingDef.AudioCategory = "HollowMetal";
buildingDef.UtilityInputOffset = new CellOffset(0, 0);
GeneratedBuildings.RegisterWithOverlay(OverlayScreen.GasVentIDs, "GasBottler");
return buildingDef;
}
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
{
Storage storage = BuildingTemplates.CreateDefaultStorage(go, false);
storage.showDescriptor = true;
storage.storageFilters = STORAGEFILTERS.GASES;
storage.capacityKg = 100000f;
storage.allowItemRemoval = false;
go.AddOrGet<DropAllWorkable>();
GasBottler gasBottler = go.AddOrGet<GasBottler>();
gasBottler.storage = storage;
gasBottler.workTime = 9f;
ConduitConsumer conduitConsumer = go.AddOrGet<ConduitConsumer>();
conduitConsumer.storage = storage;
conduitConsumer.conduitType = ConduitType.Gas;
conduitConsumer.ignoreMinMassCheck = true;
conduitConsumer.forceAlwaysSatisfied = true;
conduitConsumer.alwaysConsume = true;
conduitConsumer.capacityKG = storage.capacityKg;
conduitConsumer.keepZeroMassObject = false;
ElementDropper elementDropper = go.AddComponent<ElementDropper>();
elementDropper.emitMass = 20f;
elementDropper.emitTag = new Tag("gas");
elementDropper.emitOffset = new Vector3(0f, 1f, 0f);
}
public override void DoPostConfigureComplete(GameObject go)
{
go.GetComponent<KPrefabID>().AddTag(GameTags.OverlayBehindConduits, false);
}
public const string ID = "GasBottler";
private const ConduitType CONDUIT_TYPE = ConduitType.Gas;
private const int WIDTH = 3;
private const int HEIGHT = 2;
}
|
|