PatchOperationAdd - solaris0115/RimWorldModGuide GitHub Wiki
๋ฐ์ดํฐ๋ฅผ ์ถ๊ฐํ๋ ์์ ์ ๋๋ค. ์ง์ ๋ ๊ฒฝ๋ก์ Value์ ๋ด์ฉ์ ์ถ๊ฐํฉ๋๋ค.
์๋ฅผ ๋ค์ด ์ ๊ธฐ ๋๋ก๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ฐ๋ฃ๋ฅผ ๋จน์ง ์์ต๋๋ค.
ํ์ง๋ง ์ด๊ฒ์ด ์ ๊ธฐ์ ์ฐ๋ฃ ๋ชจ๋ ํ์ํ๋๋ก ๋ง๋๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ํจ์น ์์
์ ์ํํด์ผ ํฉ๋๋ค.
<ThingDef ParentName="BuildingBase">
<defName>Heater</defName>
<label>heater</label>
. . .
<comps>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>175</basePowerConsumption>
<shortCircuitInRain>true</shortCircuitInRain>
</li>
<!-- ์ด๊ณณ์ ์ฐ๋ฃ๋ฅผ ์๋ชจํ๋ ์ปดํฌ๋ํธ๋ฅผ ์ถ๊ฐํด์ผํฉ๋๋ค. -->
<li Class="CompProperties_Flickable"/>
<li Class="CompProperties_TempControl">
<energyPerSecond>21</energyPerSecond>
</li>
<li Class="CompProperties_Glower">
<glowRadius>3</glowRadius>
<glowColor>(255,150,100,0)</glowColor>
</li>
<li Class="CompProperties_Breakdownable"/>
</comps>
</ThingDef>
<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="Heater"]/comps</xpath>
<value>
<li Class="CompProperties_Refuelable">
<fuelConsumptionRate>10.0</fuelConsumptionRate>
<fuelCapacity>20.0</fuelCapacity>
<fuelConsumptionPerTickInRain>0.0006</fuelConsumptionPerTickInRain>
<fuelFilter>
<thingDefs>
<li>WoodLog</li>
</thingDefs>
</fuelFilter>
</li>
</value>
</Operation>
<ThingDef ParentName="BuildingBase">
<defName>Heater</defName>
<label>heater</label>
. . .
<comps>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>175</basePowerConsumption>
<shortCircuitInRain>true</shortCircuitInRain>
</li>
<li Class="CompProperties_Flickable"/>
<li Class="CompProperties_TempControl">
<energyPerSecond>21</energyPerSecond>
</li>
<li Class="CompProperties_Glower">
<glowRadius>3</glowRadius>
<glowColor>(255,150,100,0)</glowColor>
</li>
<li Class="CompProperties_Breakdownable"/>
<li Class="CompProperties_Refuelable">
<fuelConsumptionRate>10.0</fuelConsumptionRate>
<fuelCapacity>20.0</fuelCapacity>
<fuelConsumptionPerTickInRain>0.0006</fuelConsumptionPerTickInRain>
<fuelFilter>
<thingDefs>
<li>WoodLog</li>
</thingDefs>
</fuelFilter>
</li>
</comps>
</ThingDef>
PatchOperationAdd์ ์ ์ฉํ๊ธฐ ์ ์ ๋ชฉํ๋ก ํ๋ ๋ฐ์ดํฐ์ ๋ถ๋ชจ์ ์๋ ์ดํด๋ด์ผ ํฉ๋๋ค.
์๋ฅผ๋ค์ด ๋ฏธ๋๊ฑด์ด ์์๋๋ฉด ์ผ๋จ๋ก์ผ์ด๋ ์ถ์ ์ง์ฒ๋ผ ๋ช์ดํ ํญ๋ฐํ๋๋ก ๋ง๋๋ ค ํฉ๋๋ค.
<!-- ๋ฏธ๋๊ฑด ์ ์ comps๊ฐ ์๋ค. -->
<ThingDef ParentName="BaseHumanMakeableGun">
<defName>Gun_Minigun</defName>
<label>minigun</label>
...
<costList>
<Steel>160</Steel>
<ComponentIndustrial>20</ComponentIndustrial>
</costList>
...
</ThingDef>
<!-- ํญ๋ฐ ์ปดํฌ๋ํธ ๋ ์ค๋ฐ์ด,์ผ๋จ๋ก์ผ,์ถ์ ์ง ์ฐธ๊ณ -->
<comps>
<li Class="CompProperties_Explosive">
<explosiveRadius>2.66</explosiveRadius>
<explosiveDamageType>Bomb</explosiveDamageType>
<requiredDamageTypeToExplode>Flame</requiredDamageTypeToExplode>
</li>
</comps>
์๋์ ๊ฐ์ด ํจ์น๋ช ๋ น์ ๋ง๋ค์์ต๋๋ค.
<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="Gun_Minigun"]</xpath>
<value>
<comps>
<li Class="CompProperties_Explosive">
<explosiveRadius>2.66</explosiveRadius>
<explosiveDamageType>Bomb</explosiveDamageType>
<requiredDamageTypeToExplode>Flame</requiredDamageTypeToExplode>
</li>
</comps>
</value>
</Operation>
์์ ๊ฐ์ด ๋ช
๋ น์ ์คํํ๋ฉด ๋
ธ๋๊ฐ ์ค๋ณต๋์๋ค๊ณ ์ค๋ฅ๋ฅผ ์ถ๋ ฅํฉ๋๋ค.
์ด์ ๋ ๋ฏธ๋๊ฑด์ ๋ถ๋ชจ์ ์ํ์ผ์ธ BaseGunWithQuality์ ์ด๋ฏธ comps๊ฐ ์ ์ ๋์ด ์๊ธฐ ๋๋ฌธ์
๋๋ค.
<!-- baseWeapon.xml์ฐธ๊ณ -->
<ThingDef Name="BaseGunWithQuality" Abstract="True" ParentName="BaseGun">
<comps><!-- ์ด๋ฏธ ์ ์๋์ด ์๋ comps -->
<li>
<compClass>CompQuality</compClass>
</li>
</comps>
</ThingDef>
๋ฐ๋ผ์ ์ค๋ณต ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด์ ์๋์ ๊ฐ์ด ํจ์น๋ฅผ ๋ง๋ค์ด์ผํฉ๋๋ค.
<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="Gun_Minigun"]/comps</xpath>
<value>
<li Class="CompProperties_Explosive">
<explosiveRadius>2.66</explosiveRadius>
<explosiveDamageType>Bomb</explosiveDamageType>
<requiredDamageTypeToExplode>Flame</requiredDamageTypeToExplode>
</li>
</value>
</Operation>
Add๋ฟ๋ง ์๋๋ผ ๋ค๋ฅธ ํจ์น์์
๋ํ ๋ถ๋ชจ ์ ์๋ด์ฉ๊น์ง ํ์ธ์ ํด์ผํฉ๋๋ค.
ํจ์น ์์
์ ํ์ผ๋ก ์กด์ฌํ๋ XMLํ์ผ์ด ์๋ ๋ชจ๋ ์ ์๋ฅผ ํ๋ฒ์ ์ฝ์ด ๊ฐ ๊ฐ์ฒด๋ฅผ ๋ง๋ค๊ธฐ ๋๋ฌธ์ ์ถ์ํ๋ ์์ ๋ฐ์ดํฐ์ ๋
ธ๋๊ฐ ์กด์ฌํ๋์ง๋ฅผ ํ์ธํด์ผ ์ค๋ฅ๋ฅผ ํผํ ์ ์์ต๋๋ค.