PatchOperationAdd - solaris0115/RimWorldModGuide GitHub Wiki

PatchOperationAdd

๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ์ž‘์—…์ž…๋‹ˆ๋‹ค. ์ง€์ •๋œ ๊ฒฝ๋กœ์— 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ํŒŒ์ผ์ด ์•„๋‹Œ ๋ชจ๋“  ์ •์˜๋ฅผ ํ•œ๋ฒˆ์— ์ฝ์–ด ๊ฐ ๊ฐœ์ฒด๋ฅผ ๋งŒ๋“ค๊ธฐ ๋•Œ๋ฌธ์— ์ถ”์ƒํ™”๋œ ์ƒ์œ„ ๋ฐ์ดํ„ฐ์— ๋…ธ๋“œ๊ฐ€ ์กด์žฌํ•˜๋Š”์ง€๋ฅผ ํ™•์ธํ•ด์•ผ ์˜ค๋ฅ˜๋ฅผ ํ”ผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