Modified Version of DeepDrill advice?

Started by Kilroy232, September 20, 2016, 03:28:34 PM

Previous topic - Next topic

Kilroy232

So having had a good look the DeepDrill building doesn't have a thingClass tag in the XML code, it has <compClass>CompDeepDrill</compClass> and I am not quite sure how that difference effects the building.

I am looking to make a building similar to the DeepDrill where this new drill would not look for resources below the surface at all but instead would just constantly produce a new resource I am working on, oil. The new Drill would still track progress and spit out s produce after so much progress but instead of then looking for a new Resource Lump in would just skip that step and start on more of the infinite oil supply.

This leads to my question, should I just create a building that has a thing class that does what I want or should I continue using the compClass and modify that?

Haplo

I think both aproaches are still valid.
I've tried myself on the comp-stuff with my bees and have to say that it isn't that much different to the normal building stuff.
Some function names are slightly different, but if you have something to take as a base, it is rather easy to figure out.
In the end it is just personal preference and how much you want to use a template :)

Master Bucketsmith

Ooooooooooooh! :O

I like that idea, Kilroy. What's the oil going to be used for? :)

Also, this topic is relevant to something I'm working on.
I'm trying to build a custom power source, but it is connected to another building. I've been wrestling with where I should build the functionality of the power source, in a custom comp or in a custom building class.

If I understand Haplo's answer correctly, it doesn't matter? I think using a custom building class will be easier for me at this point!
Thanks!

Kilroy232

Quote from: Master Bucketsmith on September 21, 2016, 06:40:10 AM
Ooooooooooooh! :O

I like that idea, Kilroy. What's the oil going to be used for? :)

Actually I would love if you could tell me what you think but so far my plan is to make it so you can produce crude oil from mining drills and then refine it into petroleum and other products from crude oil like kerosene.
From there you can build gas powered generators which have significant benefits, kerosene lamps and some other things I am working on as well as sell the resources you have collected.
Right now I am working on getting the mining function and making the mining requirements and the oils value balanced

Kilroy232

Quote from: Haplo on September 21, 2016, 12:42:54 AM
I think both aproaches are still valid.
I've tried myself on the comp-stuff with my bees and have to say that it isn't that much different to the normal building stuff.
Some function names are slightly different, but if you have something to take as a base, it is rather easy to figure out.
In the end it is just personal preference and how much you want to use a template :)

Thats good to know, that means I don't have to start over or anything with the C# I have been working on. Does however mean I need to figure out just what it is I am doing :P (this is the first time I have taken C# coding this seriously)

Kilroy232

Just wanted to update but when I tried my code I got a few errors i wanted to share and possibly get some feedback on


Master Bucketsmith

Quote from: Kilroy232 on September 21, 2016, 07:04:08 PM
Actually I would love if you could tell me what you think but so far my plan is to make it so you can produce crude oil from mining drills and then refine it into petroleum and other products from crude oil like kerosene.
From there you can build gas powered generators which have significant benefits, kerosene lamps and some other things I am working on as well as sell the resources you have collected.
Right now I am working on getting the mining function and making the mining requirements and the oils value balanced
I noticed someone else was working on a similar concept. But like I wrote in a reply on that thread; Either way, don't stop working on stuff just because someone else is making a mod that has a similar goal!
Variety and alternatives are what keeps a modding community going! :D

Myself, I prefer things kept simple and have some 'artistic liberty/leeway' in how realistic the end result is. Just to keep it in the setting/theme RimWorld vanilla has. You know, electricity for example. :P
So, I personally don't like long production chains with multiple stages, unless the oil is a base resource and from there on the different resources made of it have their own use, maybe. :)
I would love to be able to build storage tanks and be able to trade in those resources though!

Quote from: Kilroy232 on September 21, 2016, 11:04:04 PM
Just wanted to update but when I tried my code I got a few errors i wanted to share and possibly get some feedback on


Looks like you made a mistake with setting the thingClass or the compClass in the XML file.
If you share the thingDef for this building I might be able to pick it out.

Kilroy232

Quote from: Master Bucketsmith on September 22, 2016, 07:36:34 AM
Myself, I prefer things kept simple and have some 'artistic liberty/leeway' in how realistic the end result is. Just to keep it in the setting/theme RimWorld vanilla has. You know, electricity for example. :P
So, I personally don't like long production chains with multiple stages, unless the oil is a base resource and from there on the different resources made of it have their own use, maybe. :)
I would love to be able to build storage tanks and be able to trade in those resources though!

Looks like you made a mistake with setting the thingClass or the compClass in the XML file.
If you share the thingDef for this building I might be able to pick it out.
Its actually good to get some feed back because I have been trying to decide whether I wanted to make it a long process (I love games like factorio) or more like I had original planned to make oil a useful resource from the beginning

Here is the xml code:

