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

注册 登录

QQ登录

只需一步,快速开始

查看: 614|回复: 1
打印 上一主题 下一主题

[求助] 大佬们深钻井范围怎么改啊?

[复制链接]

8

主题

59

帖子

286

积分

高级玩家

Rank: 4

贡献度
20
金元
2062
积分
286
精华
0
注册时间
2020-11-25
跳转到指定楼层
主题
发表于 2023-2-28 21:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<specialDisplayRadius>2.6</specialDisplayRadius> <!-- 21 closest cells, must be in sync with CompDeepDrill -->


using System;
using System.Collections.Generic;
using UnityEngine;
using Verse;

namespace RimWorld
{
   
// Token: 0x02001EBB RID: 7867
   
public class CompDeepDrill : ThingComp
   
{
        
// Token: 0x17001A6F RID: 6767
        
// (get) Token: 0x0600ABE1 RID: 44001 RVA: 0x000706F4 File Offset: 0x0006E8F4
        
[Obsolete("Use WorkPerPortionBase constant directly."
        
public static float WorkPerPortionCurrentDifficulty
        
{
            
get
            
{
               
return 10000f;
            
}
        
}

        
// Token: 0x17001A70 RID: 6768
        
// (get) Token: 0x0600ABE2 RID: 44002 RVA: 0x000706FB File Offset: 0x0006E8FB
        
public float ProgressToNextPortionPercent
        
{
            
get
            
{
               
return this.portionProgress / 10000f;
            
}
        
}

        
// Token: 0x0600ABE3 RID: 44003 RVA: 0x0007070A File Offset: 0x0006E90A
        
public override void PostSpawnSetup(bool respawningAfterLoad)
        
{
            
this.powerComp = this.parent.TryGetComp<CompPowerTrader>();
        
}

        
// Token: 0x0600ABE4 RID: 44004 RVA: 0x0007071D File Offset: 0x0006E91D
        
public override void PostExposeData()
        
{
            
Scribe_Values.Look<float>(ref this.portionProgress, "portionProgress", 0f, false);
            
Scribe_Values.Look<float>(ref this.portionYieldPct, "portionYieldPct", 0f, false);
            
Scribe_Values.Look<int>(ref this.lastUsedTick, "lastUsedTick", 0, false);
        
}

        
// Token: 0x0600ABE5 RID: 44005 RVA: 0x00328AB0 File Offset: 0x00326CB0
        
public void DrillWorkDone(Pawn driller)
        
{
            
float statValue = driller.GetStatValue(StatDefOf.DeepDrillingSpeed, true);
            
this.portionProgress += statValue;
            
this.portionYieldPct += statValue * driller.GetStatValue(StatDefOf.MiningYield, true) / 10000f;
            
this.lastUsedTick = Find.TickManager.TicksGame;
            
if (this.portionProgress > 10000f)
            
{
               
this.TryProducePortion(this.portionYieldPct, driller);
               
this.portionProgress = 0f;
               
this.portionYieldPct = 0f;
            
}
        
}

        
// Token: 0x0600ABE6 RID: 44006 RVA: 0x0007075D File Offset: 0x0006E95D
        
public override void PostDeSpawn(Map map)
        
{
            
this.portionProgress = 0f;
            
this.portionYieldPct = 0f;
            
this.lastUsedTick = -99999;
        
}

        
// Token: 0x0600ABE7 RID: 44007 RVA: 0x00328B3C File Offset: 0x00326D3C
        
private void TryProducePortion(float yieldPct, Pawn driller = null)
        
{
            
ThingDef thingDef;
            
int num;
            
IntVec3 intVec;
            
bool nextResource = this.GetNextResource(out thingDef, out num, out intVec);
            
if (thingDef == null)
            
{
               
return;
            
}
            
int num2 = Mathf.Min(num, thingDef.deepCountPerPortion);
            
if (nextResource)
            
{
               
this.parent.Map.deepResourceGrid.SetAt(intVec, thingDef, num - num2);
            
}
            
int stackCount = Mathf.Max(1, GenMath.RoundRandom((float)num2 * yieldPct));
            
Thing thing = ThingMaker.MakeThing(thingDef, null);
            
thing.stackCount = stackCount;
            
GenPlace.TryPlaceThing(thing, this.parent.InteractionCell, this.parent.Map, ThingPlaceMode.Near, null, (IntVec3 p) => p != this.parent.Position && p != this.parent.InteractionCell, default(Rot4));
            
if (driller != null)
            
{
               
Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.Mined, driller.Named(HistoryEventArgsNames.Doer)), true);
            
}
            
if (nextResource && !this.ValuableResourcesPresent())
            
{
               
if (DeepDrillUtility.GetBaseResource(this.parent.Map, this.parent.Position) == null)
               
{
                    
Messages.Message("DeepDrillExhaustedNoFallback".Translate(), this.parent, MessageTypeDefOf.TaskCompletion, true);
                    
return;
               
}
               
Messages.Message("DeepDrillExhausted".Translate(Find.ActiveLanguageWorker.Pluralize(DeepDrillUtility.GetBaseResource(this.parent.Map, this.parent.Position).label, -1)), this.parent, MessageTypeDefOf.TaskCompletion, true);
               
for (int i = 0; i < 21; i++)
               
{
                    
IntVec3 c = intVec + GenRadial.RadialPattern[i];
                    
if (c.InBounds(this.parent.Map))
                    
{
                        
ThingWithComps firstThingWithComp = c.GetFirstThingWithComp(this.parent.Map);
                        
if (firstThingWithComp != null && !firstThingWithComp.GetComp<CompDeepDrill>().ValuableResourcesPresent())
                        
{
                           
firstThingWithComp.SetForbidden(true, true);
                        
}
                    
}
               
}
            
}
        
}

        
// Token: 0x0600ABE8 RID: 44008 RVA: 0x00070780 File Offset: 0x0006E980
        
private bool GetNextResource(out ThingDef resDef, out int countPresent, out IntVec3 cell)
        
{
            
return DeepDrillUtility.GetNextResource(this.parent.Position, this.parent.Map, out resDef, out countPresent, out cell);
        
}

        
// Token: 0x0600ABE9 RID: 44009 RVA: 0x000707A0 File Offset: 0x0006E9A0
        
public bool CanDrillNow()
        
{
            
return (this.powerComp == null || this.powerComp.PowerOn) && (DeepDrillUtility.GetBaseResource(this.parent.Map, this.parent.Position) != null || this.ValuableResourcesPresent());
        
}

        
// Token: 0x0600ABEA RID: 44010 RVA: 0x00328D10 File Offset: 0x00326F10
        
public bool ValuableResourcesPresent()
        
{
            
ThingDef thingDef;
            
int num;
            
IntVec3 intVec;
            
return this.GetNextResource(out thingDef, out num, out intVec);
        
}

        
// Token: 0x0600ABEB RID: 44011 RVA: 0x000707DE File Offset: 0x0006E9DE
        
public bool UsedLastTick()
        
{
            
return this.lastUsedTick >= Find.TickManager.TicksGame - 1;
        
}

        
// Token: 0x0600ABEC RID: 44012 RVA: 0x000707F7 File Offset: 0x0006E9F7
        
public override IEnumerable<Gizmo> CompGetGizmosExtra()
        
{
            
foreach (Gizmo gizmo in base.CompGetGizmosExtra())
            
{
               
yield return gizmo;
            
}
            
IEnumerator<Gizmo> enumerator = null;
            
if (Prefs.DevMode)
            
{
               
yield return new Command_Action
               
{
                    
defaultLabel = "Debug: Produce portion (100% yield)",
                    
action = delegate()
                    
{
                        
this.TryProducePortion(1f, null);
                    
}
               
};
            
}
            
yield break;
            
yield break;
        
}

        
// Token: 0x0600ABED RID: 44013 RVA: 0x00328D2C File Offset: 0x00326F2C
        
public override string CompInspectStringExtra()
        
{
            
if (!this.parent.Spawned)
            
{
               
return null;
            
}
            
ThingDef thingDef;
            
int num;
            
IntVec3 intVec;
            
this.GetNextResource(out thingDef, out num, out intVec);
            
if (thingDef == null)
            
{
               
return "DeepDrillNoResources".Translate();
            
}
            
return "ResourceBelow".Translate() + ": " + thingDef.LabelCap + "\n" + "ProgressToNextPortion".Translate() + ": " + this.ProgressToNextPortionPercent.ToStringPercent("F0");
        
}

        
// Token: 0x04006F47 RID: 28487
        
private CompPowerTrader powerComp;

        
// Token: 0x04006F48 RID: 28488
        
private float portionProgress;

        
// Token: 0x04006F49 RID: 28489
        
private float portionYieldPct;

        
// Token: 0x04006F4A RID: 28490
        
private int lastUsedTick = -99999;

        
// Token: 0x04006F4B RID: 28491
        
private const float WorkPerPortionBase = 10000f;
   
}
}

回复

使用道具 举报

0

主题

56

帖子

77

积分

初级玩家

Rank: 2

贡献度
0
金元
765
积分
77
精华
0
注册时间
2020-4-19
舒服的沙发
发表于 2023-2-28 23:18 | 只看该作者
布吉岛,可考虑找找mod
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-7 21:38 , Processed in 0.152844 second(s), 15 queries , Memcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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