<clean code>-chapter 02 : Meaningful Names

本文分享了阅读《Clean Code》第二章后的感悟,强调了变量和函数命名的重要性,并总结了书中提出的16条命名规则,如使用有意义且易读的名字等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

LeBlanc's law : later equal s never. 
把《clean code》的第二章读完了,谈谈感想,第一次完完整整的看英文书籍,可能有些地方理解的有问题。

我一直觉得写给变量,函数,取个有意义的名字很重要,其实里面的很多法则还是知道的,奈何一个是自己熟知的范围有限,一个是自己的英文水平实在是不好。所以总是找不到可以让自己很满意的名字。把第二章的几条取名字规则总结一下吧:

1. 取个能够反映你意图的名字(Use Intention-Revealing Names)

这个还是比较好理解的,变量名称还反映它的作用,这样读起来一下就知道这个变量是干嘛的了,不会每次读代码的时候就要回过头去看它的注释或者看它的定义,一般不要用什么a,b,c,d当作变量,变量名称长点没关系,现在的编译系统基本上都有自动补全功能。
2. 避免误导(Avoid Disinformation)
应该尽量避免使用和代码本意不相符的词,和第一条规则有点像。用同样的规则写出同样的概念才是information,拼写前后不一致就是disinformation.
3. 做有意义的区分(Make Meaningful Distinctions)
一个规则,如果名称必须相异,那其意思也应该不同才行,用数字系列命名的名称没有提供正确的信息,也没有提供编码者意图的线索。
废话(Nose words)也是没有意义的区分,productInfo和productData类,名字有差别,其实意义是一样的。还不如直接用product。
4. 使用读得出来的名称(Use Pronounceable Names)
使用读得出来的名字可以使得你在和别人讨论的时候可以让别人明白你的意思,便于讨论和交流。
5. 使用可搜索的名字(Use Searchable Names)
使得你的名字应该是独特的,在代码中单字母的名字和数字变量是很难在代码中找出来的。因此给数字变量定义一个名字还是还有必要的,这样便于搜索,比如最大值10, 用MAX当然会比10来的好。便于搜索。
6. 避免使用编码(Avoid Encodings)
我原来之前用的都是用匈牙利编码,对于每个变量名字之前都要表明它的类型,不过现在完全没有必要了,现在只要你把鼠标放上去,之前这个变量的类型就出来了,用了表示类型的变量后,在之后改变变量的类型的时候,如果不改变变量名称的话将会导致误解。
还有前缀的使用,变量用m_这种前缀,现在完全没有必要用前缀了。
接口和实现,我觉得这个看个人喜好吧,我也没觉得前面加I作为接口标识有什么不好,个人喜好。
7. 避免思维映射(Avoid Mental Mapping)
在多数情况下,单字母名称不是好的选择,clarity is king.明确才是王道。这个和下面的13和14点差不多。
8. 类名(Class Names)
类名和对象名应该是名词或者是名词短语,比如用Customer, WikiPage, Account, and AddressParser会比Manager, Processor, Data, Info 要好。类名不应该是动词。
9. 方法名(Method Names)
方法名应该是动词或者动词短语,用get,set和is等等前缀,而且前缀最好统一,不要一下用get,一下用fetch的。
下面这个有点不太懂:
用Complex fulcrumPoint = Complex.FromRealNumber(23.0)为什么好于 Complex fulcrumPoint = new Complex(23.0);
有大神可以帮忙解释下,我个人还是喜欢直接用重载构造函数。
10. 别装可爱(Don't Be Cute)
这个就很明显了,用些可爱的词,只有自己懂,别人看不懂。
11. 一词一意(Pick One Word per Concept)
每个概念对应一个词,就像用get就用get,就不要一下用get,一下用fetch。
12. 别用双关语(Don't Pun)
双关语模糊概念。
13. 使用解决方案领域名字(Use Solution Domain Names)
用专业的词语,毕竟看代码的人也是专业领域的人。
14. 使用涉及问题领域的名字(Use Problem Domain Names)
如果实在不能用解决方案领域的名字,就用这个问题领域的词,看代码的人可以去问这方面的专家。
15. 添加有意义的语境(Add Meaningfu Context)
添加一些前缀给一些变量,使得变得有语境,比如address里面有state,city等等。单独用state,肯定不明确。所以在前面加个addrState可以使得这个语句更有含义。
16. 别添加没有用的语境(Don't Add Gratuitous Context)
有些没必要添加前缀的就不要添加。

个人感觉,这个东西其实不是太难,不过是看起来不是太难,做起来还是比较困难的,这些规则我都知道,不过有时候实在是想不出一个好名字来,这个可能还是需要一些磨练,反正我做的不能收发由心,有时候想着想着就词穷了,现在在苦逼的写英语。
给自己加加油!!!加油!!!!
You have to believe in yourself.That's the secret of success.

<?xml version="1.0" encoding="utf-8" ?> <Defs> <!-- Base: Bionic body part (spacer tech) --> <ThingDef Name="BodyPartBionicBase" ParentName="BodyPartBase" Abstract="True"> <techLevel>Spacer</techLevel> <thingCategories> <li>BodyPartsBionic</li> </thingCategories> <graphicData> <texPath>Things/Item/Health/HealthItem</texPath> <graphicClass>Graphic_Single</graphicClass> <drawSize>0.80</drawSize> <color>(189,169,118)</color> </graphicData> <tradeTags> <li>Bionic</li> </tradeTags> <techHediffsTags> <li>Advanced</li> </techHediffsTags> <statBases> <WorkToMake>26000</WorkToMake> </statBases> <recipeMaker> <workSpeedStat>GeneralLaborSpeed</workSpeedStat> <workSkill>Crafting</workSkill> <effectWorking>Smith</effectWorking> <soundWorking>Recipe_Smith</soundWorking> <unfinishedThingDef>UnfinishedHealthItemBionic</unfinishedThingDef> <skillRequirements> <Crafting>8</Crafting> </skillRequirements> <researchPrerequisite>Bionics</researchPrerequisite> <recipeUsers> <li>FabricationBench</li> </recipeUsers> <displayPriority>300</displayPriority> </recipeMaker> </ThingDef> <!-- Bionic eye --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicEye</defName> <label>bionic eye</label> <labelNoun>a bionic eye</labelNoun> <description>An installed bionic eye. With its biogel nerve-link, internal signal pre-processor, and wide-spectrum sensors, it is better than a biological eye in almost every way. A lattice-dust healing system allows it to recover from damage.</description> <descriptionHyperlinks><ThingDef>BionicEye</ThingDef></descriptionHyperlinks> <spawnThingOnRemoved>BionicEye</spawnThingOnRemoved> <addedPartProps> <solid>true</solid> <partEfficiency>1.25</partEfficiency> <betterThanNatural>true</betterThanNatural> </addedPartProps> <renderNodeProperties> <li Class="PawnRenderNodeProperties_Eye"> <workerClass>PawnRenderNodeWorker_HediffEye</workerClass> <texPath>Things/Pawn/Wounds/BionicEye</texPath> <parentTagDef>Head</parentTagDef> <drawSize>0.15</drawSize> <drawData> <defaultData> <layer>56</layer> <offset>(0, 0, -0.25)</offset> </defaultData> <dataWest> <flip>true</flip> </dataWest> </drawData> </li> </renderNodeProperties> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicEye</defName> <label>bionic eye</label> <description>An advanced artificial eye. With its biogel nerve-link, internal signal pre-processor, and wide-spectrum sensors, it is better than a biological eye in almost every way. A lattice-dust healing system allows it to recover from damage.</description> <descriptionHyperlinks><RecipeDef>InstallBionicEye</RecipeDef></descriptionHyperlinks> <costList> <Plasteel>15</Plasteel> <ComponentSpacer>4</ComponentSpacer> </costList> <thingSetMakerTags><li>RewardStandardMidFreq</li></thingSetMakerTags> <statBases> <Mass>0.3</Mass> </statBases> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicEye</defName> <label>install bionic eye</label> <description>Install a bionic eye.</description> <descriptionHyperlinks> <ThingDef>BionicEye</ThingDef> <HediffDef>BionicEye</HediffDef> </descriptionHyperlinks> <jobString>Installing bionic eye.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicEye</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicEye</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Eye</li> </appliedOnFixedBodyParts> <addsHediff>BionicEye</addsHediff> </RecipeDef> <!-- Bionic arm --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicArm</defName> <label>bionic arm</label> <labelNoun>a bionic arm</labelNoun> <description>An installed bionic arm. Silenced mini-servos give great strength, while the biogel nerve-link gives exquisite control. A lattice-dust healing system allows it to recover from damage. It is better than a biological arm in almost every way.</description> <descriptionHyperlinks><ThingDef>BionicArm</ThingDef></descriptionHyperlinks> <comps> <li Class="HediffCompProperties_VerbGiver"> <tools> <li> <label>fist</label> <capacities> <li>Blunt</li> </capacities> <power>12</power> <cooldownTime>2</cooldownTime> <soundMeleeHit>MeleeHit_BionicPunch</soundMeleeHit> <soundMeleeMiss>MeleeMiss_BionicPunch</soundMeleeMiss> </li> </tools> </li> </comps> <spawnThingOnRemoved>BionicArm</spawnThingOnRemoved> <addedPartProps> <solid>true</solid> <partEfficiency>1.25</partEfficiency> <betterThanNatural>true</betterThanNatural> </addedPartProps> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicArm</defName> <label>bionic arm</label> <description>An advanced artificial arm. Silenced mini-servos give great strength, while the biogel nerve-link gives exquisite control. A lattice-dust healing system allows it to recover from damage. It is better than a biological arm in almost every way.</description> <descriptionHyperlinks><RecipeDef>InstallBionicArm</RecipeDef></descriptionHyperlinks> <costList> <Plasteel>15</Plasteel> <ComponentSpacer>4</ComponentSpacer> </costList> <thingSetMakerTags><li>RewardStandardMidFreq</li></thingSetMakerTags> <statBases> <Mass>5</Mass> </statBases> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicArm</defName> <label>install bionic arm</label> <description>Install a bionic arm.</description> <descriptionHyperlinks> <ThingDef>BionicArm</ThingDef> <HediffDef>BionicArm</HediffDef> </descriptionHyperlinks> <jobString>Installing bionic arm.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicArm</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicArm</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Shoulder</li> </appliedOnFixedBodyParts> <addsHediff>BionicArm</addsHediff> </RecipeDef> <!-- Bionic leg --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicLeg</defName> <label>bionic leg</label> <labelNoun>a bionic leg</labelNoun> <description>An installed bionic leg. With its biogel nerve-link, powerful mini-servos, and lattice-dust healing system, it is better than a biological leg in almost every way.</description> <descriptionHyperlinks><ThingDef>BionicLeg</ThingDef></descriptionHyperlinks> <spawnThingOnRemoved>BionicLeg</spawnThingOnRemoved> <addedPartProps> <solid>true</solid> <partEfficiency>1.25</partEfficiency> <betterThanNatural>true</betterThanNatural> </addedPartProps> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicLeg</defName> <label>bionic leg</label> <description>An advanced artificial leg. With its biogel nerve-link, powerful mini-servos, and lattice-dust healing system, it is better than a biological leg in almost every way.</description> <descriptionHyperlinks><RecipeDef>InstallBionicLeg</RecipeDef></descriptionHyperlinks> <costList> <Plasteel>15</Plasteel> <ComponentSpacer>4</ComponentSpacer> </costList> <thingSetMakerTags><li>RewardStandardMidFreq</li></thingSetMakerTags> <statBases> <Mass>8</Mass> </statBases> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicLeg</defName> <label>install bionic leg</label> <description>Install a bionic leg.</description> <descriptionHyperlinks> <ThingDef>BionicLeg</ThingDef> <HediffDef>BionicLeg</HediffDef> </descriptionHyperlinks> <jobString>Installing bionic leg.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicLeg</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicLeg</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Leg</li> </appliedOnFixedBodyParts> <addsHediff>BionicLeg</addsHediff> </RecipeDef> <!-- Bionic spine --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicSpine</defName> <label>bionic spine</label> <labelNoun>a bionic spine</labelNoun> <description>An installed bionic spine. A biogel nerve bundle runs down an articulated plasteel core, surrounded by a lattice-dust healing system. It matches the performance of a biological spine.</description> <descriptionHyperlinks><ThingDef>BionicSpine</ThingDef></descriptionHyperlinks> <spawnThingOnRemoved>BionicSpine</spawnThingOnRemoved> <addedPartProps> <solid>true</solid> <betterThanNatural>true</betterThanNatural> </addedPartProps> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicSpine</defName> <label>bionic spine</label> <description>An advanced artificial spine. A biogel nerve bundle runs down an articulated plasteel core, surrounded by a lattice-dust healing system. It matches the performance of a biological spine.</description> <descriptionHyperlinks><RecipeDef>InstallBionicSpine</RecipeDef></descriptionHyperlinks> <costList> <Plasteel>15</Plasteel> <ComponentSpacer>4</ComponentSpacer> </costList> <statBases> <Mass>2</Mass> </statBases> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicSpine</defName> <label>install bionic spine</label> <description>Install a bionic spine.</description> <descriptionHyperlinks> <ThingDef>BionicSpine</ThingDef> <HediffDef>BionicSpine</HediffDef> </descriptionHyperlinks> <jobString>Installing bionic spine.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicSpine</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicSpine</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Spine</li> </appliedOnFixedBodyParts> <addsHediff>BionicSpine</addsHediff> </RecipeDef> <!-- Bionic heart --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicHeart</defName> <label>bionic heart</label> <labelNoun>a bionic heart</labelNoun> <description>An installed bionic heart. It has synthetic muscle fibers for a realistic heartbeat, plus a high-flow pump for rapid circulation during high stress. It is better than a biological heart in almost every way.</description> <descriptionHyperlinks><ThingDef>BionicHeart</ThingDef></descriptionHyperlinks> <spawnThingOnRemoved>BionicHeart</spawnThingOnRemoved> <addedPartProps> <solid>true</solid> <partEfficiency>1.25</partEfficiency> <betterThanNatural>true</betterThanNatural> </addedPartProps> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicHeart</defName> <label>bionic heart</label> <description>An advanced artificial heart. It has synthetic muscle fibers for a realistic heartbeat, plus a high-flow pump for rapid circulation during high stress. It is better than a biological heart in almost every way.</description> <descriptionHyperlinks><RecipeDef>InstallBionicHeart</RecipeDef></descriptionHyperlinks> <costList> <Plasteel>15</Plasteel> <ComponentSpacer>4</ComponentSpacer> </costList> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicHeart</defName> <label>install bionic heart</label> <description>Install a bionic heart.</description> <descriptionHyperlinks> <ThingDef>BionicHeart</ThingDef> <HediffDef>BionicHeart</HediffDef> </descriptionHyperlinks> <jobString>Installing bionic heart.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicHeart</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicHeart</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Heart</li> </appliedOnFixedBodyParts> <addsHediff>BionicHeart</addsHediff> </RecipeDef> <!-- Bionic stomach --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicStomach</defName> <label>bionic stomach</label> <labelNoun>a bionic stomach</labelNoun> <description>An installed bionic stomach. A person with this has a much lower chance of getting food poisoning, and is immune to some stomach diseases. An integrated lattice-dust healing system automatically repairs any damage to the artificial organ. It is better than a biological stomach in almost every way.</description> <descriptionHyperlinks><ThingDef>BionicStomach</ThingDef></descriptionHyperlinks> <spawnThingOnRemoved>BionicStomach</spawnThingOnRemoved> <stages> <li> <makeImmuneTo> <li>GutWorms</li> </makeImmuneTo> <foodPoisoningChanceFactor>0.5</foodPoisoningChanceFactor> </li> </stages> <addedPartProps> <solid>true</solid> <partEfficiency>1.25</partEfficiency> <betterThanNatural>true</betterThanNatural> </addedPartProps> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicStomach</defName> <label>bionic stomach</label> <description>An advanced artificial stomach with sensors and chemical synthesizers that efficiently digest nearly any energy-bearing foodstuff. A person with this has a much lower chance of getting food poisoning, and is immune to some stomach diseases. An integrated lattice-dust healing system automatically repairs any damage to the artificial organ. It is better than a biological stomach in almost every way.</description> <descriptionHyperlinks><RecipeDef>InstallBionicStomach</RecipeDef></descriptionHyperlinks> <costList> <Plasteel>10</Plasteel> <ComponentSpacer>3</ComponentSpacer> </costList> <statBases> <Mass>2</Mass> </statBases> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicStomach</defName> <label>install bionic stomach</label> <description>Install a bionic stomach.</description> <descriptionHyperlinks> <ThingDef>BionicStomach</ThingDef> <HediffDef>BionicStomach</HediffDef> </descriptionHyperlinks> <jobString>Installing bionic stomach.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicStomach</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicStomach</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Stomach</li> </appliedOnFixedBodyParts> <addsHediff>BionicStomach</addsHediff> </RecipeDef> <HediffDef ParentName="ImplantHediffBase"> <defName>DeathAcidifier</defName> <label>death acidifier</label> <labelNoun>a death acidifier</labelNoun> <description>An installed death acidifier. Upon the user's death, it releases powerful chemicals that dissolve gear in contact with the user's body. It doesn't damage others.</description> <descriptionHyperlinks><ThingDef>DeathAcidifier</ThingDef></descriptionHyperlinks> <spawnThingOnRemoved>DeathAcidifier</spawnThingOnRemoved> <comps> <li Class="HediffCompProperties_DissolveGearOnDeath"> <fleck>AcidCloud</fleck> <moteCount>6</moteCount> <moteOffsetRange>0.25~0.75</moteOffsetRange> <filth>Filth_Slime</filth> <sound>DeathAcidifier</sound> <injuryCreatedOnDeath>ChemicalBurn</injuryCreatedOnDeath> <injuryCount>3~6</injuryCount> </li> </comps> </HediffDef> <ThingDef ParentName="BodyPartBase"> <defName>DeathAcidifier</defName> <label>death acidifier</label> <description>A chest implant for preventing enemy use of captured equipment. Upon the user's death, it releases powerful chemicals that dissolve gear in contact with the user's body. It doesn't damage others.</description> <descriptionHyperlinks><RecipeDef>InstallDeathAcidifier</RecipeDef></descriptionHyperlinks> <techLevel>Spacer</techLevel> <graphicData> <texPath>Things/Item/Health/HealthItem</texPath> <graphicClass>Graphic_Single</graphicClass> <drawSize>0.80</drawSize> <color>(189,169,118)</color> </graphicData> <statBases> <MarketValue>400</MarketValue> </statBases> <thingCategories> <li>BodyPartsBionic</li> </thingCategories> </ThingDef> <RecipeDef ParentName="SurgeryInstallImplantBase"> <defName>InstallDeathAcidifier</defName> <label>install death acidifier</label> <description>Install a death acidifier.</description> <descriptionHyperlinks> <ThingDef>DeathAcidifier</ThingDef> <HediffDef>DeathAcidifier</HediffDef> </descriptionHyperlinks> <jobString>Installing death acidifier.</jobString> <ingredients> <li> <filter> <thingDefs> <li>DeathAcidifier</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>DeathAcidifier</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Torso</li> </appliedOnFixedBodyParts> <addsHediff>DeathAcidifier</addsHediff> </RecipeDef> <FleckDef ParentName="FleckBase"> <defName>AcidCloud</defName> <graphicData> <texPath>Things/Mote/Smoke</texPath> <color>(0.56, 1, 0.03)</color> <drawSize>(2.5,2.5)</drawSize> </graphicData> <altitudeLayer>MoteOverhead</altitudeLayer> <fadeInTime>0.50</fadeInTime> <solidTime>3</solidTime> <fadeOutTime>3</fadeOutTime> <growthRate>0.025</growthRate> </FleckDef> <SoundDef> <defName>DeathAcidifier</defName> <maxSimultaneous>1</maxSimultaneous> <priorityMode>PrioritizeNearest</priorityMode> <context>MapOnly</context> <subSounds> <li> <grains> <li Class="AudioGrain_Folder"> <clipFolderPath>Misc/DeathAcidifier</clipFolderPath> </li> </grains> <volumeRange>40.384~40.384</volumeRange> </li> </subSounds> </SoundDef> <!-- Bionic ear --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicEar</defName> <label>bionic ear</label> <labelNoun>a bionic ear</labelNoun> <description>An installed bionic ear. A collection of invisible subdermal microphones capture sound and transmit it to a biogel nerve interface that links directly with the auditory nerve. It's sensitive enough to hear a cat before you see it, can't be damaged by loud noise, and automatically tunes itself to pick out meaningful sounds in noisy environments.</description> <descriptionHyperlinks><ThingDef>BionicEar</ThingDef></descriptionHyperlinks> <spawnThingOnRemoved>BionicEar</spawnThingOnRemoved> <addedPartProps> <solid>true</solid> <partEfficiency>1.25</partEfficiency> <betterThanNatural>true</betterThanNatural> </addedPartProps> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicEar</defName> <label>bionic ear</label> <description>An advanced artificial ear implant. A collection of invisible subdermal microphones capture sound and transmit it to a biogel nerve interface that links directly with the auditory nerve. It's sensitive enough to hear a cat before you see it, can't be damaged by loud noise, and automatically tunes itself to pick out meaningful sounds in noisy environments.</description> <descriptionHyperlinks><RecipeDef>InstallBionicEar</RecipeDef></descriptionHyperlinks> <costList> <Plasteel>10</Plasteel> <ComponentSpacer>3</ComponentSpacer> </costList> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicEar</defName> <label>install bionic ear</label> <description>Install a bionic ear.</description> <descriptionHyperlinks> <ThingDef>BionicEar</ThingDef> <HediffDef>BionicEar</HediffDef> </descriptionHyperlinks> <jobString>Installing bionic ear.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicEar</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicEar</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Ear</li> </appliedOnFixedBodyParts> <addsHediff>BionicEar</addsHediff> </RecipeDef> <!-- Bionic tongue --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicTongue</defName> <label>bionic tongue</label> <labelNoun>a bionic tongue</labelNoun> <description>An installed bionic tongue. Made of synthetic smooth-fibers and connected through a neurogel interface, it can match the performance of a natural tongue in speaking, eating, and tasting.</description> <descriptionHyperlinks><ThingDef>BionicTongue</ThingDef></descriptionHyperlinks> <spawnThingOnRemoved>BionicTongue</spawnThingOnRemoved> <addedPartProps> <solid>true</solid> <partEfficiency>1.0</partEfficiency> </addedPartProps> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicTongue</defName> <label>bionic tongue</label> <description>An artificial tongue replacement. Made of synthetic smooth-fibers and connected through a neurogel interface, it can match the performance of a natural tongue in speaking, eating, and tasting.</description> <descriptionHyperlinks><RecipeDef>InstallBionicTongue</RecipeDef></descriptionHyperlinks> <costList> <Plasteel>8</Plasteel> <ComponentSpacer>2</ComponentSpacer> </costList> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicTongue</defName> <label>install bionic tongue</label> <description>Install a bionic tongue.</description> <descriptionHyperlinks> <ThingDef>BionicTongue</ThingDef> <HediffDef>BionicTongue</HediffDef> </descriptionHyperlinks> <jobString>Installing bionic tongue.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicTongue</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicTongue</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Tongue</li> </appliedOnFixedBodyParts> <addsHediff>BionicTongue</addsHediff> </RecipeDef> <!-- Bionic Jaw --> <HediffDef ParentName="AddedBodyPartBase"> <defName>BionicJaw</defName> <label>bionic jaw</label> <labelNoun>a bionic jaw</labelNoun> <description>An installed bionic jaw. Made out of biosynthetic bone, with plasteel tooth replacements and a set of micro servomotors for the full range of motion.</description> <descriptionHyperlinks> <ThingDef>BionicJaw</ThingDef> </descriptionHyperlinks> <spawnThingOnRemoved>BionicJaw</spawnThingOnRemoved> <addedPartProps> <solid>true</solid> <partEfficiency>1.25</partEfficiency> <betterThanNatural>true</betterThanNatural> </addedPartProps> </HediffDef> <ThingDef ParentName="BodyPartBionicBase"> <defName>BionicJaw</defName> <label>bionic jaw</label> <description>An artificial jaw replacement. Made out of biosynthetic bone, with plasteel tooth replacements and a set of micro servomotors for the full range of motion.</description> <descriptionHyperlinks> <RecipeDef>InstallBionicJaw</RecipeDef> </descriptionHyperlinks> <costList> <Plasteel>10</Plasteel> <ComponentSpacer>3</ComponentSpacer> </costList> <statBases> <Mass>1.5</Mass> </statBases> </ThingDef> <RecipeDef ParentName="SurgeryInstallBodyPartArtificialBase"> <defName>InstallBionicJaw</defName> <label>Install bionic jaw</label> <description>Install bionic jaw.</description> <jobString>Installing bionic jaw.</jobString> <ingredients> <li> <filter> <thingDefs> <li>BionicJaw</li> </thingDefs> </filter> <count>1</count> </li> </ingredients> <fixedIngredientFilter> <thingDefs> <li>BionicJaw</li> </thingDefs> </fixedIngredientFilter> <appliedOnFixedBodyParts> <li>Jaw</li> </appliedOnFixedBodyParts> <addsHediff>BionicJaw</addsHediff> </RecipeDef> </Defs>逐行解释
07-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值