diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 574c3952..7f239389 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_Spawner.xml b/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_Spawner.xml new file mode 100644 index 00000000..023f2222 --- /dev/null +++ b/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_Spawner.xml @@ -0,0 +1,103 @@ + + + + + WULA_ComponentAssembler + + 一台复杂的机器,可以缓慢地用原材料组装零部件。需要钢铁和木材才能运作。 + Building + + Things/Building/Production/FabricationBench + Graphic_Multi + (3.5, 1.5) + + Damage/Corner + Damage/Corner + Damage/Corner + Damage/Corner + + + Building + PassThroughOnly + 0.5 + 70 + true + + 350 + 4000 + 1.0 + -15 + + Normal + (3,1) + + 200 + 8 + + + +
  • + CompPowerTrader + 350 +
  • +
  • + + +
  • + 120000~120000 + +
  • + ComponentIndustrial + 5 +
  • +
  • + ComponentSpacer + 1 +
  • + + true + + + +
  • + steel + 钢材储量 + + +
  • Steel
  • + + + 200 + 1 + true + true + true + + + +
  • + wood + 木材储量 + + +
  • WoodLog
  • + + + 300 + 2 + true + true + true + + +
  • + + Heavy + Production + 6 + +
  • Fabrication
  • + +
    + +
    \ No newline at end of file diff --git a/MCP/vector_cache/knowledge_cache.json b/MCP/vector_cache/knowledge_cache.json index 2d96bca7..b842bca5 100644 --- a/MCP/vector_cache/knowledge_cache.json +++ b/MCP/vector_cache/knowledge_cache.json @@ -42425,5 +42425,3111 @@ ], "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\RimWorld\\Building_Turret.txt\n\npublic abstract class Building_Turret : Building, IAttackTarget, ILoadReferenceable, IAttackTargetSearcher\n{\n\tprotected LocalTargetInfo forcedTarget = LocalTargetInfo.Invalid;\n\n\tprivate LocalTargetInfo lastAttackedTarget;\n\n\tprivate int lastAttackTargetTick;\n\n\tprivate StunHandler stunner;\n\n\tprivate bool triedGettingStunner;\n\n\tprivate const float SightRadiusTurret = 13.4f;\n\n\tpublic abstract LocalTargetInfo CurrentTarget { get; }\n\n\tpublic abstract Verb AttackVerb { get; }\n\n\tpublic virtual Material TurretTopMaterial => def.building.turretTopMat;\n\n\tprotected bool IsStunned\n\t{\n\t\tget\n\t\t{\n\t\t\tif (!triedGettingStunner)\n\t\t\t{\n\t\t\t\tstunner = GetComp()?.StunHandler;\n\t\t\t\ttriedGettingStunner = true;\n\t\t\t}\n\t\t\tif (stunner != null)\n\t\t\t{\n\t\t\t\treturn stunner.Stunned;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tThing IAttackTarget.Thing => this;\n\n\tpublic LocalTargetInfo TargetCurrentlyAimingAt => CurrentTarget;\n\n\tThing IAttackTargetSearcher.Thing => this;\n\n\tpublic Verb CurrentEffectiveVerb => AttackVerb;\n\n\tpublic LocalTargetInfo LastAttackedTarget => lastAttackedTarget;\n\n\tpublic int LastAttackTargetTick => lastAttackTargetTick;\n\n\tpublic float TargetPriorityFactor => 1f;\n\n\tpublic LocalTargetInfo ForcedTarget => forcedTarget;\n\n\tpublic virtual bool IsEverThreat => true;\n\n\tprotected override void Tick()\n\t{\n\t\tbase.Tick();\n\t\tif (forcedTarget.HasThing && (!forcedTarget.Thing.Spawned || !base.Spawned || forcedTarget.Thing.Map != base.Map))\n\t\t{\n\t\t\tforcedTarget = LocalTargetInfo.Invalid;\n\t\t}\n\t}\n\n\tpublic override void ExposeData()\n\t{\n\t\tbase.ExposeData();\n\t\tScribe_TargetInfo.Look(ref forcedTarget, \"forcedTarget\");\n\t\tScribe_TargetInfo.Look(ref lastAttackedTarget, \"lastAttackedTarget\");\n\t\tScribe_Values.Look(ref lastAttackTargetTick, \"lastAttackTargetTick\", 0);\n\t}\n\n\tpublic override void PreApplyDamage(ref DamageInfo dinfo, out bool absorbed)\n\t{\n\t\tbase.PreApplyDamage(ref dinfo, out absorbed);\n\t\tif (!absorbed)\n\t\t{\n\t\t\tabsorbed = false;\n\t\t}\n\t}\n\n\tpublic abstract void OrderAttack(LocalTargetInfo targ);\n\n\tpublic bool ThreatDisabled(IAttackTargetSearcher disabledFor)\n\t{\n\t\tif (!IsEverThreat)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tCompPowerTrader comp = GetComp();\n\t\tif (comp != null && !comp.PowerOn)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tCompMannable comp2 = GetComp();\n\t\tif (comp2 != null && !comp2.MannedNow)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tCompCanBeDormant comp3 = GetComp();\n\t\tif (comp3 != null && !comp3.Awake)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tCompInitiatable comp4 = GetComp();\n\t\tif (comp4 != null && !comp4.Initiated)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tCompMechPowerCell comp5 = GetComp();\n\t\tif (comp5 != null && comp5.depleted)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tCompHackable comp6 = GetComp();\n\t\tif (comp6 != null && comp6.IsHacked)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprotected void OnAttackedTarget(LocalTargetInfo target)\n\t{\n\t\tlastAttackTargetTick = Find.TickManager.TicksGame;\n\t\tlastAttackedTarget = target;\n\t}\n}\n\n", "timestamp": "2025-08-28 12:23:26,593" + }, + "CompProperties_Refuelable": { + "keywords": [ + "CompProperties_Refuelable" + ], + "question": "class CompProperties_Refuelable", + "embedding": [ + 0.043891970068216324, + 0.021217426285147667, + 0.039580088108778, + 0.02193111553788185, + -0.06904955953359604, + -0.008475075475871563, + 0.006315418053418398, + -0.00701052276417613, + -0.003748734015971422, + 0.09444504976272583, + 0.04995834082365036, + -0.04062088578939438, + -0.027179716154932976, + -0.007954675704240799, + 0.006761474534869194, + 0.012281425297260284, + -0.042702484875917435, + -0.12019738554954529, + -0.016950150951743126, + 0.04148326441645622, + 0.02590101957321167, + 0.04525987431406975, + 0.019225038588047028, + 0.021886510774493217, + 0.0072447024285793304, + 0.0024421599227935076, + -0.01500236988067627, + 0.07351012527942657, + 0.058373939245939255, + -0.0277447197586298, + 0.0578981451690197, + -0.0023250700905919075, + -0.006211338099092245, + -0.026005100458860397, + -0.03080764226615429, + 0.0414535254240036, + 0.01727725937962532, + -0.00961995404213667, + -0.029945265501737595, + 0.009151594713330269, + 0.009337451308965683, + -0.013790583238005638, + -0.007188945543020964, + 0.020399654284119606, + -0.01016265619546175, + -0.002345514250919223, + 0.021559402346611023, + -0.02961815893650055, + -0.01858569122850895, + 0.030316980555653572, + -0.009590216912329197, + -0.022927308455109596, + -0.055994972586631775, + 0.012162476778030396, + 0.006259660702198744, + 0.014942895621061325, + 0.019329119473695755, + 0.029826316982507706, + -0.018169371411204338, + 0.03202686458826065, + 0.014370456337928772, + 0.052932050079107285, + -0.020027941092848778, + -0.04567619413137436, + -0.013195840641856194, + -0.01766384206712246, + -0.0007308823405764997, + 0.004743068479001522, + 0.004735634196549654, + -0.01726238988339901, + 0.04966096952557564, + -0.009523308835923672, + -0.03470320254564285, + -0.015195661224424839, + -0.04823358729481697, + 0.040204569697380066, + 0.01043772418051958, + 0.00044698588317260146, + -0.036725327372550964, + -0.006322852335870266, + -0.020399654284119606, + -0.0061704497784376144, + -0.05367547646164894, + 0.015998562797904015, + 0.024756141006946564, + 0.0651242658495903, + 0.012043528258800507, + -0.0629831925034523, + 0.027135109528899193, + 0.053853899240493774, + 0.0374390184879303, + -0.004817411303520203, + 0.009649691171944141, + -0.04294038191437721, + 0.01035594753921032, + -0.016935281455516815, + -0.007069997023791075, + 0.017901737242937088, + -0.02230283059179783, + -0.010311341844499111, + -0.03282976523041725, + -0.0640537291765213, + -0.08213388919830322, + 0.0694064050912857, + -0.005568273365497589, + 0.04463539645075798, + -0.04424881562590599, + 0.014266377314925194, + -0.019343987107276917, + 0.03723085671663284, + -0.006649960298091173, + -0.0699416771531105, + -0.026064574718475342, + 0.03372187912464142, + 0.013441172428429127, + -0.00022535151219926775, + 0.026272732764482498, + 0.013247881084680557, + 0.008876526728272438, + 0.008430469781160355, + 0.018139634281396866, + -0.004572079982608557, + -0.033959776163101196, + -0.03758770227432251, + 0.02961815893650055, + 0.022823229432106018, + -0.027135109528899193, + 0.024250609800219536, + -0.01953727938234806, + 0.0554894395172596, + 0.016637912020087242, + -0.01767870970070362, + -0.011984053999185562, + -0.03164028003811836, + 0.0039847721345722675, + 0.01806529238820076, + -0.029023416340351105, + -0.020265838131308556, + -0.10586410015821457, + 0.014035914093255997, + -0.06910903751850128, + -0.00040563271613791585, + -0.05224809795618057, + 0.06488636881113052, + 0.12299267202615738, + -0.03836086764931679, + -0.05724392831325531, + -0.03265134245157242, + 0.005025571212172508, + 0.007382236886769533, + -0.00875757820904255, + -0.011158849112689495, + -0.024771010503172874, + 0.03494109958410263, + -0.004687311593443155, + -0.0433269627392292, + 0.028666570782661438, + -0.019299382343888283, + 0.026540366932749748, + -0.01941833086311817, + 0.0011708985548466444, + 0.020949792116880417, + -0.015463295392692089, + -0.0013595432974398136, + 0.03330555930733681, + -0.006151863839477301, + -0.0021187688689678907, + -0.0075978306122124195, + -0.034613993018865585, + -0.01102503202855587, + 0.0006114692660048604, + 0.008400732651352882, + -0.010883781127631664, + 0.007843161933124065, + 0.01008831337094307, + -0.00630798377096653, + 0.02658497355878353, + 0.04966096952557564, + 0.027016161009669304, + -0.0003143305075354874, + 0.06268581748008728, + 0.0016457629390060902, + 0.003139123320579529, + -0.0033379902597516775, + -0.009434097446501255, + -0.049333859235048294, + -0.0312239620834589, + -0.011582602746784687, + 0.013679069466888905, + 0.009909890592098236, + -0.001910609076730907, + 0.03517899662256241, + -0.03758770227432251, + 0.028621964156627655, + -0.0028807821217924356, + -0.0040182266384363174, + -0.004679877310991287, + 0.004642705898731947, + -0.027967749163508415, + 0.007768819108605385, + 0.015641717240214348, + -0.050553079694509506, + -0.005921401549130678, + 0.014838816598057747, + 0.028517885133624077, + -0.0153443468734622, + 0.040650624781847, + -0.00611097551882267, + 0.016504094004631042, + -0.002821308095008135, + 0.049095962196588516, + 0.010593844577670097, + -0.004215234890580177, + -0.05899842083454132, + 0.019790044054389, + 0.007326479535549879, + -0.04862016811966896, + -0.011262929067015648, + 0.02057807706296444, + -0.01307689305394888, + -0.05233730748295784, + -0.008854223415255547, + -3.107295196969062e-05, + 0.03547636792063713, + 0.06027711555361748, + 0.0038695409893989563, + 0.046568308025598526, + -0.031432121992111206, + 0.006378609221428633, + -0.025722596794366837, + -0.015641717240214348, + -0.043773021548986435, + -0.08653497695922852, + -0.012095567770302296, + 0.03889613598585129, + 0.016801465302705765, + -0.04383249580860138, + -0.00790263619273901, + -0.0038992781192064285, + -4.4489497668109834e-05, + 0.011359574273228645, + 0.03178896754980087, + 0.03080764226615429, + 0.02976684458553791, + -0.0094935717061162, + -0.023551788181066513, + -0.017886869609355927, + -0.03574400022625923, + -0.008207441307604313, + 0.014355587773025036, + -0.03425714746117592, + 0.046806205064058304, + 0.009872719645500183, + 0.014846250414848328, + -0.018704639747738838, + -0.008623761124908924, + -0.0050924792885780334, + 0.018838457763195038, + 0.01672712154686451, + 0.01055667269974947, + -0.04793621599674225, + 0.06339950859546661, + 0.004891754128038883, + -0.026376813650131226, + -0.003585179802030325, + 0.01686093956232071, + 0.0173813384026289, + 0.06601637601852417, + -0.01858569122850895, + 0.013515515252947807, + -0.030242636799812317, + 0.0366361141204834, + 0.04847148433327675, + -0.029573552310466766, + -0.0005203993641771376, + -0.004679877310991287, + 0.044159602373838425, + -0.02163374423980713, + -0.01515105552971363, + -0.004430829081684351, + 0.011656945571303368, + -0.003824935294687748, + -0.018422137945890427, + 0.003590755630284548, + -0.029543815180659294, + 0.008519681170582771, + 0.04050193727016449, + 0.0022191316820681095, + -0.009776073507964611, + -0.002945832209661603, + 0.005538536235690117, + -0.01778279058635235, + 0.0077242134138941765, + -0.01967109553515911, + 0.015188227407634258, + -0.008162835612893105, + -0.010393118485808372, + 0.00837099552154541, + -0.03161054477095604, + -0.0015333195915445685, + -0.025677992030978203, + -0.010995294898748398, + 0.019834650680422783, + 0.023061126470565796, + 0.02297191508114338, + 0.025544174015522003, + 0.00451632309705019, + -0.14702025055885315, + -0.00896573718637228, + -0.10134405642747879, + -0.001797236385755241, + 0.022927308455109596, + -0.012772087007761002, + -0.0029625592287629843, + -0.03428688272833824, + 0.0573628768324852, + -0.0076721734367311, + 0.023581525310873985, + 0.007850595749914646, + 0.05391337350010872, + -0.06304266303777695, + 0.02123229391872883, + -0.07547277957201004, + 0.030480533838272095, + 0.03880692273378372, + -0.03532768413424492, + 0.024904826655983925, + 0.03318661078810692, + 0.02658497355878353, + -0.02111334539949894, + -0.024280346930027008, + -0.015864746645092964, + 0.004720765631645918, + 0.053318630903959274, + -0.03285950422286987, + 0.032591868191957474, + 0.03559531643986702, + 0.03586294874548912, + 0.0020016790367662907, + 0.007333913818001747, + -0.0034253429621458054, + -0.05218862369656563, + 0.0062633780762553215, + -0.010311341844499111, + 0.037795864045619965, + 0.013039721176028252, + 0.013396566733717918, + 0.07029852271080017, + -0.02655523642897606, + -0.016370277851819992, + 0.0188533253967762, + 0.015329478308558464, + -0.01715831086039543, + 0.0358332134783268, + 0.011872540228068829, + -0.01382032036781311, + -0.0189871434122324, + -0.010177524760365486, + 0.0005106418975628912, + 0.018005818128585815, + 0.007222399581223726, + 0.03431662172079086, + -0.04647909849882126, + 0.01711370423436165, + 0.022763755172491074, + 0.03547636792063713, + 0.015039541758596897, + 0.016920413821935654, + -0.01990899257361889, + 0.035000573843717575, + -0.021024134010076523, + -0.06399425119161606, + -0.03443557024002075, + 0.020013073459267616, + 0.03277029097080231, + 0.07767332345247269, + -0.02707563526928425, + 0.05435943230986595, + -0.0301534254103899, + 0.020414523780345917, + -0.01993872970342636, + 0.01460835337638855, + -0.020786236971616745, + -0.02789340540766716, + -0.012630836106836796, + 0.015329478308558464, + 0.012801824137568474, + -0.01819910854101181, + 0.005311790853738785, + -0.01779765821993351, + 0.04169142246246338, + 0.026926949620246887, + -0.023700473830103874, + -0.020905185490846634, + 0.02535088360309601, + 0.0019626489374786615, + 0.042196955531835556, + 0.023938370868563652, + 0.07565119862556458, + -0.008608892560005188, + -0.020533472299575806, + -0.013686503283679485, + -0.05421074479818344, + 0.024087056517601013, + -0.012065830640494823, + -0.03271081671118736, + 0.00684696901589632, + 0.018808720633387566, + 0.01274234987795353, + -0.009248239919543266, + -0.03277029097080231, + -0.044575922191143036, + 0.09825140237808228, + -0.011359574273228645, + -0.002174525987356901, + 0.0050924792885780334, + 1.206617980642477e-05, + -0.027328401803970337, + 0.0017219643341377378, + -0.014429930597543716, + -0.02549956925213337, + 0.0192547757178545, + -0.04347565025091171, + -0.005230013746768236, + -0.006122126709669828, + -0.029439736157655716, + -0.024622324854135513, + 0.014727301895618439, + -0.021574269980192184, + 0.005125933792442083, + -0.006623940542340279, + -0.01506927888840437, + -0.10705358535051346, + 0.0560247078537941, + 0.0027952881064265966, + -0.014296113513410091, + -0.0028882164042443037, + 0.006553314626216888, + -0.037409279495477676, + 0.006151863839477301, + -0.03922324255108833, + 0.009255674667656422, + 0.04606277868151665, + -0.012110436335206032, + -0.0366361141204834, + -0.01727725937962532, + 0.00518169067800045, + -0.04261327534914017, + 0.060515012592077255, + -0.01327761821448803, + -0.020503735169768333, + -0.023997845128178596, + 0.007337631192058325, + -0.0041966489516198635, + -0.0355655811727047, + 0.022481253370642662, + -0.04341617599129677, + -0.05007728561758995, + -0.026629578322172165, + -0.0022823228500783443, + 0.04460566118359566, + -0.040977731347084045, + -0.03809323534369469, + 0.03125369921326637, + 0.018942536786198616, + 0.008988040499389172, + 0.009389491751790047, + -0.010407987050712109, + -0.04142379015684128, + -0.04876885563135147, + 0.04410012811422348, + -0.0032153245992958546, + 0.020369917154312134, + 0.020280705764889717, + 0.004274709150195122, + -0.014400193467736244, + -0.03577373921871185, + 0.05715471878647804, + 0.005151953548192978, + 0.02377481758594513, + 0.011575168929994106, + 0.010422855615615845, + -0.005293204914778471, + 0.010028839111328125, + -0.16617095470428467, + -0.0288152564316988, + -0.0001222009159391746, + 0.010913518257439137, + 0.04326748847961426, + -0.018764114007353783, + -0.01121832337230444, + -0.027967749163508415, + -0.01121832337230444, + 0.009456399828195572, + -0.02499403804540634, + 0.019552147015929222, + 0.0012954226695001125, + -0.01402104552835226, + -0.009025211445987225, + -0.06161528453230858, + -0.0019310533534735441, + 0.02670392207801342, + 0.0018409127369523048, + -0.022094670683145523, + -0.0013883512001484632, + -0.014325850643217564, + -0.03229449689388275, + 0.05926605314016342, + -0.00226002000272274, + -0.01871950924396515, + 0.009634822607040405, + 0.008378429338335991, + 0.0476091094315052, + 0.007493750657886267, + -0.05325915664434433, + -0.0003480170853435993, + 0.025737466290593147, + 0.09349346160888672, + 0.01923990808427334, + -0.015255135484039783, + 0.017292127013206482, + -0.0014292396372184157, + 0.04047220200300217, + -0.01659330539405346, + -0.02618352323770523, + 0.0035368571989238262, + -0.03987745940685272, + -0.005163105204701424, + 0.005207710899412632, + -0.038450077176094055, + -0.02096465975046158, + 0.03169975429773331, + 0.03523847088217735, + 0.010281604714691639, + 0.04713331535458565, + -0.020414523780345917, + 0.01515105552971363, + 0.0032952430192381144, + -0.008594023995101452, + 0.09325556457042694, + 0.04713331535458565, + -0.004059114959090948, + -0.002029557479545474, + 0.020399654284119606, + 0.02616865374147892, + -0.012653138488531113, + 0.041512999683618546, + -0.051088348031044006, + 0.020161759108304977, + 0.006854402832686901, + -0.015009804628789425, + 0.009813245385885239, + 0.02163374423980713, + -0.007999281398952007, + 0.03847981616854668, + -0.008869091980159283, + 0.019061485305428505, + 0.04041272774338722, + -0.016831202432513237, + -0.014816513285040855, + -0.02829485759139061, + -0.03158080577850342, + -0.0063971951603889465, + -0.06423214823007584, + 0.012630836106836796, + -0.00541587034240365, + -0.021068740636110306, + 0.024875089526176453, + -0.005334093701094389, + 0.03384082764387131, + -0.04276195913553238, + 0.005631464533507824, + -0.026629578322172165, + 0.02337336540222168, + 0.06429162621498108, + -0.006386043503880501, + 0.030718430876731873, + 0.031164487823843956, + 0.049363598227500916, + 0.008928566239774227, + 0.0008633053512312472, + -0.015552506782114506, + -0.026748526841402054, + -0.014474536292254925, + 0.008185138925909996, + 0.01308432687073946, + 0.02203519642353058, + 0.02817590907216072, + 0.04924464970827103, + -0.024875089526176453, + 0.04778752848505974, + 0.03955035284161568, + -0.05831446498632431, + -0.019611621275544167, + -0.021172819659113884, + 0.023566657677292824, + -0.0009195270831696689, + -0.01062358170747757, + 0.009322582744061947, + 0.011329837143421173, + -0.0004200366383884102, + -0.030896853655576706, + -0.029291050508618355, + 0.00284175225533545, + -0.019700832664966583, + -0.0050553083419799805, + 0.03981798514723778, + -0.005984592717140913, + 0.029662763699889183, + 0.013783148489892483, + 0.028666570782661438, + 0.008891395293176174, + 0.023968107998371124, + -0.0014478253433480859, + 0.02747708559036255, + -0.0017070957692340016, + -0.014548879116773605, + 0.0411858931183815, + -0.00857172068208456, + 0.04594383016228676, + -0.015388952568173409, + 0.013998743146657944, + 0.00930028036236763, + -0.01553763821721077, + 0.012340899556875229, + -0.03586294874548912, + 0.009679428301751614, + -0.03883666172623634, + 0.06069343537092209, + -0.05632207915186882, + -0.09057922661304474, + 0.005780150182545185, + -0.01580527238547802, + 0.03452477976679802, + 8.700427133589983e-05, + 0.007549508009105921, + 0.008608892560005188, + 0.039907198399305344, + 0.0084230350330472, + -0.004568363074213266, + 0.012972813099622726, + 0.014623221941292286, + -0.003824935294687748, + -0.010430290363729, + -0.037260595709085464, + -0.017069099470973015, + -0.020890317857265472, + -0.032621607184410095, + 0.010980426333844662, + -0.045349087566137314, + 0.03812297061085701, + 0.0034290601033717394, + 0.0010816872818395495, + 0.005962289869785309, + -0.04326748847961426, + -0.021053871139883995, + 0.0015184510266408324, + -0.038569025695323944, + 0.00844533834606409, + -0.025544174015522003, + -0.06096106767654419, + 0.004940076731145382, + -0.028205646201968193, + -0.008579155430197716, + 0.0282799880951643, + 0.01766384206712246, + -0.02149992808699608, + -0.0061704497784376144, + 0.008058755658566952, + -0.018288319930434227, + -0.025841545313596725, + 0.006233640946447849, + 0.031967390328645706, + 0.02271914854645729, + 0.016147248446941376, + 0.009010342881083488, + -0.02576720342040062, + 0.036041371524333954, + 0.04969070479273796, + 0.014363022521138191, + -0.029320787638425827, + -0.007798556238412857, + -0.003167001763358712, + -0.026094311848282814, + 0.005482778884470463, + 0.02536575123667717, + -0.032591868191957474, + 0.027164846658706665, + -0.026644447818398476, + 0.0350303128361702, + 0.003362151561304927, + -0.07172589749097824, + 0.09135238826274872, + 0.029662763699889183, + -0.05403232201933861, + -0.04133457690477371, + -0.04267274960875511, + -0.02938026189804077, + 0.02829485759139061, + 0.020132021978497505, + 0.022615069523453712, + 0.00147012819070369, + -0.022912440821528435, + -0.0021039003040641546, + 0.008475075475871563, + -0.010712793096899986, + 0.004862016998231411, + -0.03624953329563141, + 0.018630297854542732, + -0.012697744183242321, + -0.026674184948205948, + 0.013024852611124516, + 0.014333285391330719, + 0.026540366932749748, + -0.015879614278674126, + 0.025038642808794975, + -0.01593908853828907, + -0.05251573026180267, + -0.03241344541311264, + 0.0188533253967762, + -0.04621146246790886, + 0.018689772114157677, + 0.019968466833233833, + 0.0013233012286946177, + -0.07303433120250702, + 0.0043713548220694065, + 0.03443557024002075, + -0.024875089526176453, + 0.00988758821040392, + 2.1751067833974957e-05, + -0.044308289885520935, + -0.03809323534369469, + -0.006070086732506752, + 0.006055218167603016, + 0.026629578322172165, + -0.02670392207801342, + 0.0035164128057658672, + -0.02749195508658886, + -0.018764114007353783, + -0.0217972993850708, + 0.014838816598057747, + -0.014489404857158661, + 0.02059294655919075, + -0.04677646979689598, + 0.0937313586473465, + -0.046300675719976425, + 0.018169371411204338, + -0.009337451308965683, + 0.04499224200844765, + 0.022005459293723106, + 0.005244882311671972, + 0.03758770227432251, + -0.0027376723010092974, + -0.010341078974306583, + -0.0050924792885780334, + 0.020132021978497505, + 0.08005229383707047, + 0.0033324144314974546, + 0.02535088360309601, + 0.011969185434281826, + 0.007445428054779768, + -0.006036632694303989, + 0.016236459836363792, + 0.020771369338035583, + 0.03464372828602791, + 0.04609251394867897, + -0.009991668164730072, + 0.03987745940685272, + -0.026763396337628365, + -0.03384082764387131, + -0.05064229294657707, + 0.00797697901725769, + 0.025588780641555786, + 0.020518602803349495, + 0.013299920596182346, + 0.00452004000544548, + -0.007467730902135372, + -0.03164028003811836, + -0.027804194018244743, + -0.014348153956234455, + 0.011322403326630592, + 0.009567913599312305, + 0.00564633309841156, + -0.02323954924941063, + 0.021440453827381134, + 0.019299382343888283, + -0.0039029952604323626, + -0.015775535255670547, + 0.01672712154686451, + 0.017232652753591537, + 0.01354525238275528, + -0.035000573843717575, + 0.03211607411503792, + 0.014273811131715775, + -0.008772446773946285, + 0.004218951798975468, + 0.015299741178750992, + 0.07761384546756744, + 0.021172819659113884, + 0.01635540835559368, + -0.005899098701775074, + -0.020117152482271194, + -0.05424048379063606, + -0.05581654980778694, + -0.002942115068435669, + -0.021172819659113884, + -0.029960134997963905, + -0.007229833863675594, + -0.016756858676671982, + -0.014459667727351189, + -0.017723316326737404, + -0.053080733865499496, + 0.026941819116473198, + 0.014006176963448524, + 0.016117511317133904, + 0.0037951981648802757, + -0.012950509786605835, + -0.006657394580543041, + 0.014890856109559536, + 0.006029198411852121, + 0.021217426285147667, + 0.02854762226343155, + 0.008660932071506977, + -0.020087415352463722, + 0.044724609702825546, + -0.0027655509766191244, + -0.007783687673509121, + 0.05224809795618057, + 0.018362663686275482, + -0.008400732651352882, + -0.054656803607940674, + -0.04157247394323349, + -0.023611262440681458, + -0.010073444806039333, + -0.032056599855422974, + 0.04692515358328819, + 0.005326659418642521, + 0.02497917041182518, + 0.032621607184410095, + 0.010393118485808372, + -0.04133457690477371, + -0.01781252771615982, + 0.024116793647408485, + -0.06631375104188919, + 0.015522769652307034, + 0.0041185892187058926, + 0.0189871434122324, + -0.02682287059724331, + 0.04175089672207832, + 0.02761090360581875, + 0.0007889625849202275, + -0.01913582719862461, + -0.02456285059452057, + 0.03232423588633537, + 0.03589268773794174, + 0.04421907663345337, + 0.02353692054748535, + 0.022020326927304268, + -0.047222524881362915, + -0.006226206663995981, + 0.001288917730562389, + 0.014333285391330719, + 0.0562923438847065, + -0.031134750694036484, + -0.003276657313108444, + 0.03348398208618164, + 0.06684901565313339, + -0.008779880590736866, + 0.039669301360845566, + 0.01500236988067627, + 0.013017418794333935, + 0.07142852991819382, + 0.009396925568580627, + 0.019567016512155533, + 0.03345424309372902, + -0.0898655354976654, + -0.0443974994122982, + 0.03178896754980087, + -0.013961571268737316, + -0.014816513285040855, + 0.0010231423657387495, + -0.00922593753784895, + -0.0036595226265490055, + 0.04686567932367325, + 0.025573911145329475, + -0.005081328097730875, + 0.01714344136416912, + 0.011523128487169743, + -0.05242651700973511, + 0.04633041098713875, + 0.03737954422831535, + -0.020890317857265472, + 0.005690938793122768, + 0.040829047560691833, + 0.021975722163915634, + 0.027596034109592438, + 0.04201853275299072, + 0.03571426495909691, + 0.007356216665357351, + -0.024622324854135513, + 0.04912570118904114, + -0.00996936485171318, + 0.04847148433327675, + 0.03732006996870041, + -0.0023287872318178415, + -0.017634104937314987, + -0.05043413117527962, + -0.010683055967092514, + -0.017024492844939232, + 0.00517797376960516, + -0.02005767822265625, + -0.025692859664559364, + 0.025127854198217392, + 0.0044568488374352455, + 0.02230283059179783, + -0.0018232563743367791, + -0.016965018585324287, + 0.055727336555719376, + 0.05123703554272652, + 0.022629937157034874, + 0.0002557855914346874, + -0.014444799162447453, + 0.018258582800626755, + 0.02723919041454792, + 0.04558698460459709, + 0.011976619251072407, + 0.01222938485443592, + 0.006594203412532806, + -0.06506478786468506, + 0.001252675661817193, + 0.03517899662256241, + 0.007218682672828436, + 0.04704410210251808, + 0.02271914854645729, + -0.004783956799656153, + 0.009471268393099308, + 0.008081058971583843, + -0.02392350137233734, + -0.02616865374147892, + -0.03000473976135254, + 0.014303548261523247, + -0.0020667288918048143, + 0.007047694176435471, + 0.019284512847661972, + 0.0020518603269010782, + 0.019834650680422783, + 0.014184599742293358, + 0.00448286859318614, + 0.019700832664966583, + 0.027700114995241165, + -0.04864990711212158, + -0.010281604714691639, + -0.02960328944027424, + -0.055757075548172, + 0.008147967047989368, + 0.01632567122578621, + 0.03928271681070328, + -0.0035424327943474054, + 0.016667649149894714, + -0.022540727630257607, + 0.05004755035042763, + 0.042791698127985, + 0.027685245499014854, + 0.004419677425175905, + 0.045111190527677536, + -0.004408526234328747, + -0.032591868191957474, + -0.014236640185117722, + 0.018793851137161255, + 0.014496839605271816, + 0.0004119053774047643, + 0.037111908197402954, + -0.020920054987072945, + -0.04445697367191315, + -0.00412230659276247, + -0.008527114987373352, + -0.04478408396244049, + -0.07279643416404724, + -0.04531934857368469, + 0.01327761821448803, + -0.0006909230723977089, + 0.0034736657980829477, + 0.00305734621360898, + 0.030926590785384178, + -0.0199238620698452, + -0.02801235392689705, + 0.01926964521408081, + 0.015024673193693161, + 0.006616506259888411, + -0.006029198411852121, + 0.002629875438287854, + -0.025960493832826614, + 0.04698462784290314, + 0.027819063514471054, + 0.007188945543020964, + -0.030896853655576706, + -0.04508145526051521, + -0.018927669152617455, + 0.048412010073661804, + 0.029856054112315178, + 0.0035164128057658672, + -0.02322467975318432, + 0.0430593304336071, + -0.005285770632326603, + 0.03413819894194603, + 0.033930037170648575, + -0.01953727938234806, + -0.03172949329018593, + -0.016176985576748848, + -0.04582488164305687, + -0.00863862968981266, + -0.025038642808794975, + 0.04951228201389313, + -0.045230139046907425, + 0.001802812097594142, + 0.02961815893650055, + -0.02682287059724331, + 0.020087415352463722, + 0.005947421304881573, + -0.06809797137975693, + -0.015745798125863075, + 0.030748168006539345, + -0.04719278961420059, + -0.03497083857655525 + ], + "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\RimWorld\\CompProperties_Refuelable.txt\n\npublic class CompProperties_Refuelable : CompProperties\n{\n\tpublic float fuelConsumptionRate = 1f;\n\n\tpublic float fuelCapacity = 2f;\n\n\tpublic float initialFuelPercent;\n\n\tpublic float autoRefuelPercent = 0.3f;\n\n\tpublic float fuelConsumptionPerTickInRain;\n\n\tpublic ThingFilter fuelFilter;\n\n\tpublic bool destroyOnNoFuel;\n\n\tpublic bool consumeFuelOnlyWhenUsed;\n\n\tpublic bool consumeFuelOnlyWhenPowered;\n\n\tpublic bool showFuelGizmo;\n\n\tpublic bool initialAllowAutoRefuel = true;\n\n\tpublic bool showAllowAutoRefuelToggle;\n\n\tpublic bool allowRefuelIfNotEmpty = true;\n\n\tpublic bool fuelIsMortarBarrel;\n\n\tpublic bool targetFuelLevelConfigurable;\n\n\tpublic float initialConfigurableTargetFuelLevel;\n\n\tpublic bool drawOutOfFuelOverlay = true;\n\n\tpublic float minimumFueledThreshold;\n\n\tpublic bool drawFuelGaugeInMap;\n\n\tpublic bool atomicFueling;\n\n\tprivate float fuelMultiplier = 1f;\n\n\tpublic bool factorByDifficulty;\n\n\t[MustTranslate]\n\tpublic string fuelLabel;\n\n\t[MustTranslate]\n\tpublic string fuelGizmoLabel;\n\n\t[MustTranslate]\n\tpublic string outOfFuelMessage;\n\n\t[NoTranslate]\n\tpublic string fuelIconPath;\n\n\tpublic bool externalTicking;\n\n\tpublic bool hideGizmosIfNotPlayerFaction;\n\n\tpublic bool functionsInVacuum = true;\n\n\tprivate Texture2D fuelIcon;\n\n\tpublic string FuelLabel\n\t{\n\t\tget\n\t\t{\n\t\t\tif (fuelLabel.NullOrEmpty())\n\t\t\t{\n\t\t\t\treturn \"Fuel\".TranslateSimple();\n\t\t\t}\n\t\t\treturn fuelLabel;\n\t\t}\n\t}\n\n\tpublic string FuelGizmoLabel\n\t{\n\t\tget\n\t\t{\n\t\t\tif (fuelGizmoLabel.NullOrEmpty())\n\t\t\t{\n\t\t\t\treturn \"Fuel\".TranslateSimple();\n\t\t\t}\n\t\t\treturn fuelGizmoLabel;\n\t\t}\n\t}\n\n\tpublic Texture2D FuelIcon\n\t{\n\t\tget\n\t\t{\n\t\t\tif (fuelIcon == null)\n\t\t\t{\n\t\t\t\tif (!fuelIconPath.NullOrEmpty())\n\t\t\t\t{\n\t\t\t\t\tfuelIcon = ContentFinder.Get(fuelIconPath);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tThingDef thingDef = ((fuelFilter.AnyAllowedDef == null) ? ThingDefOf.Chemfuel : fuelFilter.AnyAllowedDef);\n\t\t\t\t\tfuelIcon = thingDef.uiIcon;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn fuelIcon;\n\t\t}\n\t}\n\n\tpublic float FuelMultiplierCurrentDifficulty\n\t{\n\t\tget\n\t\t{\n\t\t\tif (factorByDifficulty && Find.Storyteller?.difficulty != null)\n\t\t\t{\n\t\t\t\treturn fuelMultiplier / Find.Storyteller.difficulty.maintenanceCostFactor;\n\t\t\t}\n\t\t\treturn fuelMultiplier;\n\t\t}\n\t}\n\n\tpublic CompProperties_Refuelable()\n\t{\n\t\tcompClass = typeof(CompRefuelable);\n\t}\n\n\tpublic override void ResolveReferences(ThingDef parentDef)\n\t{\n\t\tbase.ResolveReferences(parentDef);\n\t\tfuelFilter.ResolveReferences();\n\t}\n\n\tpublic override IEnumerable ConfigErrors(ThingDef parentDef)\n\t{\n\t\tforeach (string item in base.ConfigErrors(parentDef))\n\t\t{\n\t\t\tyield return item;\n\t\t}\n\t\tif (destroyOnNoFuel && initialFuelPercent <= 0f)\n\t\t{\n\t\t\tyield return \"Refuelable component has destroyOnNoFuel, but initialFuelPercent <= 0\";\n\t\t}\n\t\tif ((!consumeFuelOnlyWhenUsed || fuelConsumptionPerTickInRain > 0f) && parentDef.tickerType != TickerType.Normal)\n\t\t{\n\t\t\tyield return $\"Refuelable component set to consume fuel per tick, but parent tickertype is {parentDef.tickerType} instead of {TickerType.Normal}\";\n\t\t}\n\t}\n\n\tpublic override IEnumerable SpecialDisplayStats(StatRequest req)\n\t{\n\t\tforeach (StatDrawEntry item in base.SpecialDisplayStats(req))\n\t\t{\n\t\t\tyield return item;\n\t\t}\n\t\tif (((ThingDef)req.Def).building.IsTurret)\n\t\t{\n\t\t\tyield return new StatDrawEntry(StatCategoryDefOf.Building, \"ShotsBeforeRearm\".Translate(), ((int)fuelCapacity).ToString(), \"ShotsBeforeRearmExplanation\".Translate(), 3171);\n\t\t}\n\t}\n}\n\n", + "timestamp": "2025-08-29 15:07:25,074" + }, + "CompRefuelable-saveKeysPrefix": { + "keywords": [ + "saveKeysPrefix", + "CompRefuelable" + ], + "question": "saveKeysPrefix in CompRefuelable", + "embedding": [ + -0.0019349564099684358, + 0.008805017918348312, + 0.042642056941986084, + 0.008092026226222515, + -0.06253710389137268, + -0.02432762086391449, + 0.033931534737348557, + -6.056805432308465e-05, + 0.003691664896905422, + 0.06195296719670296, + 0.045184776186943054, + -0.016063788905739784, + -0.03580420836806297, + 0.0005707155214622617, + -0.02333115041255951, + 0.042332809418439865, + -0.014878332614898682, + -0.12974731624126434, + -0.005583669990301132, + 0.0037646822165697813, + 0.04796801880002022, + 0.03022054024040699, + 0.030151817947626114, + 0.049067575484514236, + 0.053878121078014374, + 0.008302487432956696, + -0.025049202144145966, + 0.06305252015590668, + 0.05109487473964691, + 0.01917346380650997, + 0.039377760142087936, + -0.029550500214099884, + -0.022712651640176773, + -0.00339744845405221, + -0.004325196612626314, + 0.031148288398981094, + -0.01803954876959324, + -0.0006201094947755337, + -0.016974356025457382, + -0.006640272215008736, + -0.019310908392071724, + 0.009122857823967934, + 0.012653455138206482, + 0.034532852470874786, + -0.03480774164199829, + 0.015299255959689617, + 0.033897172659635544, + -0.0455627478659153, + -0.019396809861063957, + -0.030632872134447098, + -0.006189283449202776, + -0.00901977438479662, + -0.031010843813419342, + -0.010170869529247284, + -0.0061763981357216835, + 0.040442951023578644, + -0.019001659005880356, + 0.018245715647935867, + -0.004926514811813831, + 0.036938123404979706, + 0.036800678819417953, + 0.029550500214099884, + -0.005545014049857855, + 0.0028433764819055796, + 0.016742419451475143, + -0.029361514374613762, + -0.039687007665634155, + -0.012644864618778229, + -0.021613098680973053, + -0.02401837147772312, + 0.024757133796811104, + -0.020908696576952934, + 0.015041547827422619, + 0.0009787529706954956, + -0.05298473313450813, + 0.02307344228029251, + 0.0010528439888730645, + -0.027385754510760307, + -0.004823431838303804, + 0.011665575206279755, + 0.001944620511494577, + 0.005953051149845123, + -0.06188424304127693, + 0.047727491706609726, + -0.005429045297205448, + 0.10122764110565186, + -0.02532409131526947, + -0.009054135531187057, + 0.03817512094974518, + 0.04271078109741211, + 0.019190644845366478, + 0.009277482517063618, + -0.0029894111212342978, + -0.011047076433897018, + 0.025959771126508713, + -0.016647927463054657, + -0.051369763910770416, + -0.01508449949324131, + -0.03262581303715706, + 0.019740421324968338, + -0.006150627508759499, + -0.02236904203891754, + -0.02867429330945015, + 0.003530597547069192, + 0.005059664137661457, + 0.07050886750221252, + -0.027746545150876045, + 0.01500718668103218, + -0.030839039012789726, + 0.02477431483566761, + -0.008019009605050087, + -0.07875552028417587, + -0.01998094841837883, + 0.031010843813419342, + -0.005910099949687719, + -0.03576985001564026, + -0.021561557427048683, + -0.0012939081061631441, + -0.022764192894101143, + 0.027196768671274185, + 0.038793619722127914, + 0.001128545613028109, + 0.0011242504697293043, + -0.0061935787089169025, + 0.08095462620258331, + 0.012352796271443367, + -0.03621654212474823, + 0.015471060760319233, + -0.010720646008849144, + 0.029155347496271133, + 0.022850096225738525, + 0.00434022955596447, + -0.01828007586300373, + -0.018606506288051605, + -0.02456814795732498, + -0.000812316604424268, + -0.027488837018609047, + -0.012954114004969597, + -0.08885766565799713, + 0.026801615953445435, + -0.05700497701764107, + -0.022059790790081024, + 0.011485179886221886, + 0.049582988023757935, + 0.10308314114809036, + -0.013220412656664848, + -0.06714148074388504, + -0.024791494011878967, + -0.009535190649330616, + -0.007159982807934284, + -0.023709122091531754, + 0.014277014881372452, + -0.03188705071806908, + 0.04226408526301384, + -0.007031129207462072, + -0.019018840044736862, + 0.006464171689003706, + -0.060922134667634964, + 0.008083435706794262, + -0.045631468296051025, + -0.012120858766138554, + -0.008250946179032326, + -0.002499766182154417, + 0.033931534737348557, + 0.02951613813638687, + -0.03137163445353508, + -0.008160748519003391, + -0.010978354141116142, + -0.0025276844389736652, + -0.04752132669091225, + 0.027609100565314293, + -0.010548841208219528, + -0.04092400521039963, + -0.003393153427168727, + 0.018469061702489853, + 0.01136491633951664, + 0.006378269288688898, + 0.0468684658408165, + -0.0032578567042946815, + -0.010437168180942535, + 0.06899698078632355, + 0.010196640156209469, + -0.06250274181365967, + -0.012988475151360035, + 0.03497954457998276, + -0.059066638350486755, + -0.02357167750597, + 0.004724643658846617, + -0.007546545006334782, + -0.04027114808559418, + 0.043535444885492325, + 0.06198732927441597, + -0.03217912092804909, + 0.04439447075128555, + -0.023502955213189125, + -0.02822759933769703, + 0.0064341058023273945, + -0.017068849876523018, + -0.03710993006825447, + -0.010548841208219528, + 0.0505451001226902, + -0.09483648836612701, + -0.028141696006059647, + 0.03190423175692558, + -0.009767127223312855, + 0.0010447906097397208, + 0.05051073804497719, + -0.009346204809844494, + 0.016647927463054657, + -0.01757567562162876, + 0.03346765786409378, + 0.010308314114809036, + -0.006820667535066605, + -0.08019868284463882, + 0.015428110025823116, + -0.013606973923742771, + -0.04185175523161888, + -0.052125707268714905, + 0.01535938773304224, + 0.022094152867794037, + -0.04064911603927612, + -0.02322806790471077, + 0.015118860639631748, + 0.03207603842020035, + 0.06174679845571518, + 0.012198171578347683, + 0.055115118622779846, + -0.02498047985136509, + -0.014972825534641743, + -0.01663074642419815, + -0.05810452997684479, + -0.023915288969874382, + -0.017584266141057014, + 0.00845711212605238, + 0.0437416136264801, + 0.0003787768364418298, + -0.05325962230563164, + -0.006365383975207806, + -0.016089560464024544, + 0.015720179304480553, + 0.009200169704854488, + 0.04119889438152313, + 0.027248309925198555, + 0.045184776186943054, + -0.03975573182106018, + -0.025014841929078102, + -0.047830577939748764, + -0.03341611847281456, + 0.008959642611443996, + 0.03386281058192253, + -0.026251839473843575, + 0.0252725500613451, + -0.0004912556032650173, + 0.01953425444662571, + 0.01602942869067192, + -0.013203231617808342, + -0.03238528594374657, + 0.008371209725737572, + 0.014560493640601635, + 0.018709588795900345, + -0.03645706921815872, + 0.0024804379791021347, + 0.003302955534309149, + -0.006696108728647232, + -0.02178490348160267, + -0.0010651923948898911, + 0.00227856682613492, + 0.07703746855258942, + -0.04659358039498329, + 0.013555432669818401, + -0.030443886294960976, + 0.026784434914588928, + 0.03492800518870354, + -0.06604193150997162, + 0.008315373212099075, + -0.02772936411201954, + 0.05518383905291557, + 0.011175930500030518, + -0.01803954876959324, + 0.0003846826439257711, + -0.012679225765168667, + 0.0026608335319906473, + 0.028038613498210907, + -0.011536721140146255, + -0.036938123404979706, + 0.0021926641929894686, + 0.0282791405916214, + 0.04051167517900467, + -0.00919158011674881, + -0.01802236959338188, + 0.009406336583197117, + -0.010909631848335266, + 0.0029142461717128754, + -0.02927561104297638, + -0.005630916450172663, + -0.04236717149615288, + -0.0030044440645724535, + 0.009140037931501865, + -0.03250554949045181, + 0.002443929435685277, + -0.04655921831727028, + -0.006717584561556578, + -0.01228407397866249, + 0.02498047985136509, + 0.020565086975693703, + 0.005136976484209299, + 0.008908101357519627, + -0.21400059759616852, + 0.03042670711874962, + -0.048723962157964706, + 0.0024288964923471212, + 0.019499894231557846, + 0.023502955213189125, + 0.00790733564645052, + 0.015204763039946556, + 0.0017567084869369864, + -0.009165809489786625, + 0.012421518564224243, + 0.01762721687555313, + 0.039480842649936676, + -0.04195483773946762, + 0.03410333767533302, + -0.03910287097096443, + 0.0119146928191185, + 0.04106144979596138, + -0.0033459069672971964, + 0.062262214720249176, + 0.010351264849305153, + 0.026045672595500946, + -0.01751554384827614, + 0.026011312380433083, + 0.0015075908740982413, + 0.0010050606215372682, + 0.03834692761301994, + 0.0223862212151289, + -0.021046141162514687, + 0.030461067333817482, + 0.021956708282232285, + 0.0020820647478103638, + -0.008994003757834435, + 0.010351264849305153, + -0.08157312124967575, + -0.0007758080027997494, + 0.0005615883274003863, + 0.0011929725296795368, + 0.013950584456324577, + 0.007520773913711309, + 0.062159132212400436, + -0.02532409131526947, + -0.007997533306479454, + -0.012550371699035168, + 0.01196623407304287, + 0.03607909753918648, + 0.028880460187792778, + 0.014921284280717373, + -0.021664639934897423, + -0.014921284280717373, + -0.018967296928167343, + 0.014500361867249012, + 0.009423516690731049, + 0.02327960915863514, + 0.013770189136266708, + -0.03266017511487007, + -0.022953178733587265, + 0.01615828275680542, + 0.042126644402742386, + 0.024894578382372856, + 0.018915755674242973, + 0.01091822236776352, + -0.00029716937569901347, + -0.03741917759180069, + -0.056970614939928055, + -0.0011736444430425763, + 0.028347862884402275, + 0.030839039012789726, + 0.08988849818706512, + 0.027110865339636803, + 0.014775250107049942, + 0.024963300675153732, + 0.021303849294781685, + -0.034498490393161774, + 0.007426280993968248, + -0.008899510838091373, + -0.04841471463441849, + -0.0013690729392692447, + 0.016192642971873283, + -0.012842440977692604, + 0.002039113314822316, + 0.04171431064605713, + -0.0028326387982815504, + 0.05216006934642792, + 0.01119311060756445, + 0.0011049223830923438, + -0.020015308633446693, + 0.020943056792020798, + 0.012052137404680252, + 0.04436011239886284, + 0.02037610113620758, + 0.09621092677116394, + -0.019998129457235336, + -0.013761598616838455, + -0.0060819052159786224, + 0.00896823313087225, + 0.0007666808669455349, + 0.011992004700005054, + -0.03427514433860779, + 0.017223473638296127, + 0.045287858694791794, + 0.016458941623568535, + -0.042985670268535614, + -0.020960237830877304, + -0.02791834995150566, + 0.0887889415025711, + -0.013667105697095394, + 0.006227939855307341, + 0.006923750974237919, + 0.003474760800600052, + -0.019757602363824844, + 0.025255369022488594, + 0.0164933018386364, + 0.006773421075195074, + 0.01486115250736475, + -0.04209228232502937, + 0.01888139545917511, + -0.045734550803899765, + 0.012034956365823746, + -0.012619093991816044, + -0.031938593834638596, + -0.012507420964539051, + 0.034842099994421005, + 0.01992940716445446, + -0.004973761271685362, + -0.09236249327659607, + 0.00946646835654974, + -0.003779715159907937, + -0.012369976378977299, + 0.0032771846745163202, + 0.026509547606110573, + -0.019843503832817078, + -0.018864214420318604, + 0.00015556426660623401, + 0.003981586080044508, + 0.016373038291931152, + 0.006124856416136026, + 0.0006652083829976618, + -0.012790899723768234, + 0.0011521688429638743, + -0.02687033824622631, + 0.04545966535806656, + -0.014517541974782944, + -0.04003061726689339, + -0.02218005619943142, + -0.008805017918348312, + 0.012095088139176369, + -0.0447724424302578, + 0.009956113062798977, + -0.027557559311389923, + -0.020101211965084076, + -0.0259254090487957, + -0.01568581722676754, + 0.0652172639966011, + -0.04336364194750786, + -0.05051073804497719, + 0.014646396040916443, + 0.0058241975493729115, + 0.02183644473552704, + 0.01036844588816166, + 0.0007693652878515422, + -0.050029683858156204, + -0.011227471753954887, + 0.02362321875989437, + -0.013795959763228893, + 0.05226315185427666, + 0.04271078109741211, + -0.012833850458264351, + -0.05195390060544014, + -0.03893106430768967, + 0.0408552847802639, + -0.007529364433139563, + 0.0371786504983902, + -0.0140107162296772, + -0.015264894813299179, + 0.03906850889325142, + 0.009775717742741108, + -0.09284354746341705, + -0.0016761748120188713, + -0.02532409131526947, + 0.02233467996120453, + 0.008959642611443996, + -0.0327288955450058, + -0.019809143617749214, + -0.025942590087652206, + 0.01828007586300373, + 0.05930716544389725, + -0.032247841358184814, + 0.0061592175625264645, + -0.026234658434987068, + -0.04367288947105408, + -0.007082670461386442, + -0.04439447075128555, + 0.004174867179244757, + 0.017094621434807777, + 0.003000148804858327, + 0.004685987718403339, + -0.004174867179244757, + -0.0037646822165697813, + -0.030048735439777374, + 0.036285266280174255, + -0.021561557427048683, + 0.01213803980499506, + 0.0061205611564219, + -0.015247714705765247, + 0.06085341423749924, + 0.0311654694378376, + -0.007129916921257973, + -0.005635211709886789, + 0.04446319490671158, + 0.09696687012910843, + -0.008865149691700935, + 0.007464937400072813, + -0.003021624404937029, + -0.01631290651857853, + 0.02932715229690075, + -0.04899885132908821, + -0.014646396040916443, + -0.00561803113669157, + -0.029756665229797363, + 0.003695960156619549, + -0.007026833947747946, + -0.03652579337358475, + -0.03006591461598873, + 0.030100276693701744, + 0.009578141383826733, + -0.032041676342487335, + 0.060819052159786224, + 0.060063108801841736, + -0.018365979194641113, + -0.014895513653755188, + 0.04302002862095833, + 0.0817105695605278, + 0.024447884410619736, + -0.021269487217068672, + 0.0010931107681244612, + -0.0007001063204370439, + 0.025358451530337334, + -0.026509547606110573, + 0.02197388932108879, + 0.0046430365182459354, + 0.019912226125597954, + 0.023348331451416016, + -0.014826791360974312, + 0.02168182097375393, + 0.022609569132328033, + -0.025186646729707718, + 0.044978611171245575, + 0.008732001297175884, + 0.039480842649936676, + 0.04930810257792473, + -0.004527067765593529, + -0.022867275401949883, + -0.02896636165678501, + -0.0029421646613627672, + 0.0006319211097434163, + -0.029344333335757256, + 0.03357074037194252, + -0.0009009036584757268, + -0.047624409198760986, + 0.03415488079190254, + -0.044531915336847305, + -0.0006550074322149158, + -0.057760920375585556, + 0.02128666825592518, + -0.03735045716166496, + 0.02401837147772312, + 0.04381033405661583, + -0.0009970072424039245, + 0.03566676750779152, + 0.04734952002763748, + 0.07380753010511398, + 0.03707556799054146, + -0.008976823650300503, + -0.01652766391634941, + -0.029258430004119873, + -0.04054603353142738, + 0.02498047985136509, + 0.010076376609504223, + 0.03241964802145958, + 0.016957176849246025, + 0.027196768671274185, + 0.012997065670788288, + 0.010377036407589912, + -0.02123512700200081, + -0.07676257938146591, + -0.01908756047487259, + -0.03690376505255699, + 0.020857155323028564, + 0.024843037128448486, + -0.003440399654209614, + -0.010136508382856846, + 0.013177460990846157, + 0.012593323364853859, + -0.007250180933624506, + -0.003794748103246093, + -0.003421071683987975, + -0.012103678658604622, + 0.01872676983475685, + 0.0155827347189188, + -0.006425515748560429, + 0.021716181188821793, + -0.003612204920500517, + 0.0654577910900116, + -0.00034226823481731117, + 0.023485776036977768, + -0.0004582367546390742, + 0.009715585969388485, + -0.01563427597284317, + 0.010059196501970291, + 0.004329491872340441, + -0.018898574635386467, + 0.019998129457235336, + -0.019809143617749214, + 0.013177460990846157, + 0.012851031497120857, + 0.0014281310141086578, + 0.0015290665905922651, + -0.017799021676182747, + -0.005953051149845123, + -0.016020838171243668, + 0.026492366567254066, + -0.04030550643801689, + -0.02078843303024769, + -0.03437822684645653, + -0.020101211965084076, + 0.009492238983511925, + 0.03497954457998276, + 0.013753009028732777, + 0.008487178012728691, + -0.004423984792083502, + 0.00652000866830349, + 0.00911426730453968, + 0.017086030915379524, + 0.024516606703400612, + -0.024654051288962364, + 0.015677226707339287, + -0.002046629786491394, + 0.019139103591442108, + -0.03260863199830055, + -0.008061960339546204, + 0.069649837911129, + -0.02877737581729889, + 0.03192141279578209, + 0.018709588795900345, + 0.025856686756014824, + 0.032247841358184814, + -0.03087339922785759, + -0.019207824021577835, + -0.0045829047448933125, + -0.0229188185185194, + 0.019998129457235336, + -0.03590729460120201, + -0.048827048391103745, + 0.030048735439777374, + -0.026887519285082817, + 0.011545311659574509, + 0.020650988444685936, + 0.012601913884282112, + -0.032454006373882294, + -0.009681224822998047, + 0.030392345041036606, + -0.023537317290902138, + -0.00462156068533659, + -0.009930342435836792, + -0.0164933018386364, + 0.011682755313813686, + 0.017240654677152634, + 0.03899978846311569, + -0.026234658434987068, + 0.04071784019470215, + 0.10170869529247284, + 0.03882798179984093, + -0.020101211965084076, + -0.015617095865309238, + -0.016965767368674278, + -0.0024804379791021347, + 0.025684881955385208, + -0.007464937400072813, + -0.011476589366793633, + 0.02851966768503189, + 0.008676163852214813, + 0.015909165143966675, + -0.003844141960144043, + -0.0775185227394104, + 0.14788994193077087, + 0.01759285479784012, + -0.01958579570055008, + -0.02467123046517372, + -0.008753476664423943, + -0.008100616745650768, + 0.013529662042856216, + 0.030031554400920868, + -0.0665229856967926, + 0.015367978252470493, + 0.010823729448020458, + 0.02073689177632332, + 0.01086668111383915, + 0.019448352977633476, + -0.013220412656664848, + -0.024396343156695366, + 0.009140037931501865, + -0.011992004700005054, + -0.018709588795900345, + 0.04559710994362831, + -0.0010072081349790096, + 0.002516946755349636, + -0.005716818850487471, + -0.0012563257478177547, + 0.001959653338417411, + -0.04954862967133522, + -9.751289326231927e-05, + 0.02427607960999012, + -0.04209228232502937, + 0.027007782831788063, + -0.027540378272533417, + -0.010720646008849144, + -0.0332614928483963, + 0.05150720849633217, + 0.04965171217918396, + -0.018365979194641113, + 0.014070848003029823, + 0.014294194988906384, + -0.032797619700431824, + -0.011339145712554455, + 0.012275483459234238, + -0.01618405245244503, + 0.0005857484648004174, + -2.842168578354176e-05, + 0.0070053581148386, + -0.030289262533187866, + -0.02207697182893753, + -0.03566676750779152, + 0.001230555004440248, + -0.013426578603684902, + 0.03851873427629471, + -0.051026154309511185, + 0.06848156452178955, + 0.011845970526337624, + -0.023399872705340385, + 0.009234530851244926, + 0.03676632046699524, + -0.02437916211783886, + -0.006928045768290758, + 0.033141229301691055, + -0.02242058329284191, + -0.05724550411105156, + 0.00034656337811611593, + 0.028605571016669273, + 0.07848063111305237, + 0.020238656550645828, + 0.01233561523258686, + 0.007937401533126831, + 0.005819902289658785, + -0.054118648171424866, + 0.0371786504983902, + 0.02647518552839756, + 0.010102147236466408, + 0.07937401533126831, + -0.009457877837121487, + 0.017695939168334007, + -0.03226502239704132, + -0.04016806185245514, + -0.018761131912469864, + 0.022197235375642776, + 0.059272803366184235, + 0.00839268509298563, + -0.006889389827847481, + 0.016330087557435036, + -0.0008305709343403578, + -0.02092587761580944, + -0.01628713682293892, + -0.007108441554009914, + 0.0426764190196991, + -0.014852561987936497, + -0.04590635746717453, + -0.029808208346366882, + 0.019018840044736862, + 0.01508449949324131, + 0.04140505939722061, + -0.04693718999624252, + -0.006945226341485977, + -0.042126644402742386, + -0.01581467129290104, + -0.018469061702489853, + 0.01943117193877697, + -0.013108738698065281, + 0.008697640150785446, + -0.011253242380917072, + -0.01206072699278593, + -0.017610035836696625, + 0.04501296952366829, + 0.028536848723888397, + -0.002985115861520171, + -0.025839507579803467, + -0.07057759165763855, + -0.013675696216523647, + -0.007074080407619476, + -0.041679948568344116, + -0.027299851179122925, + 0.014165340922772884, + -0.0051928129978477955, + 0.01535938773304224, + -0.033948712050914764, + -0.011081437580287457, + 0.05882611125707626, + 0.022214416414499283, + -0.006786306854337454, + 0.014886923134326935, + -0.02602849341928959, + 0.021991070359945297, + 0.026200298219919205, + 0.02157873660326004, + -2.0234092517057434e-05, + 0.0024589623790234327, + 0.04240152984857559, + 0.004454050678759813, + 0.022351861000061035, + -0.01657920517027378, + -0.009509420022368431, + 0.03401743620634079, + -0.00028079416370019317, + 0.019843503832817078, + -0.0421610027551651, + -0.012722177430987358, + -0.026612630113959312, + 0.023365510627627373, + -0.015333617106080055, + 0.037384819239377975, + -0.008087730966508389, + 0.038690537214279175, + -0.016536254435777664, + 0.02632056176662445, + -0.03442976996302605, + -0.011373505927622318, + 0.005905804689973593, + -0.06239965930581093, + -0.0034468425437808037, + 0.009054135531187057, + 0.015118860639631748, + -0.016244184225797653, + 0.023554496467113495, + 0.07696874439716339, + 0.03436104580760002, + -0.02092587761580944, + -0.013203231617808342, + 0.014689347706735134, + 0.020410461351275444, + 0.041886113584041595, + 0.01568581722676754, + 0.03522007167339325, + -0.04621560871601105, + -0.020066851750016212, + -0.000650712288916111, + 0.00946646835654974, + 0.04027114808559418, + -0.02786680869758129, + 0.025616159662604332, + 0.010815138928592205, + 0.037041209638118744, + -0.006833552848547697, + 0.021217945963144302, + 0.0005519242840819061, + 0.0077097597531974316, + 0.06068160757422447, + 0.002109983004629612, + 0.01633867807686329, + 0.03546059876680374, + -0.055974144488573074, + -0.04511605203151703, + 0.015050138346850872, + -0.02781526744365692, + -0.00255989795550704, + -0.0492393784224987, + -0.02733421139419079, + 0.006386859342455864, + 0.029842568561434746, + 0.042882584035396576, + -0.011493770405650139, + 0.0329866036772728, + 0.009681224822998047, + -0.039480842649936676, + 0.02846812643110752, + 0.022145694121718407, + -0.004423984792083502, + 0.0036873698700219393, + 0.012704997323453426, + 0.02338269166648388, + 0.019946588203310966, + -0.00035783808561973274, + 0.030151817947626114, + -0.01812545210123062, + -0.029894109815359116, + 0.01741245947778225, + -0.02272983267903328, + 0.0025964064989238977, + 0.025753604248166084, + -0.030856220051646233, + -0.021613098680973053, + -0.03197295218706131, + -0.0096898153424263, + 0.006361088715493679, + -0.012249712832272053, + -0.008474293164908886, + 0.01688845455646515, + 0.025736423209309578, + -0.007052604574710131, + 0.005605145823210478, + 0.0009153997525572777, + -0.03255709260702133, + 0.06408335268497467, + -0.00045904211583547294, + 0.004969466477632523, + -0.0060990857891738415, + -0.040133703500032425, + 0.03810640051960945, + 0.033639464527368546, + 0.0607503280043602, + 0.015694407746195793, + -0.025014841929078102, + -0.01681114174425602, + -0.028450945392251015, + 0.016793960705399513, + 0.046971552073955536, + 0.04082092270255089, + 0.024946119636297226, + 0.02482585608959198, + 0.0051928129978477955, + -0.016458941623568535, + -0.03834692761301994, + -0.017713120207190514, + -0.07215819507837296, + -0.050029683858156204, + 0.02133820950984955, + -0.016982946544885635, + 0.04456627741456032, + 0.036835040897130966, + -0.005102615337818861, + 0.02427607960999012, + 0.012610504403710365, + -0.010205230675637722, + 0.010840910486876965, + 0.002963640261441469, + -0.033433299511671066, + -0.01987786591053009, + -0.03518570959568024, + -0.029155347496271133, + 0.008362619206309319, + 0.025787964463233948, + 0.05810452997684479, + -0.002295747399330139, + 0.008727706037461758, + -0.01712898164987564, + 0.04669666290283203, + 0.03992753475904465, + 0.03882798179984093, + 0.005579374730587006, + 0.03006591461598873, + -0.028811737895011902, + -0.01613251119852066, + -0.00439821369946003, + 0.04594071954488754, + 0.004707463551312685, + 0.03972136974334717, + 0.02726549096405506, + -0.009973294101655483, + -0.04494424909353256, + -0.006309546995908022, + 0.03147471696138382, + -0.04978915676474571, + -0.04291694611310959, + -0.01807391084730625, + 0.0280214324593544, + -0.0343095064163208, + 0.015522602945566177, + 0.04645613580942154, + 0.0048749735578894615, + -0.011519541032612324, + -0.0179364662617445, + 0.03145753964781761, + -0.006361088715493679, + 0.03350201994180679, + -0.013452349230647087, + 0.003000148804858327, + -0.03097648359835148, + 0.06903134286403656, + 0.015677226707339287, + 0.052125707268714905, + -0.025306910276412964, + -0.033845629543066025, + -0.05253804102540016, + 0.03975573182106018, + -0.00784290861338377, + 0.02078843303024769, + -0.011992004700005054, + 0.029138166457414627, + -0.005111205857247114, + 0.009449287317693233, + 0.00869334489107132, + -0.02912098728120327, + -0.006803486961871386, + 0.0019950882997363806, + 0.01123606227338314, + 0.004260769579559565, + 0.007804252672940493, + 0.03140599653124809, + -0.04384469613432884, + 0.009810078889131546, + -0.00015449048078153282, + -0.030581330880522728, + 0.0013873272109776735, + -0.033192772418260574, + -0.07518196851015091, + -0.011347735300660133, + -0.014397278428077698, + -0.0185893252491951, + -0.035941652953624725 + ], + "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\RimWorld\\CompRefuelable.txt\n\npublic class CompRefuelable : ThingComp_VacuumAware, IThingGlower\n{\n\tprivate float fuel;\n\n\tprivate float configuredTargetFuelLevel = -1f;\n\n\tpublic bool allowAutoRefuel = true;\n\n\tprivate CompFlickable flickComp;\n\n\tprivate CompExplosive explosiveComp;\n\n\tpublic const string RefueledSignal = \"Refueled\";\n\n\tpublic const string RanOutOfFuelSignal = \"RanOutOfFuel\";\n\n\tprivate static readonly Texture2D SetTargetFuelLevelCommand = ContentFinder.Get(\"UI/Commands/SetTargetFuelLevel\");\n\n\tprivate static readonly Vector2 FuelBarSize = new Vector2(1f, 0.2f);\n\n\tprivate static readonly Material FuelBarFilledMat = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.6f, 0.56f, 0.13f));\n\n\tprivate static readonly Material FuelBarUnfilledMat = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.3f, 0.3f, 0.3f));\n\n\tprotected override bool FunctionsInVacuum => Props.functionsInVacuum;\n\n\tpublic float TargetFuelLevel\n\t{\n\t\tget\n\t\t{\n\t\t\tif (configuredTargetFuelLevel >= 0f)\n\t\t\t{\n\t\t\t\treturn configuredTargetFuelLevel;\n\t\t\t}\n\t\t\tif (Props.targetFuelLevelConfigurable)\n\t\t\t{\n\t\t\t\treturn Props.initialConfigurableTargetFuelLevel;\n\t\t\t}\n\t\t\treturn Props.fuelCapacity;\n\t\t}\n\t\tset\n\t\t{\n\t\t\tconfiguredTargetFuelLevel = Mathf.Clamp(value, 0f, Props.fuelCapacity);\n\t\t}\n\t}\n\n\tpublic CompProperties_Refuelable Props => (CompProperties_Refuelable)props;\n\n\tpublic float Fuel => fuel;\n\n\tpublic float FuelPercentOfTarget => fuel / TargetFuelLevel;\n\n\tpublic float FuelPercentOfMax => fuel / Props.fuelCapacity;\n\n\tpublic bool IsFull => TargetFuelLevel - fuel < 1f;\n\n\tpublic bool HasFuel\n\t{\n\t\tget\n\t\t{\n\t\t\tif (fuel > 0f && fuel >= Props.minimumFueledThreshold)\n\t\t\t{\n\t\t\t\tif (!FunctionsInVacuum)\n\t\t\t\t{\n\t\t\t\t\treturn !base.InVacuum;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tprivate float ConsumptionRatePerTick => Props.fuelConsumptionRate / 60000f;\n\n\tpublic bool ShouldAutoRefuelNow\n\t{\n\t\tget\n\t\t{\n\t\t\tif (FuelPercentOfTarget <= Props.autoRefuelPercent && !IsFull && TargetFuelLevel > 0f)\n\t\t\t{\n\t\t\t\treturn ShouldAutoRefuelNowIgnoringFuelPct;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic bool ShouldAutoRefuelNowIgnoringFuelPct\n\t{\n\t\tget\n\t\t{\n\t\t\tif (!parent.IsBurning() && (flickComp == null || flickComp.SwitchIsOn) && parent.Map.designationManager.DesignationOn(parent, DesignationDefOf.Flick) == null)\n\t\t\t{\n\t\t\t\treturn parent.Map.designationManager.DesignationOn(parent, DesignationDefOf.Deconstruct) == null;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic bool ShouldBeLitNow()\n\t{\n\t\treturn HasFuel;\n\t}\n\n\tpublic override void Initialize(CompProperties props)\n\t{\n\t\tbase.Initialize(props);\n\t\tallowAutoRefuel = Props.initialAllowAutoRefuel;\n\t\tfuel = Props.fuelCapacity * Props.initialFuelPercent;\n\t}\n\n\tpublic override void PostSpawnSetup(bool respawningAfterLoad)\n\t{\n\t\tflickComp = parent.GetComp();\n\t\texplosiveComp = parent.GetComp();\n\t}\n\n\tpublic override void PostExposeData()\n\t{\n\t\tbase.PostExposeData();\n\t\tScribe_Values.Look(ref fuel, \"fuel\", 0f);\n\t\tScribe_Values.Look(ref configuredTargetFuelLevel, \"configuredTargetFuelLevel\", -1f);\n\t\tScribe_Values.Look(ref allowAutoRefuel, \"allowAutoRefuel\", defaultValue: false);\n\t\tif (Scribe.mode == LoadSaveMode.PostLoadInit && !Props.showAllowAutoRefuelToggle)\n\t\t{\n\t\t\tallowAutoRefuel = Props.initialAllowAutoRefuel;\n\t\t}\n\t}\n\n\tpublic override void PostDraw()\n\t{\n\t\tbase.PostDraw();\n\t\tif (!allowAutoRefuel)\n\t\t{\n\t\t\tparent.Map.overlayDrawer.DrawOverlay(parent, OverlayTypes.ForbiddenRefuel);\n\t\t}\n\t\telse if (!HasFuel && Props.drawOutOfFuelOverlay)\n\t\t{\n\t\t\tparent.Map.overlayDrawer.DrawOverlay(parent, OverlayTypes.OutOfFuel);\n\t\t}\n\t\tif (Props.drawFuelGaugeInMap)\n\t\t{\n\t\t\tGenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);\n\t\t\tr.center = parent.DrawPos + Vector3.up * 0.1f;\n\t\t\tr.size = FuelBarSize;\n\t\t\tr.fillPercent = FuelPercentOfMax;\n\t\t\tr.filledMat = FuelBarFilledMat;\n\t\t\tr.unfilledMat = FuelBarUnfilledMat;\n\t\t\tr.margin = 0.15f;\n\t\t\tRot4 rotation = parent.Rotation;\n\t\t\trotation.Rotate(RotationDirection.Clockwise);\n\t\t\tr.rotation = rotation;\n\t\t\tGenDraw.DrawFillableBar(r);\n\t\t}\n\t}\n\n\tpublic override void PostDestroy(DestroyMode mode, Map previousMap)\n\t{\n\t\tbase.PostDestroy(mode, previousMap);\n\t\tif ((!Props.fuelIsMortarBarrel || !Find.Storyteller.difficulty.classicMortars) && mode != 0 && previousMap != null && Props.fuelFilter.AllowedDefCount == 1 && Props.initialFuelPercent == 0f)\n\t\t{\n\t\t\tThingDef thingDef = Props.fuelFilter.AllowedThingDefs.First();\n\t\t\tint num = Mathf.FloorToInt(1f * fuel);\n\t\t\twhile (num > 0)\n\t\t\t{\n\t\t\t\tThing thing = ThingMaker.MakeThing(thingDef);\n\t\t\t\tthing.stackCount = Mathf.Min(num, thingDef.stackLimit);\n\t\t\t\tnum -= thing.stackCount;\n\t\t\t\tGenPlace.TryPlaceThing(thing, parent.Position, previousMap, ThingPlaceMode.Near);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic override string CompInspectStringExtra()\n\t{\n\t\tif (Props.fuelIsMortarBarrel && Find.Storyteller.difficulty.classicMortars)\n\t\t{\n\t\t\treturn string.Empty;\n\t\t}\n\t\tstring text = base.CompInspectStringExtra();\n\t\ttext = ((text != null) ? (text + \"\\n\") : string.Empty);\n\t\ttext = text + Props.FuelLabel + \": \" + fuel.ToStringDecimalIfSmall() + \" / \" + Props.fuelCapacity.ToStringDecimalIfSmall();\n\t\tif (!Props.consumeFuelOnlyWhenUsed && HasFuel)\n\t\t{\n\t\t\tint numTicks = (int)(fuel / Props.fuelConsumptionRate * 60000f);\n\t\t\ttext = text + \" (\" + numTicks.ToStringTicksToPeriod() + \")\";\n\t\t}\n\t\tif (!HasFuel && !Props.outOfFuelMessage.NullOrEmpty())\n\t\t{\n\t\t\tstring arg = ((parent.def.building != null && parent.def.building.IsTurret) ? (\"CannotShoot\".Translate() + \": \" + Props.outOfFuelMessage).Resolve() : Props.outOfFuelMessage);\n\t\t\ttext += $\"\\n{arg} ({GetFuelCountToFullyRefuel()}x {Props.fuelFilter.AnyAllowedDef.label})\";\n\t\t}\n\t\tif (Props.targetFuelLevelConfigurable)\n\t\t{\n\t\t\ttext += \"\\n\" + \"ConfiguredTargetFuelLevel\".Translate(TargetFuelLevel.ToStringDecimalIfSmall());\n\t\t}\n\t\treturn text;\n\t}\n\n\tpublic override IEnumerable SpecialDisplayStats()\n\t{\n\t\tif (parent.def.building != null && parent.def.building.IsTurret)\n\t\t{\n\t\t\tTaggedString taggedString = \"RearmCostExplanation\".Translate();\n\t\t\tif (Props.factorByDifficulty)\n\t\t\t{\n\t\t\t\ttaggedString += \" (\" + \"RearmCostExplanationDifficulty\".Translate() + \")\";\n\t\t\t}\n\t\t\ttaggedString += \".\";\n\t\t\tyield return new StatDrawEntry(StatCategoryDefOf.Building, \"RearmCost\".Translate(), GenLabel.ThingLabel(Props.fuelFilter.AnyAllowedDef, null, GetFuelCountToFullyRefuel()).CapitalizeFirst(), taggedString, 3171);\n\t\t}\n\t}\n\n\tpublic override void CompTick()\n\t{\n\t\tbase.CompTick();\n\t\tCompPowerTrader comp = parent.GetComp();\n\t\tif (!Props.consumeFuelOnlyWhenUsed && (flickComp == null || flickComp.SwitchIsOn) && (!Props.consumeFuelOnlyWhenPowered || (comp != null && comp.PowerOn)) && !Props.externalTicking)\n\t\t{\n\t\t\tConsumeFuel(ConsumptionRatePerTick);\n\t\t}\n\t\tif (Props.fuelConsumptionPerTickInRain > 0f && parent.Spawned && parent.Map.weatherManager.RainRate > 0.4f && !parent.Map.roofGrid.Roofed(parent.Position) && !Props.externalTicking)\n\t\t{\n\t\t\tConsumeFuel(Props.fuelConsumptionPerTickInRain);\n\t\t}\n\t}\n\n\tpublic void ConsumeFuel(float amount)\n\t{\n\t\tif ((!Props.fuelIsMortarBarrel || !Find.Storyteller.difficulty.classicMortars) && !(fuel <= 0f))\n\t\t{\n\t\t\tfuel -= amount;\n\t\t\tif (fuel <= 0f)\n\t\t\t{\n\t\t\t\tfuel = 0f;\n\t\t\t\tNotify_RanOutOfFuel();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void Notify_RanOutOfFuel()\n\t{\n\t\tif (Props.destroyOnNoFuel)\n\t\t{\n\t\t\tparent.Destroy();\n\t\t}\n\t\tparent.BroadcastCompSignal(\"RanOutOfFuel\");\n\t}\n\n\tpublic void Refuel(List fuelThings)\n\t{\n\t\tif (Props.atomicFueling && fuelThings.Sum((Thing t) => t.stackCount) < GetFuelCountToFullyRefuel())\n\t\t{\n\t\t\tLog.ErrorOnce(\"Error refueling; not enough fuel available for proper atomic refuel\", 19586442);\n\t\t\treturn;\n\t\t}\n\t\tint num = GetFuelCountToFullyRefuel();\n\t\twhile (num > 0 && fuelThings.Count > 0)\n\t\t{\n\t\t\tThing thing = fuelThings.Pop();\n\t\t\tint num2 = Mathf.Min(num, thing.stackCount);\n\t\t\tRefuel(num2);\n\t\t\tthing.SplitOff(num2).Destroy();\n\t\t\tnum -= num2;\n\t\t}\n\t}\n\n\tpublic void Refuel(float amount)\n\t{\n\t\tfuel += amount * Props.FuelMultiplierCurrentDifficulty;\n\t\tif (fuel > Props.fuelCapacity)\n\t\t{\n\t\t\tfuel = Props.fuelCapacity;\n\t\t}\n\t\tparent.BroadcastCompSignal(\"Refueled\");\n\t}\n\n\tpublic AcceptanceReport CanEjectFuel()\n\t{\n\t\tCompExplosive compExplosive = explosiveComp;\n\t\tif (compExplosive != null && compExplosive.wickStarted)\n\t\t{\n\t\t\treturn \"AboutToExplode\".Translate();\n\t\t}\n\t\tif (Fuel == 0f)\n\t\t{\n\t\t\treturn \"RefuelableNoFuelToEject\".Translate();\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic void EjectFuel()\n\t{\n\t\tThingDef thingDef = Props.fuelFilter.AllowedThingDefs.First();\n\t\tint num = Mathf.FloorToInt(fuel);\n\t\twhile (num > 0)\n\t\t{\n\t\t\tThing thing = ThingMaker.MakeThing(thingDef);\n\t\t\tthing.stackCount = Mathf.Min(num, thingDef.stackLimit);\n\t\t\tnum -= thing.stackCount;\n\t\t\tGenPlace.TryPlaceThing(thing, parent.Position, parent.Map, ThingPlaceMode.Near);\n\t\t\tthing.SetForbidden(value: true);\n\t\t}\n\t\tfuel = 0f;\n\t\tNotify_RanOutOfFuel();\n\t}\n\n\tpublic void Notify_UsedThisTick()\n\t{\n\t\tConsumeFuel(ConsumptionRatePerTick);\n\t}\n\n\tpublic int GetFuelCountToFullyRefuel()\n\t{\n\t\tif (Props.atomicFueling)\n\t\t{\n\t\t\treturn Mathf.CeilToInt(Props.fuelCapacity / Props.FuelMultiplierCurrentDifficulty);\n\t\t}\n\t\treturn Mathf.Max(Mathf.CeilToInt((TargetFuelLevel - fuel) / Props.FuelMultiplierCurrentDifficulty), 1);\n\t}\n\n\tpublic override IEnumerable CompGetGizmosExtra()\n\t{\n\t\tif (Props.fuelIsMortarBarrel && Find.Storyteller.difficulty.classicMortars)\n\t\t{\n\t\t\tyield break;\n\t\t}\n\t\tif (!Props.hideGizmosIfNotPlayerFaction || parent.Faction == Faction.OfPlayer)\n\t\t{\n\t\t\tif (Find.Selector.SelectedObjects.Count == 1)\n\t\t\t{\n\t\t\t\tyield return new Gizmo_SetFuelLevel(this);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (Props.targetFuelLevelConfigurable)\n\t\t\t\t{\n\t\t\t\t\tCommand_SetTargetFuelLevel command_SetTargetFuelLevel = new Command_SetTargetFuelLevel();\n\t\t\t\t\tcommand_SetTargetFuelLevel.refuelable = this;\n\t\t\t\t\tcommand_SetTargetFuelLevel.defaultLabel = \"CommandSetTargetFuelLevel\".Translate();\n\t\t\t\t\tcommand_SetTargetFuelLevel.defaultDesc = \"CommandSetTargetFuelLevelDesc\".Translate();\n\t\t\t\t\tcommand_SetTargetFuelLevel.icon = SetTargetFuelLevelCommand;\n\t\t\t\t\tyield return command_SetTargetFuelLevel;\n\t\t\t\t}\n\t\t\t\tif (Props.showAllowAutoRefuelToggle)\n\t\t\t\t{\n\t\t\t\t\tstring str = (allowAutoRefuel ? \"On\".Translate() : \"Off\".Translate());\n\t\t\t\t\tCommand_Toggle command_Toggle = new Command_Toggle();\n\t\t\t\t\tcommand_Toggle.isActive = () => allowAutoRefuel;\n\t\t\t\t\tcommand_Toggle.toggleAction = delegate\n\t\t\t\t\t{\n\t\t\t\t\t\tallowAutoRefuel = !allowAutoRefuel;\n\t\t\t\t\t};\n\t\t\t\t\tcommand_Toggle.defaultLabel = \"CommandToggleAllowAutoRefuel\".Translate();\n\t\t\t\t\tcommand_Toggle.defaultDesc = \"CommandToggleAllowAutoRefuelDescMult\".Translate(str.UncapitalizeFirst().Named(\"ONOFF\"));\n\t\t\t\t\tcommand_Toggle.icon = (allowAutoRefuel ? TexCommand.ForbidOn : TexCommand.ForbidOff);\n\t\t\t\t\tcommand_Toggle.Order = 20f;\n\t\t\t\t\tcommand_Toggle.hotKey = KeyBindingDefOf.Command_ItemForbid;\n\t\t\t\t\tyield return command_Toggle;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (DebugSettings.ShowDevGizmos)\n\t\t{\n\t\t\tCommand_Action command_Action = new Command_Action();\n\t\t\tcommand_Action.defaultLabel = \"DEV: Set fuel to 0\";\n\t\t\tcommand_Action.action = delegate\n\t\t\t{\n\t\t\t\tfuel = 0f;\n\t\t\t\tparent.BroadcastCompSignal(\"Refueled\");\n\t\t\t};\n\t\t\tyield return command_Action;\n\t\t\tCommand_Action command_Action2 = new Command_Action();\n\t\t\tcommand_Action2.defaultLabel = \"DEV: Set fuel to 0.1\";\n\t\t\tcommand_Action2.action = delegate\n\t\t\t{\n\t\t\t\tfuel = 0.1f;\n\t\t\t\tparent.BroadcastCompSignal(\"Refueled\");\n\t\t\t};\n\t\t\tyield return command_Action2;\n\t\t\tCommand_Action command_Action3 = new Command_Action();\n\t\t\tcommand_Action3.defaultLabel = \"DEV: Fuel -20%\";\n\t\t\tcommand_Action3.action = delegate\n\t\t\t{\n\t\t\t\tConsumeFuel(Props.fuelCapacity * 0.2f);\n\t\t\t};\n\t\t\tyield return command_Action3;\n\t\t\tCommand_Action command_Action4 = new Command_Action();\n\t\t\tcommand_Action4.defaultLabel = \"DEV: Set fuel to max\";\n\t\t\tcommand_Action4.action = delegate\n\t\t\t{\n\t\t\t\tfuel = Props.fuelCapacity;\n\t\t\t\tparent.BroadcastCompSignal(\"Refueled\");\n\t\t\t};\n\t\t\tyield return command_Action4;\n\t\t}\n\t}\n}\n\n", + "timestamp": "2025-08-29 15:27:45,799" + }, + "GenPlace-finding-location-spawn": { + "keywords": [ + "GenPlace", + "finding", + "spawn", + "location" + ], + "question": "GenPlace methods for finding spawn location", + "embedding": [ + 0.021659109741449356, + -0.0009752711630426347, + 0.0031586200930178165, + -0.027598824352025986, + 0.007866887375712395, + 0.004095240030437708, + 0.027742644771933556, + -0.033481013029813766, + 0.018308131024241447, + 0.12080778181552887, + 0.013619638979434967, + -0.05485248565673828, + -0.05237880349159241, + -0.042225196957588196, + -0.018063640221953392, + 0.03310708329081535, + -0.006802628748118877, + -0.06500609219074249, + -0.0014849290018901229, + -0.06287757307291031, + -0.0218316912651062, + 0.03365359455347061, + 0.0063927448354661465, + -0.00944170355796814, + -0.01336076483130455, + -0.023068534210324287, + 0.02440604753792286, + 0.07582126557826996, + -0.04156363010406494, + -0.0300005991011858, + -0.015863211825489998, + 0.026707148179411888, + 0.012634480372071266, + -0.029065776616334915, + -0.013533348217606544, + 0.0331646129488945, + -0.05289654806256294, + 0.01832251250743866, + -0.012792681343853474, + 0.01944429986178875, + -0.040182970464229584, + -0.019631264731287956, + 0.02315482497215271, + 0.028720611706376076, + -0.022608313709497452, + 0.021529672667384148, + -0.03687513619661331, + -0.04636717587709427, + -0.044583823531866074, + -0.0598861426115036, + -0.008384635671973228, + -0.026045581325888634, + -0.026966022327542305, + 0.010649780742824078, + 0.005439945496618748, + 0.0468849241733551, + 0.003203563392162323, + 0.02295347861945629, + 0.0022867186926305294, + 0.009729340672492981, + 0.0048682657070457935, + 0.010088887996971607, + -0.01248347107321024, + -0.02887881174683571, + 0.001300661126151681, + -0.020896868780255318, + 0.05436350032687187, + 0.06115174666047096, + -0.002951880684122443, + -0.02125641703605652, + -0.019185425713658333, + -0.01721510849893093, + -0.04881209507584572, + -0.0036925473250448704, + 0.01154145784676075, + 0.005673651117831469, + -0.00503725279122591, + -0.0714491754770279, + -0.010894273407757282, + -0.0028062639757990837, + -0.006079939194023609, + 0.02545592561364174, + -0.03420010581612587, + -0.02559974417090416, + 0.002795477630570531, + 0.004573437385261059, + 0.04412360489368439, + 0.03819826990365982, + -0.03825579583644867, + 0.04044184461236, + 0.01364121213555336, + -0.01528793666511774, + 0.02377324551343918, + -0.008514071814715862, + -0.01049877144396305, + -0.03575335070490837, + -0.02959790639579296, + -0.007888460531830788, + 0.0018255996983498335, + 0.01679803431034088, + -0.011598984710872173, + -0.02882128395140171, + -0.03776681423187256, + 0.08053851872682571, + -0.0039945668540894985, + -0.011627748608589172, + -0.04274294152855873, + -0.00783093273639679, + -0.0027001977432519197, + 0.052206218242645264, + -0.019185425713658333, + -0.040470607578754425, + 0.03621356934309006, + 0.02013462968170643, + 0.01479895319789648, + 0.028648702427744865, + 0.018063640221953392, + 0.006317240186035633, + 0.012425943277776241, + 0.006755887530744076, + -0.013346383348107338, + 0.017402073368430138, + -0.03609851375222206, + -0.02587299980223179, + 0.012368415482342243, + -0.012411560863256454, + -0.027181750163435936, + 0.057268641889095306, + 0.017114436253905296, + -0.04078700765967369, + -0.022780895233154297, + 0.010096078738570213, + -0.013252900913357735, + -0.005479495972394943, + 0.001948744524270296, + -0.04093082621693611, + -0.00022606515267398208, + -0.008578790351748466, + -0.02027844823896885, + -0.019775083288550377, + -0.03670255467295647, + 0.00965743139386177, + 0.0291664507240057, + -0.01028304360806942, + 0.0953230932354927, + 0.009175638668239117, + 0.013612448237836361, + -0.02909454144537449, + -0.01938677206635475, + 0.015345464460551739, + -0.03811197727918625, + -0.019947664812207222, + -0.032215408980846405, + 0.014389069750905037, + -0.010419671423733234, + -0.016265904530882835, + 0.007794978097081184, + -0.027052313089370728, + 0.00282424152828753, + -0.0032089566811919212, + -0.05442102998495102, + 0.010966182686388493, + 0.04596448317170143, + 0.025729181244969368, + 0.005465114023536444, + 0.017387691885232925, + 0.002399975899606943, + 0.033883705735206604, + -0.05539899691939354, + 0.001415716134943068, + -0.027656352147459984, + 0.003958612214773893, + -0.014353115111589432, + 0.022349439561367035, + -0.0038040068466216326, + 0.028346681967377663, + -0.007766214665025473, + 0.07070131599903107, + 0.006043984554708004, + -0.013051554560661316, + 0.03405628725886345, + 0.02826039120554924, + 0.022622695192694664, + -0.00673431484028697, + -0.003915466368198395, + -0.048236820846796036, + -0.014209296554327011, + 0.005957693327218294, + 0.0300005991011858, + -0.010793600231409073, + -0.0036008628085255623, + 0.06701955199241638, + -0.029353413730859756, + 0.020393503829836845, + -0.06759482622146606, + -0.006482631899416447, + 0.016913089901208878, + 0.0008341489592567086, + -0.0558304525911808, + -0.015417373739182949, + 0.0060331979766488075, + -0.06535125523805618, + -0.013317619450390339, + -0.006115893833339214, + -0.008931146934628487, + -0.010203942656517029, + -0.013137846253812313, + -0.028361065313220024, + 0.03782434016466141, + -0.006230948958545923, + 0.04259912297129631, + -0.015029063448309898, + 0.006694764364510775, + -0.04967501014471054, + -0.01262728963047266, + 0.007507340516895056, + -0.02329864352941513, + -0.057469986379146576, + 0.018207458779215813, + 0.03756546601653099, + 0.004368495661765337, + -0.0010597646469250321, + 0.049761299043893814, + -0.0014777380274608731, + 0.0436633825302124, + -0.010124842636287212, + -0.008715418167412281, + 0.0021411022171378136, + -0.0033761460799723864, + 0.003187383757904172, + 0.02539839781820774, + 0.03497672826051712, + -0.04728761687874794, + 0.036472443491220474, + 0.025297723710536957, + -0.00033325509866699576, + -0.05197611078619957, + -0.0006067355279810727, + -0.011836285702884197, + 0.02545592561364174, + 0.037191540002822876, + 0.02636198326945305, + 0.0218316912651062, + 0.022852804511785507, + 0.015359845943748951, + 0.017718475311994553, + -0.01651039719581604, + -0.013734694570302963, + 0.05013522878289223, + 0.0051055666990578175, + 0.0008997662807814777, + 0.05764256790280342, + -0.010045742616057396, + -0.02496694214642048, + 0.046424705535173416, + 0.016481632366776466, + 0.0038902980741113424, + 0.005152307916432619, + -0.014547270722687244, + -0.011095619760453701, + -0.024650540202856064, + 0.03926252946257591, + -0.021558435633778572, + -0.0181930772960186, + 0.023658189922571182, + -0.01797734759747982, + -0.027181750163435936, + 0.05013522878289223, + -0.05867806449532509, + -0.07702933996915817, + -0.008312725462019444, + 0.04513033479452133, + 0.012677625752985477, + -0.05335677042603493, + 0.013252900913357735, + 0.013518965803086758, + -0.020062720403075218, + -0.03391246870160103, + 0.037105247378349304, + -0.042138904333114624, + 0.012339651584625244, + 0.007759023457765579, + -0.003618840128183365, + 0.010225515812635422, + -0.0026264905463904142, + 0.05232127383351326, + -0.002399975899606943, + 0.042369015514850616, + 0.021112598478794098, + -0.015431756153702736, + -0.00010151584137929603, + 0.07720192521810532, + -0.008902383036911488, + -0.008140143007040024, + -0.020753050222992897, + 0.023686954751610756, + 0.04495775327086449, + 0.01546051912009716, + -0.018725205212831497, + -0.029684197157621384, + -0.005655673798173666, + 0.013245710171759129, + -0.017603419721126556, + -0.0247512124478817, + 0.03184147924184799, + 0.03736412152647972, + -0.013382337987422943, + -0.10567804425954819, + 0.032848209142684937, + -0.10625331848859787, + 0.009643049910664558, + 0.017934203147888184, + -0.0059073567390441895, + -0.014288396574556828, + -0.029051395133137703, + 0.0011307751992717385, + -0.01462637074291706, + 0.0066839782521128654, + 0.002455705776810646, + 0.02826039120554924, + -0.06793999671936035, + -0.006626450456678867, + -0.059771087020635605, + 0.014187723398208618, + -0.0006961728213354945, + -0.0004071869479957968, + 0.03414257988333702, + 0.013109082356095314, + 0.00470646983012557, + 0.009916305541992188, + 0.01311627309769392, + 0.025283342227339745, + 0.015978267416357994, + 0.037594228982925415, + -0.04895591363310814, + -0.01371312141418457, + 0.031438786536455154, + 0.01629466935992241, + 0.0026031199377030134, + -0.00673431484028697, + -0.03707648441195488, + 0.059771087020635605, + -0.04981882870197296, + -0.028778139501810074, + 0.01987575553357601, + -0.030604638159275055, + 0.0031963724177330732, + 0.04064318910241127, + 0.04141981154680252, + 0.005332081578671932, + -0.026045581325888634, + 0.010592253878712654, + -0.031611368060112, + 0.021457763388752937, + -0.014885243959724903, + 0.0177760012447834, + -0.028490502387285233, + 0.01139763928949833, + 0.019343627616763115, + -0.0007730259676463902, + -0.01873958855867386, + 0.0230253878980875, + 0.01978946477174759, + 0.04444000497460365, + 0.01692747138440609, + -0.00815452542155981, + -0.0010939216008409858, + 0.04674110561609268, + -0.02140023559331894, + 0.03276192024350166, + -0.014281205832958221, + -0.06443081796169281, + 0.019703174009919167, + 0.023902682587504387, + -0.03768052160739899, + 0.04469887912273407, + -0.004659728612750769, + -0.00023640213476028293, + -0.0038471524603664875, + 0.04006791487336159, + -0.010692927055060863, + 0.028159718960523605, + -0.0015065018087625504, + -0.0696658194065094, + -0.017085671424865723, + -0.02735433354973793, + 0.001955935498699546, + 0.03405628725886345, + 0.022047419100999832, + -0.016611069440841675, + 0.06264746189117432, + 0.03385494276881218, + -0.0028817688580602407, + -0.007780596148222685, + -0.01339672040194273, + 0.014115814119577408, + 0.027440624311566353, + 0.02742624282836914, + 0.01587759330868721, + -0.00010202145494986326, + 0.015273555181920528, + -0.00739947659894824, + 0.0014876255299896002, + 0.01672612503170967, + -0.02371571771800518, + 0.0024215488228946924, + 0.02085372433066368, + -0.03379741311073303, + -0.012418752536177635, + 0.01007450558245182, + -0.015402992255985737, + -0.016984999179840088, + 0.03583964332938194, + 0.03756546601653099, + -0.04668357968330383, + 0.01531670056283474, + 0.02161596342921257, + 0.0007972954190336168, + 0.025067614391446114, + 0.051659706979990005, + 0.01427401416003704, + 0.020666759461164474, + -0.04961748048663139, + 0.020479794591665268, + -0.02715298719704151, + 0.059483449906110764, + 0.02449234016239643, + 0.07564868032932281, + -0.05085432156920433, + -0.0009145975927822292, + 0.029324650764465332, + -0.015848830342292786, + -0.09549567103385925, + 0.03747917711734772, + 0.012677625752985477, + -0.003933443687856197, + -0.0026948044542223215, + 0.016323432326316833, + -0.004850288387387991, + -0.015848830342292786, + -0.0712190642952919, + 0.014446597546339035, + -0.02693725936114788, + -0.045015279203653336, + 0.03181271627545357, + -0.02029283158481121, + 0.05470866709947586, + 0.0009860575664788485, + -0.04058566316962242, + 0.038716018199920654, + -0.03322213888168335, + -0.038716018199920654, + -0.051515888422727585, + -0.025513453409075737, + -0.013820985332131386, + 0.05436350032687187, + 0.01826498657464981, + -0.0003838163975160569, + 0.051228251308202744, + -0.05715358629822731, + -0.0039909714832901955, + 0.036760080605745316, + -0.03448774665594101, + 0.03463156521320343, + 0.013483011163771152, + 0.0002844915434252471, + -0.028202863410115242, + -0.016956234350800514, + -0.018998460844159126, + -0.07593631744384766, + -0.012533807195723057, + 0.02741186134517193, + 0.021946746855974197, + -0.052004873752593994, + 0.03279068320989609, + -0.06592652946710587, + -0.03189900517463684, + 0.055370233952999115, + 0.012807062827050686, + -0.1424381285905838, + -0.03765175864100456, + 0.006788246799260378, + -0.00521343108266592, + -0.009542376734316349, + -0.04685616120696068, + -0.09469028562307358, + -0.060116253793239594, + 0.000938417564611882, + -0.014439405873417854, + -0.021026305854320526, + -0.025024468079209328, + 0.016208376735448837, + -0.046194594353437424, + 0.02623254619538784, + -0.0372203029692173, + -0.026966022327542305, + 0.01720072701573372, + 0.060749053955078125, + -0.030949803069233894, + -0.0017384096281602979, + -0.02232067659497261, + 0.004753211047500372, + 0.021385854110121727, + -0.017387691885232925, + -0.007780596148222685, + 0.007881269790232182, + -0.0331646129488945, + 0.035005491226911545, + 0.0056412918493151665, + 0.007888460531830788, + -0.008514071814715862, + -0.015417373739182949, + 0.031007330864667892, + 0.01326009165495634, + 0.016956234350800514, + 0.0052565764635801315, + 0.027023550122976303, + 0.027339952066540718, + 0.008341489359736443, + 0.015920739620923996, + 0.004080858081579208, + -0.016567924991250038, + -0.00898867379873991, + 0.01269919890910387, + -0.06086410954594612, + 0.034804146736860275, + 0.001047180499881506, + 0.001333020394667983, + 0.01770409196615219, + -0.04777660220861435, + 0.000796845939476043, + -0.021428998559713364, + -0.01663983426988125, + 0.024089647457003593, + -0.02062361314892769, + -0.05324171483516693, + -0.004835906904190779, + 0.005148712545633316, + 0.08065357804298401, + 0.02715298719704151, + 0.027383096516132355, + -0.006579709704965353, + -0.001306953257881105, + -0.0017339152982458472, + 0.044382479041814804, + 0.03169766068458557, + 0.033481013029813766, + 0.013763457536697388, + 0.0021303158719092607, + -0.05002017319202423, + 0.0017833529273048043, + -0.004368495661765337, + 0.05140083283185959, + 0.003962207585573196, + 0.003627828788012266, + -0.015935121104121208, + 0.04484269767999649, + 0.05050915852189064, + 0.01423086877912283, + 0.013403911143541336, + 0.00370692927390337, + -0.0043577090837061405, + 0.03247428312897682, + -0.07800731062889099, + 0.0267790574580431, + -0.006198589690029621, + -0.023902682587504387, + 0.029914308339357376, + 0.0016925673699006438, + -0.059080757200717926, + 0.016841180622577667, + 0.07087390124797821, + -0.05025028437376022, + -0.0035936718340963125, + -0.016740506514906883, + 0.04777660220861435, + 0.023183587938547134, + 0.013849749229848385, + 0.0454467348754406, + -0.007061502430588007, + -0.004843097645789385, + -0.01405828632414341, + -0.0032826638780534267, + 0.006935661192983389, + 0.017445219680666924, + 0.004753211047500372, + -0.02286718785762787, + 0.01804925687611103, + 0.03825579583644867, + -0.006202185060828924, + 0.0678824707865715, + 0.03394123539328575, + 0.00022336855181492865, + 0.025916146114468575, + -0.029065776616334915, + 0.012850208207964897, + -0.04475640505552292, + 0.07363522052764893, + -0.016826797276735306, + 0.024794358760118484, + -0.024118410423398018, + -0.10648342967033386, + -0.011426402255892754, + 0.006878133397549391, + 0.004947366192936897, + -0.008413398638367653, + -0.020666759461164474, + 0.053903281688690186, + 0.036127280443906784, + 0.03097856603562832, + 0.08117132633924484, + 0.006018816027790308, + 0.0030273855663836002, + -0.0018660487839952111, + -0.0016314443200826645, + -0.044670116156339645, + -0.005026466678828001, + 0.03141002357006073, + -0.024866268038749695, + 0.0006238140049390495, + -0.000134942471049726, + -0.01714319922029972, + 0.02239258587360382, + -0.04567684605717659, + -0.01538860984146595, + 0.013648402877151966, + 0.02147214487195015, + -0.0008085312438197434, + -0.044037312269210815, + -0.013173800893127918, + -0.07167928665876389, + 0.010491580702364445, + -0.03727782890200615, + 0.012986836023628712, + 0.08174660056829453, + 0.01686994358897209, + 0.014446597546339035, + 0.026879731565713882, + 0.013130655512213707, + -0.0009190919226966798, + 0.0247512124478817, + 0.021083833649754524, + -0.02601681835949421, + 0.0012494256952777505, + 0.041391048580408096, + 0.008938337676227093, + -0.03146754950284958, + -0.02853364683687687, + -0.06080658361315727, + -0.031381260603666306, + 0.04093082621693611, + 0.05378822609782219, + 0.0397227481007576, + 0.01573377475142479, + -0.003644008422270417, + 0.007888460531830788, + -0.03782434016466141, + -0.00715138902887702, + 0.00428579980507493, + -0.011138765141367912, + -0.023169206455349922, + -0.0331646129488945, + -0.006123085040599108, + -0.00944170355796814, + -0.004638155922293663, + 0.004519505426287651, + 0.004303777124732733, + 0.010203942656517029, + -0.001356390886940062, + 0.01817869395017624, + -0.012440324760973454, + 0.014446597546339035, + 0.024233466014266014, + 0.0542772114276886, + -0.018020493909716606, + 0.04334698244929314, + 0.027800170704722404, + -0.0412759929895401, + 0.021630344912409782, + 0.02699478715658188, + -0.041793737560510635, + -0.0014399855863302946, + -0.04792042076587677, + 0.02036474086344242, + -0.0035990651231259108, + -0.0007065098034217954, + 0.006705550942569971, + 0.01826498657464981, + -0.08318478614091873, + -0.0010885284282267094, + 0.015719393268227577, + -0.0502215214073658, + 0.0436633825302124, + -0.00042224297067150474, + -0.009010246954858303, + -0.03604098781943321, + -0.001972115132957697, + 0.0017330163391306996, + 0.04104588180780411, + 0.06822763383388519, + -0.0032808659598231316, + -0.03181271627545357, + 0.03946387395262718, + -0.017517128959298134, + 0.01881149783730507, + 0.000330783223034814, + -0.06960829347372055, + -0.0031100811902433634, + 0.0021644728258252144, + -0.012354033999145031, + 0.042973052710294724, + 0.015978267416357994, + -0.008780136704444885, + 0.0031550247222185135, + -0.011663703247904778, + 0.03281944617629051, + -0.006561731919646263, + 0.011404830031096935, + -0.0477190725505352, + 0.018984079360961914, + -0.0037608612328767776, + -0.03391246870160103, + -0.03868725523352623, + 0.011217865161597729, + -0.02692287601530552, + 0.05617561936378479, + -0.0037896251305937767, + -0.012325270101428032, + -0.02013462968170643, + 0.027037931606173515, + -0.03437269106507301, + 0.01875397004187107, + -0.0099306870251894, + 0.05798773467540741, + 0.004479955416172743, + -0.05534146726131439, + -0.0033887301106005907, + 0.01799173094332218, + -0.01861015148460865, + -0.04147733747959137, + -0.005033657420426607, + 0.00898867379873991, + 0.05378822609782219, + -0.023169206455349922, + 0.09745161235332489, + 0.062014661729335785, + -0.019832611083984375, + -0.044583823531866074, + 0.09572578221559525, + 0.03178395330905914, + 0.04786289110779762, + -0.023471225053071976, + 0.03552323952317238, + -0.005752751603722572, + -0.032215408980846405, + -0.0073455446399748325, + 0.06425823271274567, + 0.045216627418994904, + 0.0016278488328680396, + -0.025067614391446114, + 0.00328625924885273, + 0.019703174009919167, + 0.035580769181251526, + 0.03394123539328575, + -0.031438786536455154, + 0.051314543932676315, + 0.016496015712618828, + -0.005432754755020142, + -0.01118910126388073, + -0.04766154661774635, + -0.022421348839998245, + -0.017186345532536507, + 0.01326009165495634, + 0.01832251250743866, + 0.007212512195110321, + -0.0022040228359401226, + 0.028418593108654022, + -0.02427661046385765, + -0.014079859480261803, + -0.036472443491220474, + 0.057124823331832886, + -0.055427759885787964, + 0.0681125745177269, + -0.011649321764707565, + 0.011491120792925358, + 0.033049557358026505, + 0.01971755549311638, + 0.030173180624842644, + -0.02804466336965561, + -0.018624532967805862, + -0.029684197157621384, + -0.037450410425662994, + 0.037881869822740555, + 0.04392225667834282, + -0.0181930772960186, + -0.009456085041165352, + 0.019055988639593124, + 0.049214787781238556, + 0.038514669984579086, + 0.0332796685397625, + 0.047115035355091095, + -0.088995061814785, + -0.0074354312382638454, + -0.040671952068805695, + 0.037249065935611725, + 0.010225515812635422, + 0.0025761539582163095, + -0.03028823621571064, + -0.0030291832517832518, + 0.01567624695599079, + 0.011476739309728146, + -0.004897029604762793, + 0.023672571405768394, + -0.022996623069047928, + 0.028504883870482445, + -0.022220002487301826, + -0.017315782606601715, + -0.007262848783284426, + -0.04426742345094681, + 0.03828456252813339, + 0.022148093208670616, + 0.006723528262227774, + 0.004350518342107534, + 0.007967560552060604, + 0.0300005991011858, + -0.023586280643939972, + -0.0034516509622335434, + 0.02295347861945629, + -0.00944170355796814, + -0.011447975412011147, + -0.02295347861945629, + 0.0023514372296631336, + 0.038370851427316666, + 0.0059145474806427956, + 0.031582605093717575, + 0.012893354520201683, + -0.013094700872898102, + -0.015402992255985737, + 0.0015514451079070568, + -0.005260172300040722, + -0.023830773308873177, + -0.011606176383793354, + -0.005839042831212282, + -0.04323192685842514, + 0.026620857417583466, + 0.005767133552581072, + 0.02616063691675663, + -0.011131574399769306, + 0.006011625286191702, + -0.0041419812478125095, + -0.025412779301404953, + 0.009326647967100143, + -0.01643848791718483, + -0.003904680022969842, + 0.018710823729634285, + 0.012224596925079823, + 0.02280966006219387, + 0.03581087663769722, + 0.011987295933067799, + -0.018480714410543442, + -0.005321295000612736, + -0.007492958568036556, + 0.015172882005572319, + 0.0028206459246575832, + 0.04530291631817818, + -0.011692467145621777, + 0.011555839329957962, + 0.02715298719704151, + 0.02351437136530876, + -0.0024323351681232452, + 0.019214190542697906, + 0.0022867186926305294, + -0.008751372806727886, + 0.011167529039084911, + 0.035638295114040375, + -0.007309590000659227, + -0.03552323952317238, + 0.01686994358897209, + 0.007359926588833332, + 0.029828015714883804, + -0.0047675929963588715, + -0.001669196761213243, + 0.013634021393954754, + -0.0069931885227561, + 0.06863032281398773, + -0.017387691885232925, + -0.0209975428879261, + 0.016467250883579254, + -0.019674409180879593, + 0.023974591866135597, + 0.04630964994430542, + 0.024521103128790855, + 0.007514531724154949, + -0.009132493287324905, + -0.01126820221543312, + -0.011145955882966518, + -0.06126680225133896, + 0.00328625924885273, + -0.06063400208950043, + -0.013518965803086758, + 0.0088880006223917, + -0.09273435175418854, + 0.05936839431524277, + 0.03995285928249359, + -0.05027904734015465, + -0.03609851375222206, + -0.03575335070490837, + -0.030201945453882217, + -0.027541298419237137, + 0.024808740243315697, + 0.014065477065742016, + -0.004019734915345907, + 0.0356670580804348, + 0.03652997314929962, + -0.022507639601826668, + -0.05528394132852554, + -0.04420989379286766, + 0.07495835423469543, + -0.003667379030957818, + -0.030317001044750214, + 0.01727263629436493, + 0.00032763718627393246, + 0.0009114515851251781, + 0.061094220727682114, + 0.02777140773832798, + 0.01427401416003704, + -0.049761299043893814, + -0.020235303789377213, + 0.0029842397198081017, + 0.04593572020530701, + -0.06120927631855011, + -0.00035729981027543545, + 0.007924415171146393, + -0.003814793424680829, + 0.02918083220720291, + 0.026103109121322632, + -0.03716277331113815, + -0.029540378600358963, + -0.018696442246437073, + -0.05160218104720116, + -0.012598525732755661, + -0.046137068420648575, + 0.024736830964684486, + 0.05568663403391838, + 0.014957154169678688, + 0.05652078241109848, + 0.01973193697631359, + -0.0218892190605402, + 0.014698280021548271, + 0.024161556735634804, + -0.056003034114837646, + -0.008025088347494602, + 0.03575335070490837, + -0.015647483989596367, + 0.0014849290018901229, + 0.019271716475486755, + 0.004857479594647884, + -0.03322213888168335, + -0.010045742616057396, + -0.03940634801983833, + 0.003868725383654237, + 0.060461416840553284, + 0.035638295114040375, + -0.062992624938488, + 0.02140023559331894, + 0.005486686713993549, + -0.010189561173319817, + -0.003947825636714697, + 0.022076183930039406, + -0.04351956397294998, + -0.04231148585677147, + 0.04444000497460365, + 0.010736072435975075, + -0.02923836000263691, + 0.01973193697631359, + 0.005267363041639328, + -0.02013462968170643, + -0.02406088262796402, + -0.01804925687611103, + 0.011102810502052307, + 0.046971216797828674, + 0.012303696945309639, + -0.006856560707092285, + 0.013698738999664783, + 0.019041607156395912, + -0.011203483678400517, + 0.02335617132484913, + 0.012461897917091846, + -0.01825060322880745, + 0.006673191674053669, + -0.001959530869498849, + -0.0065437545999884605, + 0.019127897918224335, + 0.018293749541044235, + -0.0009590915287844837, + -0.012965263798832893, + -0.01175718568265438, + -0.014676706865429878, + 0.03621356934309006, + -0.021731019020080566, + 0.007694304920732975, + -0.00027595230494625866, + 0.0008732497226446867, + 0.007108243647962809, + 0.03489043936133385, + 0.0007074086461216211, + 0.008111379109323025, + 0.004447596147656441, + -0.01405828632414341, + -0.02567165344953537, + -0.0009258334175683558, + -0.000717745628207922, + -0.063222736120224, + -0.0077086868695914745, + 0.016467250883579254, + 0.006482631899416447, + -0.07409543544054031, + 0.0008849349687807262, + 0.00941293966025114, + -0.0009878552518785, + 0.008470926433801651, + 0.014547270722687244, + 0.03359606862068176, + -0.018480714410543442 + ], + "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\Verse\\GenPlace.txt\n\npublic static class GenPlace\n{\n\tprivate enum PlaceSpotQuality : byte\n\t{\n\t\tUnusable,\n\t\tAwful,\n\t\tBad,\n\t\tOkay,\n\t\tPerfect\n\t}\n\n\tprivate static readonly int PlaceNearMaxRadialCells = GenRadial.NumCellsInRadius(12.9f);\n\n\tprivate static readonly int PlaceNearMiddleRadialCells = GenRadial.NumCellsInRadius(3f);\n\n\tprivate static List thingList = new List();\n\n\tprivate static List cellThings = new List(8);\n\n\tpublic static bool TryPlaceThing(Thing thing, IntVec3 center, Map map, ThingPlaceMode mode, Action placedAction = null, Predicate extraValidator = null, Rot4? rot = null, int squareRadius = 1)\n\t{\n\t\tThing lastResultingThing;\n\t\treturn TryPlaceThing(thing, center, map, mode, out lastResultingThing, placedAction, extraValidator, rot);\n\t}\n\n\tpublic static bool TryPlaceThing(Thing thing, IntVec3 center, Map map, ThingPlaceMode mode, out Thing lastResultingThing, Action placedAction = null, Predicate extraValidator = null, Rot4? rot = null, int squareRadius = 1)\n\t{\n\t\tRot4 valueOrDefault = rot.GetValueOrDefault();\n\t\tif (!rot.HasValue)\n\t\t{\n\t\t\tvalueOrDefault = thing.def.defaultPlacingRot;\n\t\t\trot = valueOrDefault;\n\t\t}\n\t\tlastResultingThing = null;\n\t\tif (map == null)\n\t\t{\n\t\t\tLog.Error(\"Tried to place thing \" + thing?.ToString() + \" in a null map.\");\n\t\t\tlastResultingThing = null;\n\t\t\treturn false;\n\t\t}\n\t\tif (thing.def.category == ThingCategory.Filth)\n\t\t{\n\t\t\tmode = ThingPlaceMode.Direct;\n\t\t}\n\t\tif (mode == ThingPlaceMode.Direct)\n\t\t{\n\t\t\treturn TryPlaceDirect(thing, center, rot.Value, map, out lastResultingThing, placedAction);\n\t\t}\n\t\tif (mode == ThingPlaceMode.Near)\n\t\t{\n\t\t\tint stackCount;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tstackCount = thing.stackCount;\n\t\t\t\tif (!TryFindPlaceSpotNear(center, rot.Value, map, thing, allowStacking: true, out var bestSpot, extraValidator))\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (TryPlaceDirect(thing, bestSpot, rot.Value, map, out lastResultingThing, placedAction))\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (thing.stackCount != stackCount);\n\t\t\tstring[] obj = new string[7]\n\t\t\t{\n\t\t\t\t\"Failed to place \",\n\t\t\t\tthing?.ToString(),\n\t\t\t\t\" at \",\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t};\n\t\t\tIntVec3 intVec = center;\n\t\t\tobj[3] = intVec.ToString();\n\t\t\tobj[4] = \" in mode \";\n\t\t\tobj[5] = mode.ToString();\n\t\t\tobj[6] = \".\";\n\t\t\tLog.Error(string.Concat(obj));\n\t\t\tlastResultingThing = null;\n\t\t\treturn false;\n\t\t}\n\t\tif (mode == ThingPlaceMode.Radius)\n\t\t{\n\t\t\tint stackCount2;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tstackCount2 = thing.stackCount;\n\t\t\t\tif (!TryFindPlaceSpotInRadius(center, rot.Value, map, thing, squareRadius, allowStacking: true, out var bestSpot2, 100, extraValidator))\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (TryPlaceDirect(thing, bestSpot2, rot.Value, map, out lastResultingThing, placedAction))\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (thing.stackCount != stackCount2);\n\t\t\tstring[] obj2 = new string[7]\n\t\t\t{\n\t\t\t\t\"Failed to place \",\n\t\t\t\tthing?.ToString(),\n\t\t\t\t\" at \",\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t};\n\t\t\tIntVec3 intVec = center;\n\t\t\tobj2[3] = intVec.ToString();\n\t\t\tobj2[4] = \" in mode \";\n\t\t\tobj2[5] = mode.ToString();\n\t\t\tobj2[6] = \".\";\n\t\t\tLog.Error(string.Concat(obj2));\n\t\t\tlastResultingThing = null;\n\t\t\treturn false;\n\t\t}\n\t\tthrow new InvalidOperationException();\n\t}\n\n\tprivate static bool TryFindPlaceSpotNear(IntVec3 center, Rot4 rot, Map map, Thing thing, bool allowStacking, out IntVec3 bestSpot, Predicate extraValidator = null)\n\t{\n\t\tPlaceSpotQuality placeSpotQuality = PlaceSpotQuality.Unusable;\n\t\tbestSpot = center;\n\t\tfor (int i = 0; i < 9; i++)\n\t\t{\n\t\t\tIntVec3 intVec = center + GenRadial.RadialPattern[i];\n\t\t\tPlaceSpotQuality placeSpotQuality2 = PlaceSpotQualityAt(intVec, rot, map, thing, center, allowStacking, extraValidator);\n\t\t\tif ((int)placeSpotQuality2 > (int)placeSpotQuality)\n\t\t\t{\n\t\t\t\tbestSpot = intVec;\n\t\t\t\tplaceSpotQuality = placeSpotQuality2;\n\t\t\t}\n\t\t\tif (placeSpotQuality == PlaceSpotQuality.Perfect)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ((int)placeSpotQuality >= 3)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tfor (int j = 0; j < PlaceNearMiddleRadialCells; j++)\n\t\t{\n\t\t\tIntVec3 intVec = center + GenRadial.RadialPattern[j];\n\t\t\tPlaceSpotQuality placeSpotQuality2 = PlaceSpotQualityAt(intVec, rot, map, thing, center, allowStacking, extraValidator);\n\t\t\tif ((int)placeSpotQuality2 > (int)placeSpotQuality)\n\t\t\t{\n\t\t\t\tbestSpot = intVec;\n\t\t\t\tplaceSpotQuality = placeSpotQuality2;\n\t\t\t}\n\t\t\tif (placeSpotQuality == PlaceSpotQuality.Perfect)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ((int)placeSpotQuality >= 3)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tfor (int k = 0; k < PlaceNearMaxRadialCells; k++)\n\t\t{\n\t\t\tIntVec3 intVec = center + GenRadial.RadialPattern[k];\n\t\t\tPlaceSpotQuality placeSpotQuality2 = PlaceSpotQualityAt(intVec, rot, map, thing, center, allowStacking, extraValidator);\n\t\t\tif ((int)placeSpotQuality2 > (int)placeSpotQuality)\n\t\t\t{\n\t\t\t\tbestSpot = intVec;\n\t\t\t\tplaceSpotQuality = placeSpotQuality2;\n\t\t\t}\n\t\t\tif (placeSpotQuality == PlaceSpotQuality.Perfect)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ((int)placeSpotQuality > 0)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tbestSpot = center;\n\t\treturn false;\n\t}\n\n\tprivate static bool TryFindPlaceSpotInRadius(IntVec3 center, Rot4 rot, Map map, Thing thing, int radius, bool allowStacking, out IntVec3 bestSpot, int attempts = 100, Predicate extraValidator = null)\n\t{\n\t\tPlaceSpotQuality placeSpotQuality = PlaceSpotQuality.Unusable;\n\t\tbestSpot = center;\n\t\twhile (attempts-- > 0)\n\t\t{\n\t\t\tif (CellFinder.TryRandomClosewalkCellNear(center, map, radius, out var result))\n\t\t\t{\n\t\t\t\tPlaceSpotQuality placeSpotQuality2 = PlaceSpotQualityAt(result, rot, map, thing, center, allowStacking, extraValidator);\n\t\t\t\tif ((int)placeSpotQuality2 > (int)placeSpotQuality)\n\t\t\t\t{\n\t\t\t\t\tbestSpot = result;\n\t\t\t\t\tplaceSpotQuality = placeSpotQuality2;\n\t\t\t\t}\n\t\t\t\tif (placeSpotQuality == PlaceSpotQuality.Perfect)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn (int)placeSpotQuality > 0;\n\t}\n\n\tprivate static PlaceSpotQuality PlaceSpotQualityAt(IntVec3 c, Rot4 rot, Map map, Thing thing, IntVec3 center, bool allowStacking, Predicate extraValidator = null)\n\t{\n\t\tif (!GenSpawn.CanSpawnAt(thing.def, c, map, rot))\n\t\t{\n\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t}\n\t\tif (extraValidator != null && !extraValidator(c))\n\t\t{\n\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t}\n\t\tthingList.Clear();\n\t\tforeach (IntVec3 item in GenAdj.OccupiedRect(c, rot, thing.def.Size))\n\t\t{\n\t\t\tthingList.AddRange(item.GetThingList(map));\n\t\t}\n\t\tbool flag = false;\n\t\tfor (int i = 0; i < thingList.Count; i++)\n\t\t{\n\t\t\tThing thing2 = thingList[i];\n\t\t\tif (thing.def.saveCompressible && thing2.def.saveCompressible)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t\t}\n\t\t\tif (thing.def.category == ThingCategory.Item && thing2.def.category == ThingCategory.Item && allowStacking && thing2.stackCount < thing2.def.stackLimit && thing2.CanStackWith(thing))\n\t\t\t{\n\t\t\t\tflag = true;\n\t\t\t}\n\t\t}\n\t\tif (thing.def.category == ThingCategory.Item && !flag && c.GetItemCount(map) >= c.GetMaxItemsAllowedInCell(map))\n\t\t{\n\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t}\n\t\tif (c.GetEdifice(map) is IHaulDestination haulDestination && !haulDestination.Accepts(thing))\n\t\t{\n\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t}\n\t\tif (thing is Building)\n\t\t{\n\t\t\tforeach (IntVec3 item2 in GenAdj.OccupiedRect(c, rot, thing.def.size))\n\t\t\t{\n\t\t\t\tBuilding edifice = item2.GetEdifice(map);\n\t\t\t\tif (edifice != null && GenSpawn.SpawningWipes(thing.def, edifice.def))\n\t\t\t\t{\n\t\t\t\t\treturn PlaceSpotQuality.Awful;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (c.GetRoom(map) != center.GetRoom(map))\n\t\t{\n\t\t\tif (!map.reachability.CanReach(center, c, PathEndMode.OnCell, TraverseMode.PassDoors, Danger.Deadly))\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Awful;\n\t\t\t}\n\t\t\treturn PlaceSpotQuality.Bad;\n\t\t}\n\t\tif (allowStacking)\n\t\t{\n\t\t\tfor (int j = 0; j < thingList.Count; j++)\n\t\t\t{\n\t\t\t\tThing thing3 = thingList[j];\n\t\t\t\tif (thing3.def.category == ThingCategory.Item && thing3.CanStackWith(thing) && thing3.stackCount < thing3.def.stackLimit)\n\t\t\t\t{\n\t\t\t\t\treturn PlaceSpotQuality.Perfect;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbool flag2 = thing is Pawn pawn && pawn.Downed;\n\t\tPlaceSpotQuality placeSpotQuality = PlaceSpotQuality.Perfect;\n\t\tfor (int k = 0; k < thingList.Count; k++)\n\t\t{\n\t\t\tThing thing4 = thingList[k];\n\t\t\tif (thing4.def.Fillage == FillCategory.Full)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4.def.preventDroppingThingsOn)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4.def.IsDoor)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4 is Building_WorkTable)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4 is Pawn pawn2 && (pawn2.Downed || flag2))\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4.def.category == ThingCategory.Plant && thing4.def.selectable && (int)placeSpotQuality > 3)\n\t\t\t{\n\t\t\t\tplaceSpotQuality = PlaceSpotQuality.Okay;\n\t\t\t}\n\t\t}\n\t\treturn placeSpotQuality;\n\t}\n\n\tprivate static bool SplitAndSpawnOneStackOnCell(Thing thing, IntVec3 loc, Rot4 rot, Map map, out Thing resultingThing, Action placedAction)\n\t{\n\t\tThing thing2 = ((thing.stackCount <= thing.def.stackLimit) ? thing : thing.SplitOff(thing.def.stackLimit));\n\t\tresultingThing = GenSpawn.Spawn(thing2, loc, map, rot);\n\t\tplacedAction?.Invoke(thing2, thing2.stackCount);\n\t\treturn thing2 == thing;\n\t}\n\n\tprivate static bool TryPlaceDirect(Thing thing, IntVec3 loc, Rot4 rot, Map map, out Thing resultingThing, Action placedAction = null)\n\t{\n\t\tresultingThing = null;\n\t\tcellThings.Clear();\n\t\tcellThings.AddRange(loc.GetThingList(map));\n\t\tcellThings.Sort((Thing lhs, Thing rhs) => rhs.stackCount.CompareTo(lhs.stackCount));\n\t\tif (thing.def.stackLimit > 1)\n\t\t{\n\t\t\tfor (int i = 0; i < cellThings.Count; i++)\n\t\t\t{\n\t\t\t\tThing thing2 = cellThings[i];\n\t\t\t\tif (thing2.CanStackWith(thing))\n\t\t\t\t{\n\t\t\t\t\tint stackCount = thing.stackCount;\n\t\t\t\t\tif (thing2.TryAbsorbStack(thing, respectStackLimit: true))\n\t\t\t\t\t{\n\t\t\t\t\t\tresultingThing = thing2;\n\t\t\t\t\t\tplacedAction?.Invoke(thing2, stackCount);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (placedAction != null && stackCount != thing.stackCount)\n\t\t\t\t\t{\n\t\t\t\t\t\tplacedAction(thing2, stackCount - thing.stackCount);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint num2;\n\t\tif (thing.def.category == ThingCategory.Item)\n\t\t{\n\t\t\tint num = cellThings.Count((Thing cellThing) => cellThing.def.category == ThingCategory.Item);\n\t\t\tnum2 = loc.GetMaxItemsAllowedInCell(map) - num;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tnum2 = thing.stackCount + 1;\n\t\t}\n\t\tif (num2 <= 0 && thing.def.stackLimit <= 1)\n\t\t{\n\t\t\tnum2 = 1;\n\t\t}\n\t\tfor (int j = 0; j < num2; j++)\n\t\t{\n\t\t\tif (SplitAndSpawnOneStackOnCell(thing, loc, rot, map, out resultingThing, placedAction))\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static Thing HaulPlaceBlockerIn(Thing haulThing, IntVec3 c, Map map, bool checkBlueprintsAndFrames)\n\t{\n\t\tList list = map.thingGrid.ThingsListAt(c);\n\t\tfor (int i = 0; i < list.Count; i++)\n\t\t{\n\t\t\tThing thing = list[i];\n\t\t\tif (checkBlueprintsAndFrames && (thing.def.IsBlueprint || thing.def.IsFrame))\n\t\t\t{\n\t\t\t\treturn thing;\n\t\t\t}\n\t\t\tif ((thing.def.category != ThingCategory.Plant || thing.def.passability != 0) && thing.def.category != ThingCategory.Filth && (haulThing == null || thing.def.category != ThingCategory.Item || !thing.CanStackWith(haulThing) || thing.def.stackLimit - thing.stackCount < haulThing.stackCount))\n\t\t\t{\n\t\t\t\tif (thing.def.EverHaulable)\n\t\t\t\t{\n\t\t\t\t\treturn thing;\n\t\t\t\t}\n\t\t\t\tif (haulThing != null && GenSpawn.SpawningWipes(haulThing.def, thing.def))\n\t\t\t\t{\n\t\t\t\t\treturn thing;\n\t\t\t\t}\n\t\t\t\tif (thing.def.passability != 0 && thing.def.surfaceType != SurfaceType.Item)\n\t\t\t\t{\n\t\t\t\t\treturn thing;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n}\n\n", + "timestamp": "2025-08-29 15:32:32,527" } } \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Spawner/CompMultiFuelSpawner.cs b/Source/WulaFallenEmpire/Spawner/CompMultiFuelSpawner.cs new file mode 100644 index 00000000..5c815521 --- /dev/null +++ b/Source/WulaFallenEmpire/Spawner/CompMultiFuelSpawner.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using System.Linq; +using RimWorld; +using Verse; + +namespace WulaFallenEmpire +{ + public class SpawnerProduct + { + public ThingDef thingDef; + public int count = 1; + } + + // --- Properties Class --- + public class CompProperties_MultiFuelSpawner : CompProperties + { + public List products; + public IntRange spawnIntervalRange = new IntRange(100, 100); + public bool spawnForbidden; + public bool inheritFaction; + public bool showMessageIfOwned; + + public CompProperties_MultiFuelSpawner() + { + compClass = typeof(CompMultiFuelSpawner); + } + } + + // --- Component Class --- + public class CompMultiFuelSpawner : ThingComp + { + private int ticksUntilSpawn; + private List fuelComps; + + public CompProperties_MultiFuelSpawner Props => (CompProperties_MultiFuelSpawner)props; + + public override void PostSpawnSetup(bool respawningAfterLoad) + { + base.PostSpawnSetup(respawningAfterLoad); + if (!respawningAfterLoad) + { + ResetCountdown(); + } + fuelComps = parent.GetComps().ToList(); + } + + public override void PostExposeData() + { + base.PostExposeData(); + Scribe_Values.Look(ref ticksUntilSpawn, "ticksUntilSpawn", 0); + } + + public override void CompTick() + { + base.CompTick(); + + if (fuelComps.NullOrEmpty()) return; + + bool allFuelsOk = fuelComps.All(c => c.HasFuel); + + if (allFuelsOk && (parent.GetComp()?.PowerOn ?? true)) + { + ticksUntilSpawn--; + if (ticksUntilSpawn <= 0) + { + foreach (var comp in fuelComps) + { + comp.Notify_UsedThisTick(); + } + + TryDoSpawn(); + ResetCountdown(); + } + } + } + + public void TryDoSpawn() + { + if (Props.products.NullOrEmpty()) return; + + foreach (var product in Props.products) + { + Thing thing = ThingMaker.MakeThing(product.thingDef); + thing.stackCount = product.count; + + if (Props.inheritFaction && thing.Faction != parent.Faction) + { + thing.SetFaction(parent.Faction); + } + + if (GenPlace.TryPlaceThing(thing, parent.Position, parent.Map, ThingPlaceMode.Near, out Thing resultingThing)) + { + if (Props.spawnForbidden) + { + resultingThing.SetForbidden(true); + } + + if (Props.showMessageIfOwned && parent.Faction == Faction.OfPlayer) + { + Messages.Message("MessageCompSpawnerSpawnedItem".Translate(resultingThing.LabelCap), resultingThing, MessageTypeDefOf.PositiveEvent); + } + } + } + } + + private void ResetCountdown() + { + ticksUntilSpawn = Props.spawnIntervalRange.RandomInRange; + } + + public override string CompInspectStringExtra() + { + string text = base.CompInspectStringExtra(); + + if (fuelComps.All(c => c.HasFuel)) + { + if (!text.NullOrEmpty()) + { + text += "\n"; + } + string productsStr = Props.products.Select(p => (string)p.thingDef.LabelCap).ToCommaList(); + text += "NextSpawnedItemIn".Translate(productsStr) + ": " + ticksUntilSpawn.ToStringTicksToPeriod(); + } + + return text; + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Spawner/CompRefuelableSpawner.cs b/Source/WulaFallenEmpire/Spawner/CompRefuelableSpawner.cs new file mode 100644 index 00000000..6b4bfc5c --- /dev/null +++ b/Source/WulaFallenEmpire/Spawner/CompRefuelableSpawner.cs @@ -0,0 +1,138 @@ +using System.Collections.Generic; +using System.Linq; +using RimWorld; +using Verse; + +namespace WulaFallenEmpire +{ + // --- Properties Class --- + public class CompProperties_RefuelableSpawner : CompProperties_Refuelable + { + public List products; + public IntRange spawnIntervalRange = new IntRange(100, 100); + public bool spawnForbidden; + public bool inheritFaction; + public bool showMessageIfOwned; + + public CompProperties_RefuelableSpawner() + { + compClass = typeof(CompRefuelableSpawner); + } + } + + // --- Component Class --- + public class CompRefuelableSpawner : CompRefuelable + { + private int ticksUntilSpawn; + + public new CompProperties_RefuelableSpawner Props => (CompProperties_RefuelableSpawner)props; + + public override void PostExposeData() + { + base.PostExposeData(); + Scribe_Values.Look(ref ticksUntilSpawn, "ticksUntilSpawn", 0); + } + + public override void PostSpawnSetup(bool respawningAfterLoad) + { + base.PostSpawnSetup(respawningAfterLoad); + if (!respawningAfterLoad) + { + ResetCountdown(); + } + } + + public override void CompTick() + { + base.CompTick(); + + if (HasFuel && (parent.GetComp()?.PowerOn ?? true)) + { + ticksUntilSpawn--; + if (ticksUntilSpawn <= 0) + { + TryDoSpawn(); + ResetCountdown(); + } + } + } + + public void TryDoSpawn() + { + if (Props.products.NullOrEmpty()) return; + + foreach (var product in Props.products) + { + Thing thing = ThingMaker.MakeThing(product.thingDef); + thing.stackCount = product.count; + + if (Props.inheritFaction && thing.Faction != parent.Faction) + { + thing.SetFaction(parent.Faction); + } + + if (GenPlace.TryPlaceThing(thing, parent.Position, parent.Map, ThingPlaceMode.Near, out Thing resultingThing)) + { + if (Props.spawnForbidden) + { + resultingThing.SetForbidden(true); + } + + if (Props.showMessageIfOwned && parent.Faction == Faction.OfPlayer) + { + Messages.Message("MessageCompSpawnerSpawnedItem".Translate(resultingThing.LabelCap), resultingThing, MessageTypeDefOf.PositiveEvent); + } + } + } + } + + private void ResetCountdown() + { + ticksUntilSpawn = Props.spawnIntervalRange.RandomInRange; + } + + public override string CompInspectStringExtra() + { + string text = base.CompInspectStringExtra(); + + if (HasFuel) + { + if (!text.NullOrEmpty()) + { + text += "\n"; + } + string productsStr = Props.products.Select(p => (string)p.thingDef.LabelCap).ToCommaList(); + text += "NextSpawnedItemIn".Translate(productsStr) + ": " + ticksUntilSpawn.ToStringTicksToPeriod(); + } + + return text; + } + + public override IEnumerable CompGetGizmosExtra() + { + foreach (var g in base.CompGetGizmosExtra()) + { + yield return g; + } + + if (Prefs.DevMode) + { + yield return new Command_Action + { + defaultLabel = "DEBUG: Spawn items", + action = delegate + { + TryDoSpawn(); + ResetCountdown(); + } + }; + } + } + } + + public class SpawnerProduct + { + public ThingDef thingDef; + public int count = 1; + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Spawner/CompRefuelableWithKey.cs b/Source/WulaFallenEmpire/Spawner/CompRefuelableWithKey.cs new file mode 100644 index 00000000..12411b6f --- /dev/null +++ b/Source/WulaFallenEmpire/Spawner/CompRefuelableWithKey.cs @@ -0,0 +1,24 @@ +using RimWorld; +using Verse; + +namespace WulaFallenEmpire +{ + // 1. New Properties class that adds the save key + public class CompProperties_RefuelableWithKey : CompProperties_Refuelable + { + public string saveKeysPrefix; + + public CompProperties_RefuelableWithKey() + { + compClass = typeof(CompRefuelableWithKey); + } + } + + // 2. New Component class. It's empty for now. + // Its purpose is to be a safe target for our Harmony patch. + public class CompRefuelableWithKey : CompRefuelable + { + // We will override PostExposeData using a Harmony patch + // to avoid re-implementing the entire class. + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Spawner/CompRefuelable_WithKey.cs b/Source/WulaFallenEmpire/Spawner/CompRefuelable_WithKey.cs new file mode 100644 index 00000000..53155137 --- /dev/null +++ b/Source/WulaFallenEmpire/Spawner/CompRefuelable_WithKey.cs @@ -0,0 +1,163 @@ +using System.Collections.Generic; +using System.Linq; +using RimWorld; +using UnityEngine; +using Verse; + +namespace WulaFallenEmpire +{ + // --- 1. The Properties Class --- + public class CompProperties_Refuelable_WithKey : CompProperties + { + public float fuelConsumptionRate = 1f; + public float fuelCapacity = 2f; + public float initialFuelPercent; + public float autoRefuelPercent = 0.3f; + public ThingFilter fuelFilter; + public bool consumeFuelOnlyWhenUsed = true; + public bool showFuelGizmo = true; + public bool targetFuelLevelConfigurable; + public float initialConfigurableTargetFuelLevel = -1f; + public string fuelLabel; + public string outOfFuelMessage; + public bool showAllowAutoRefuelToggle; + public string saveKeysPrefix; // The only field we are adding + + public CompProperties_Refuelable_WithKey() + { + compClass = typeof(CompRefuelable_WithKey); + } + } + + // --- 2. The Component Class (Full Re-implementation) --- + public class CompRefuelable_WithKey : ThingComp + { + // Re-implemented fields from CompRefuelable + private float fuel; + private float configuredTargetFuelLevel = -1f; + public bool allowAutoRefuel = true; + private CompFlickable flickComp; + + public new CompProperties_Refuelable_WithKey Props => (CompProperties_Refuelable_WithKey)props; + + public float Fuel => fuel; + public bool HasFuel => fuel > 0f; + public bool IsFull => TargetFuelLevel - fuel < 1f; + public float FuelPercentOfMax => fuel / Props.fuelCapacity; + public float TargetFuelLevel + { + get + { + if (configuredTargetFuelLevel >= 0f) return configuredTargetFuelLevel; + if (Props.targetFuelLevelConfigurable) return Props.initialConfigurableTargetFuelLevel; + return Props.fuelCapacity; + } + set => configuredTargetFuelLevel = Mathf.Clamp(value, 0f, Props.fuelCapacity); + } + public bool ShouldAutoRefuelNow => Fuel / TargetFuelLevel <= Props.autoRefuelPercent && !IsFull && TargetFuelLevel > 0f && (flickComp == null || flickComp.SwitchIsOn); + + + public override void Initialize(CompProperties props) + { + base.Initialize(props); + allowAutoRefuel = true; // Simplified from base + fuel = Props.fuelCapacity * Props.initialFuelPercent; + if(Props.initialConfigurableTargetFuelLevel > 0) + { + configuredTargetFuelLevel = Props.initialConfigurableTargetFuelLevel; + } + } + + public override void PostSpawnSetup(bool respawningAfterLoad) + { + base.PostSpawnSetup(respawningAfterLoad); + flickComp = parent.GetComp(); + } + + // The ONLY method we actually change + public override void PostExposeData() + { + base.PostExposeData(); + string prefix = Props.saveKeysPrefix; + if (prefix.NullOrEmpty()) + { + Log.ErrorOnce($"CompRefuelable_WithKey on {parent.def.defName} has a null or empty saveKeysPrefix.", GetHashCode()); + // Fallback to default scribing to avoid data loss + Scribe_Values.Look(ref fuel, "fuel", 0f); + Scribe_Values.Look(ref configuredTargetFuelLevel, "configuredTargetFuelLevel", -1f); + Scribe_Values.Look(ref allowAutoRefuel, "allowAutoRefuel", true); + return; + } + Scribe_Values.Look(ref fuel, prefix + "_fuel", 0f); + Scribe_Values.Look(ref configuredTargetFuelLevel, prefix + "_configuredTargetFuelLevel", -1f); + Scribe_Values.Look(ref allowAutoRefuel, prefix + "_allowAutoRefuel", true); + } + + public void ConsumeFuel(float amount) + { + if (fuel <= 0f) return; + fuel -= amount; + if (fuel <= 0f) + { + fuel = 0f; + parent.BroadcastCompSignal("RanOutOfFuel"); + } + } + + public void Refuel(float amount) + { + fuel += amount; + if (fuel > Props.fuelCapacity) + { + fuel = Props.fuelCapacity; + } + parent.BroadcastCompSignal("Refueled"); + } + + public void Notify_UsedThisTick() + { + if (Props.consumeFuelOnlyWhenUsed) + { + ConsumeFuel(Props.fuelConsumptionRate / 60000f); + } + } + + public override IEnumerable CompGetGizmosExtra() + { + if (!Props.showFuelGizmo || parent.Faction != Faction.OfPlayer) yield break; + + // Simplified Gizmo Status (can be replaced with copied Gizmo_RefuelableFuelStatus later) + yield return new Gizmo_FuelStatus_Spawner(new FuelSystem(this)); // Using a dummy adapter + + // Copied Set Target Level Command + if (Props.targetFuelLevelConfigurable) + { + var command = new Command_Action + { + defaultLabel = "CommandSetTargetFuelLevel".Translate(), + defaultDesc = "CommandSetTargetFuelLevelDesc".Translate(), + icon = ContentFinder.Get("UI/Commands/SetTargetFuelLevel"), + action = delegate + { + Dialog_Slider dialog = new Dialog_Slider( + "SetTargetFuelLevel".Translate(), 0, (int)Props.fuelCapacity, + (val) => TargetFuelLevel = val, (int)TargetFuelLevel); + Find.WindowStack.Add(dialog); + } + }; + yield return command; + } + } + } + + // Dummy adapter to make the new Gizmo work temporarily + public class FuelSystem + { + public CompRefuelable_WithKey comp; + public FuelSystem(CompRefuelable_WithKey comp) { this.comp = comp; } + public float Fuel => comp.Fuel; + public float FuelPercent => comp.FuelPercentOfMax; + public CompProperties_Refuelable props => comp.Props; + public float TargetFuelLevel { get => comp.TargetFuelLevel; set => comp.TargetFuelLevel = value; } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Spawner/Patch_CompRefuelableWithKey.cs b/Source/WulaFallenEmpire/Spawner/Patch_CompRefuelableWithKey.cs new file mode 100644 index 00000000..ad9bab7f --- /dev/null +++ b/Source/WulaFallenEmpire/Spawner/Patch_CompRefuelableWithKey.cs @@ -0,0 +1,59 @@ +using System.Reflection; +using HarmonyLib; +using RimWorld; +using Verse; + +namespace WulaFallenEmpire +{ + // We patch the base class method + [HarmonyPatch(typeof(CompRefuelable), "PostExposeData")] + public static class Patch_CompRefuelableWithKey_PostExposeData + { + public static bool Prefix(CompRefuelable __instance) + { + // But we only act if the instance is our custom subclass + if (!(__instance is CompRefuelableWithKey refuelableWithKey)) + { + // If it's not our class, run the original method + return true; + } + + // Get the private fields from the base CompRefuelable class using reflection + FieldInfo fuelField = AccessTools.Field(typeof(CompRefuelable), "fuel"); + FieldInfo configuredTargetFuelLevelField = AccessTools.Field(typeof(CompRefuelable), "configuredTargetFuelLevel"); + FieldInfo allowAutoRefuelField = AccessTools.Field(typeof(CompRefuelable), "allowAutoRefuel"); + + // Get the props from our custom component + var props = (CompProperties_RefuelableWithKey)refuelableWithKey.Props; + string prefix = props.saveKeysPrefix; + + if (prefix.NullOrEmpty()) + { + Log.ErrorOnce($"CompRefuelableWithKey on {refuelableWithKey.parent.def.defName} has a null or empty saveKeysPrefix. Defaulting to standard save.", refuelableWithKey.GetHashCode()); + // If no prefix, let the original method run + return true; + } + + // Get current values from the instance + float fuel = (float)fuelField.GetValue(refuelableWithKey); + float configuredTargetFuelLevel = (float)configuredTargetFuelLevelField.GetValue(refuelableWithKey); + bool allowAutoRefuel = (bool)allowAutoRefuelField.GetValue(refuelableWithKey); + + // Scribe the values with our prefix + Scribe_Values.Look(ref fuel, prefix + "_fuel", 0f); + Scribe_Values.Look(ref configuredTargetFuelLevel, prefix + "_configuredTargetFuelLevel", -1f); + Scribe_Values.Look(ref allowAutoRefuel, prefix + "_allowAutoRefuel", true); + + // Set the new values back to the instance + if (Scribe.mode == LoadSaveMode.LoadingVars) + { + fuelField.SetValue(refuelableWithKey, fuel); + configuredTargetFuelLevelField.SetValue(refuelableWithKey, configuredTargetFuelLevel); + allowAutoRefuelField.SetValue(refuelableWithKey, allowAutoRefuel); + } + + // Prevent the original PostExposeData from running + return false; + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Spawner/Utility.cs b/Source/WulaFallenEmpire/Spawner/Utility.cs new file mode 100644 index 00000000..bffd54b1 --- /dev/null +++ b/Source/WulaFallenEmpire/Spawner/Utility.cs @@ -0,0 +1,303 @@ +using System.Collections.Generic; +using System.Linq; +using RimWorld; +using UnityEngine; +using Verse; + +namespace WulaFallenEmpire +{ + public static class Lifespan_Utility + { + public static IEnumerable deathThought = new List + { + ThoughtDefOf.KnowColonistDied, + ThoughtDefOf.PawnWithGoodOpinionDied, + ThoughtDefOf.WitnessedDeathFamily, + ThoughtDefOf.WitnessedDeathAlly, + }; + + public static bool IsDeathThought(this ThoughtDef tDef) + { + return (deathThought.Contains(tDef)); + } + + public static Thing ThingInCaseOfDeath(Pawn p) + { + Thing refThing; + if (p.Dead) + { + if (p.Corpse == null) + return null; + refThing = p.Corpse; + } + else + refThing = p; + + return refThing; + } + + public static void TrySpawnFilth(Thing refT, float filthRadius, ThingDef filthDef) + { + if ( + refT.Map != null + && CellFinder.TryFindRandomReachableNearbyCell( + refT.Position, + refT.Map, + filthRadius, + TraverseParms.For(TraverseMode.NoPassClosedDoors), + x => x.Standable(refT.Map), + x => true, + out IntVec3 result + ) + ) + FilthMaker.TryMakeFilth(result, refT.Map, filthDef); + } + + public static void ThrowCustomSmoke(ThingDef moteDef, Vector3 loc, Map map, float size) + { + if (loc.ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) + { + MoteThrown obj = (MoteThrown)ThingMaker.MakeThing(moteDef); + obj.Scale = Rand.Range(1.5f, 2.5f) * size; + obj.rotationRate = Rand.Range(-30f, 30f); + obj.exactPosition = loc; + obj.SetVelocity(Rand.Range(30, 40), Rand.Range(0.5f, 0.7f)); + GenSpawn.Spawn(obj, loc.ToIntVec3(), map); + } + } + + public static bool TryDoSpawn( + Pawn pawn, + ThingDef thingDef, + int thingNum, + int spawnMaxAdjacent, + bool tryToUnstack, + bool inheritFaction, + bool spawnForbidden, + bool showMessageIfOwned + ) + { + Thing refThing = ThingInCaseOfDeath(pawn); + IntVec3 spawnPos; + Map map; + if (refThing == null) + return false; + else + { + map = refThing.Map; + spawnPos = refThing.Position; + } + + if (spawnMaxAdjacent >= 0) + { + int num = 0; + for (int i = 0; i < 9; i++) + { + IntVec3 c = spawnPos + GenAdj.AdjacentCellsAndInside[i]; + if (!c.InBounds(map)) + continue; + + List thingList = c.GetThingList(map); + + for (int j = 0; j < thingList.Count; j++) + { + if (thingList[j].def == thingDef) + { + if (tryToUnstack) + continue; + + num += thingList[j].stackCount; + if (num >= spawnMaxAdjacent) + return false; + } + } + } + } + if (TryFindSpawnCell(refThing, thingDef, thingNum, tryToUnstack, out IntVec3 result)) + { + Thing thing = ThingMaker.MakeThing(thingDef); + thing.stackCount = thingNum; + if (thing == null) + Log.Error("Could not spawn anything for " + refThing); + + if (inheritFaction && thing.Faction != refThing.Faction) + thing.SetFaction(refThing.Faction); + + GenPlace.TryPlaceThing( + thing, + result, + map, + ThingPlaceMode.Direct, + out Thing lastResultingThing + ); + if (spawnForbidden) + lastResultingThing.SetForbidden(value: true); + + if (showMessageIfOwned && refThing.Faction == Faction.OfPlayer) + Messages.Message( + "MessageCompSpawnerSpawnedItem".Translate(thingDef.LabelCap), + thing, + MessageTypeDefOf.PositiveEvent + ); + + return true; + } + return false; + } + + public static bool TryFindSpawnCell( + Thing parent, + ThingDef thingToSpawn, + int spawnCount, + bool tryToUnstack, + out IntVec3 result + ) + { + foreach (IntVec3 item in GenAdj.CellsAdjacent8Way(parent).InRandomOrder()) + { + if (item.Walkable(parent.Map)) + { + Building edifice = item.GetEdifice(parent.Map); + if (edifice == null || !thingToSpawn.IsEdifice()) + { + Building_Door building_Door = edifice as Building_Door; + if ( + (building_Door == null || building_Door.FreePassage) + && ( + parent.def.passability == Traversability.Impassable + || GenSight.LineOfSight(parent.Position, item, parent.Map) + ) + ) + { + bool flag = false; + List thingList = item.GetThingList(parent.Map); + + for (int i = 0; i < thingList.Count; i++) + { + Thing thing = thingList[i]; + if ( + thing.def.category == ThingCategory.Item + && ( + thing.def != thingToSpawn + || thing.stackCount > thingToSpawn.stackLimit - spawnCount + ) + ) + { + flag = true; + break; + } + } + + if (!flag) + { + result = item; + return true; + } + } + } + } + } + result = IntVec3.Invalid; + return false; + } + + public static bool RemoveBadMemoriesOfDeadPawn(Pawn deadPawn, bool myDebug = false) + { + bool didIt = false; + if (deadPawn == null) + { + Log.Warning("removingRelationAndThoughts, null pawn"); + return didIt; + } + string deadName = deadPawn.LabelShortCap; + Log.Warning(">>>>>" + deadName + " dissappeared, the world must not know"); + + foreach ( + Pawn p in Find.CurrentMap.mapPawns.AllPawnsSpawned.Where(pH => + pH != deadPawn + && pH.needs.mood?.thoughts?.memories != null + && pH.needs.mood.thoughts.memories.AnyMemoryConcerns(deadPawn) + ) + ) + { + Log.Warning(p.LabelShortCap + " has memories of " + deadName); + + Log.Warning( + "pre removal mem count: " + p.needs.mood.thoughts.memories.Memories.Count + ); + p.needs.mood.thoughts.memories.Memories.RemoveAll(TM => + TM.otherPawn == deadPawn && TM.MoodOffset() <= 0f + ); + Log.Warning( + "post removal mem count: " + p.needs.mood.thoughts.memories.Memories.Count + ); + } + + return didIt; + } + + public static void removingRelationAndThoughts(Pawn deadPawn, bool myDebug = false) + { + if (deadPawn == null) + { + Log.Warning("removingRelationAndThoughts, null pawn"); + return; + } + string deadName = deadPawn.LabelShortCap; + + Log.Warning(">>>>>" + deadName + " dissappeared, the world must not know"); + foreach ( + Pawn p in Find.CurrentMap.mapPawns.AllPawnsSpawned.Where(pH => + //!pH.AnimalOrWildMan() && + pH != deadPawn + && !pH.GetRelations(deadPawn).EnumerableNullOrEmpty() + ) + ) + { + string pName = p.LabelShortCap; + Log.Warning("Considering :" + pName); + IEnumerable relationT = PawnRelationUtility.GetRelations( + deadPawn, + p + ); + if (relationT.EnumerableNullOrEmpty()) + continue; + + List pThoughts = new List(); + if (p.needs.mood == null || p.needs.mood.thoughts == null) + continue; + //p.needs.mood.thoughts.memories.AnyMemoryConcerns() + if (pThoughts.NullOrEmpty()) + return; + int tNum = 0; + foreach (Thought thought in pThoughts) + { + Log.Warning(pName + "'s Thought n" + tNum); + tNum++; + + if (thought.pawn == null || deadPawn == null) + continue; + + if (IsDeathThought(thought.def)) + { + if ( + !( + thought is Thought_MemorySocial TMS + && TMS.otherPawn != null + && TMS.otherPawn == deadPawn + ) + ) + continue; + + deadPawn.needs.mood.thoughts.memories.RemoveMemory(TMS); + + Log.Warning( + "removed " + pName + "'s thought " + thought.def.defName + ); + } + } + } + Log.Warning("<<<<<" + deadName); + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 88df74d4..731d77d4 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -194,6 +194,12 @@ + + + + + +