<ThingDef ParentName="BuildingBase">
    <defName>ManualOilDrill</defName>
    <label>manual oil drill</label>
    <description>A deep-crust drilling rig for extracting minerals from deep under the surface. Use a ground-penetrating scanner to detect the resources.</description>
    <size>(1,1)</size>
    <altitudeLayer>Building</altitudeLayer>
    <passability>PassThroughOnly</passability>
    <pathCost>70</pathCost>
    <fillPercent>0.5</fillPercent>
    <interactionCellOffset>(0,0,-1)</interactionCellOffset>
    <hasInteractionCell>true</hasInteractionCell>
    <designationCategory>Production</designationCategory>
    <designationHotKey>Misc12</designationHotKey>
    <specialDisplayRadius>1.5</specialDisplayRadius>
    <rotatable>true</rotatable>
    <costList>
      <Steel>100</Steel>
      <Component>3</Component>
    </costList>
    <placeWorkers>
      <li>PlaceWorker_ShowDeepResources</li>
    </placeWorkers>
    <drawPlaceWorkersWhileSelected>true</drawPlaceWorkersWhileSelected>
    <researchPrerequisites>
      <li>DeepDrilling</li>
    </researchPrerequisites>
    <statBases>
      <MaxHitPoints>140</MaxHitPoints>
      <WorkToMake>5000</WorkToMake>
      <Flammability>1.0</Flammability>
      <Beauty>-25</Beauty>
    </statBases>
    <comps>
      <li Class="CompProperties_Forbiddable"/>
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>250</basePowerConsumption>
        <startElectricalFires>true</startElectricalFires>
        <shortCircuitInRain>false</shortCircuitInRain>
      </li>
      <li>
        <compClass>DeepOilDrill</compClass> <!-- This is my custom compClass -->
      </li>
    </comps>
    <graphicData>
      <graphicClass>Graphic_Single</graphicClass>
      <texPath>Things/Building/Production/DeepDrill</texPath>
      <drawSize>(2,2)</drawSize>
      <drawRotated>false</drawRotated>
    </graphicData>
  </ThingDef>

Master Bucketsmith

Quote from: Kilroy232 on September 22, 2016, 08:45:07 AM
Its actually good to get some feed back because I have been trying to decide whether I wanted to make it a long process (I love games like factorio) or more like I had original planned to make oil a useful resource from the beginning

Here is the xml code:

<ThingDef ParentName="BuildingBase">
    <defName>ManualOilDrill</defName>
    <label>manual oil drill</label>
    <description>A deep-crust drilling rig for extracting minerals from deep under the surface. Use a ground-penetrating scanner to detect the resources.</description>
    <size>(1,1)</size>
    <altitudeLayer>Building</altitudeLayer>
    <passability>PassThroughOnly</passability>
    <pathCost>70</pathCost>
    <fillPercent>0.5</fillPercent>
    <interactionCellOffset>(0,0,-1)</interactionCellOffset>
    <hasInteractionCell>true</hasInteractionCell>
    <designationCategory>Production</designationCategory>
    <designationHotKey>Misc12</designationHotKey>
    <specialDisplayRadius>1.5</specialDisplayRadius>
    <rotatable>true</rotatable>
    <costList>
      <Steel>100</Steel>
      <Component>3</Component>
    </costList>
    <placeWorkers>
      <li>PlaceWorker_ShowDeepResources</li>
    </placeWorkers>
    <drawPlaceWorkersWhileSelected>true</drawPlaceWorkersWhileSelected>
    <researchPrerequisites>
      <li>DeepDrilling</li>
    </researchPrerequisites>
    <statBases>
      <MaxHitPoints>140</MaxHitPoints>
      <WorkToMake>5000</WorkToMake>
      <Flammability>1.0</Flammability>
      <Beauty>-25</Beauty>
    </statBases>
    <comps>
      <li Class="CompProperties_Forbiddable"/>
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>250</basePowerConsumption>
        <startElectricalFires>true</startElectricalFires>
        <shortCircuitInRain>false</shortCircuitInRain>
      </li>
      <li>
        <compClass>DeepOilDrill</compClass> <!-- This is my custom compClass -->
      </li>
    </comps>
    <graphicData>
      <graphicClass>Graphic_Single</graphicClass>
      <texPath>Things/Building/Production/DeepDrill</texPath>
      <drawSize>(2,2)</drawSize>
      <drawRotated>false</drawRotated>
    </graphicData>
  </ThingDef>

Ah don't get me wrong, although I've not played Factorio yet, I do like complexity and puzzling all that out.
But I want my game to adhere to a single.. by lack of a better word, theme throughout. RimWorld obviously takes a lot of that artistic liberty in how you handle things as a player, so for this game, I prefer to have mods that run along that same path.

As for your XML, as I suspected, you have forgotten the <thingClass> tag! :)
Making it <thingClass>Building</thingClass> should do the trick, I think.