55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using RimWorld;
|
|
using System.Collections.Generic;
|
|
using Verse;
|
|
|
|
namespace ArachnaeSwarm
|
|
{
|
|
/// <summary>
|
|
/// 自定义虫洞传送门生成器
|
|
/// </summary>
|
|
public class BuildingGroundSpawner_WormholePortal : BuildingGroundSpawner
|
|
{
|
|
// 存储要传递的Pawn列表
|
|
public List<Pawn> emergingPawns = new List<Pawn>();
|
|
|
|
// 延迟参数
|
|
public IntRange? customEmergeDelay = null;
|
|
|
|
protected override void PostMakeInt()
|
|
{
|
|
base.PostMakeInt();
|
|
|
|
// 创建虫洞传送门
|
|
ThingDef portalDef = DefDatabase<ThingDef>.GetNamed("ARA_WormholePortal");
|
|
if (portalDef != null)
|
|
{
|
|
thingToSpawn = ThingMaker.MakeThing(portalDef);
|
|
|
|
// 设置Pawn列表
|
|
Comp_WormholePortal comp = thingToSpawn.TryGetComp<Comp_WormholePortal>();
|
|
if (comp != null && emergingPawns != null)
|
|
{
|
|
comp.SetEmergingPawns(emergingPawns);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override IntRange ResultSpawnDelay
|
|
{
|
|
get
|
|
{
|
|
if (customEmergeDelay.HasValue)
|
|
return customEmergeDelay.Value;
|
|
return base.ResultSpawnDelay;
|
|
}
|
|
}
|
|
|
|
public override void ExposeData()
|
|
{
|
|
base.ExposeData();
|
|
Scribe_Collections.Look(ref emergingPawns, "emergingPawns", LookMode.Reference);
|
|
Scribe_Values.Look(ref customEmergeDelay, "customEmergeDelay");
|
|
}
|
|
}
|
|
}
|