Using one sprite for a rotatable object gives a error

Started by Stolij, September 20, 2016, 04:33:07 AM

Previous topic - Next topic

Stolij

could someone help me with this error?

Exception in UIRootUpdate: System.NullReferenceException: Object reference not set to an instance of an object at
RimWorld.CompFacility.DrawLinesToPotentialThingsToLinkTo iVerse.ThingDef myDef.IntVec3 myPos.Rot4 myRot) [0x00000] in <filename unknown>:0


Any help is appreciated.

Master Bucketsmith

Oof, without context, I'm not able to pitch in much.
What are you modifying?

A building like a vitals monitor?

Stolij

Quote from: Master Bucketsmith on September 20, 2016, 09:27:57 AM
Oof, without context, I'm not able to pitch in much.
What are you modifying?

A building like a vitals monitor?
Well its for a production table

Master Bucketsmith

All right. Could you paste the thingDef in codetags?

Stolij

well this is what i have:
(looks a bit wierd here)
<?xml version="1.0" encoding="utf-8" ?>

<ThingDefs>

<ThingDef ParentName="BuildingBase">
<defName>PowerCellCreator</defName>
<label>Power Cell Creator Table</label>
<ThingClass>Building_WorkTable</ThingClass>
<Description>A High tech table to create Transcendent Power Cells.</Description>
<graphicData>
<texPath>Things/Building/Production/PowerCellProduction/PowerCellProductionTable</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(3,1)</drawSize>
      <damageData>
        <cornerTL>Damage/Corner</cornerTL>
        <cornerTR>Damage/Corner</cornerTR>
        <cornerBL>Damage/Corner</cornerBL>
        <cornerBR>Damage/Corner</cornerBR>
      </damageData>
</graphicData>
<CostList>
<Steel>500</Steel>
            <Component>10</Component>
            <SpecificComponents>10</SpecificComponents>
            <Gold>5</Gold>
            <Plasteel>20</Plasteel>
        </CostList>
<AltitudeLayer>Building</AltitudeLayer>
<fillPercent>0.5</fillPercent>
<useHitPoints>True</useHitPoints>
<statBases>
<WorkToMake>7000</WorkToMake>
<MaxHitPoints>600</MaxHitPoints>
<Flammability>1.0</Flammability>
</statBases>
<Size>(3,1)</Size>
<DesignationCategory>Production</DesignationCategory>
  <passability>PassThroughOnly</passability>
<pathCost>70</pathCost>
<hasInteractionCell>True</hasInteractionCell>
<interactionCellOffset>(0,0,-1)</interactionCellOffset>
<surfaceType>Item</surfaceType>
<recipes>
<li>CreateTranscendentPowerCell</li>
</recipes>
<inspectorTabs>
<li>ITab_Bills</li>
</inspectorTabs>
<building>
<spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
</building>
        <comps> 
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <startElectricalFires>true</startElectricalFires>
        <shortCircuitInRain>true</shortCircuitInRain>
        <basePowerConsumption>2000</basePowerConsumption>
      </li>
      <li Class="CompProperties_Flickable"/>
        </comps>
    <researchPrerequisites>
    <li>TranscendentPowerStorage</li>
    <li>MicroelectronicsBasics</li>
    </researchPrerequisites>
    <placeWorkers>
<li>PlaceWorker_ShowFacilitiesConnections</li>
</placeWorkers>
</ThingDef>


</ThingDefs>

Master Bucketsmith

#5
Quote from: Stolij on September 20, 2016, 11:55:03 AM
well this is what i have:
(looks a bit wierd here)
<?xml version="1.0" encoding="utf-8" ?>

<ThingDefs>

<ThingDef ParentName="BuildingBase">
<defName>PowerCellCreator</defName>
<label>Power Cell Creator Table</label>
<ThingClass>Building_WorkTable</ThingClass>
<Description>A High tech table to create Transcendent Power Cells.</Description>
<graphicData>
<texPath>Things/Building/Production/PowerCellProduction/PowerCellProductionTable</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(3,1)</drawSize>
      <damageData>
        <cornerTL>Damage/Corner</cornerTL>
        <cornerTR>Damage/Corner</cornerTR>
        <cornerBL>Damage/Corner</cornerBL>
        <cornerBR>Damage/Corner</cornerBR>
      </damageData>
</graphicData>
<CostList>
<Steel>500</Steel>
            <Component>10</Component>
            <SpecificComponents>10</SpecificComponents>
            <Gold>5</Gold>
            <Plasteel>20</Plasteel>
        </CostList>
<AltitudeLayer>Building</AltitudeLayer>
<fillPercent>0.5</fillPercent>
<useHitPoints>True</useHitPoints>
<statBases>
<WorkToMake>7000</WorkToMake>
<MaxHitPoints>600</MaxHitPoints>
<Flammability>1.0</Flammability>
</statBases>
<Size>(3,1)</Size>
<DesignationCategory>Production</DesignationCategory>
  <passability>PassThroughOnly</passability>
<pathCost>70</pathCost>
<hasInteractionCell>True</hasInteractionCell>
<interactionCellOffset>(0,0,-1)</interactionCellOffset>
<surfaceType>Item</surfaceType>
<recipes>
<li>CreateTranscendentPowerCell</li>
</recipes>
<inspectorTabs>
<li>ITab_Bills</li>
</inspectorTabs>
<building>
<spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
</building>
        <comps> 
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <startElectricalFires>true</startElectricalFires>
        <shortCircuitInRain>true</shortCircuitInRain>
        <basePowerConsumption>2000</basePowerConsumption>
      </li>
      <li Class="CompProperties_Flickable"/>
        </comps>
    <researchPrerequisites>
    <li>TranscendentPowerStorage</li>
    <li>MicroelectronicsBasics</li>
    </researchPrerequisites>
    <placeWorkers>
<li>PlaceWorker_ShowFacilitiesConnections</li>
</placeWorkers>
</ThingDef>


</ThingDefs>


Hah. It does look a bit weird - I thought you forgot </graphicData> at first, but it was further down.

Okay, so I take it you have  a folder called Textures in your modfoler?
And within that folder lies; Things/Building/Production/PowerCellProduction/PowerCellProductionTable.PNG?

P.S.: For it to have <rotatable>true</rotatable> it SHOULD be Graphic_Single.
Otherwise, it would be Graphic_Multi and you would have a texture for front, back and side all named correctly. Can't have <rotatable>true</rotatable> for Graphic_Multi, I believe.

P.P.S.: Do you have the ThingDef BuildingBase copied anywhere within your mod? If you have parents, you need to have those defined within the scope of your mod. (And only once!)

Stolij

Quote from: Master Bucketsmith on September 20, 2016, 12:01:13 PM

Hah. It does look a bit weird - I thought you forgot </graphicData> at first, but it was further down.

Okay, so I take it you have  a folder called Textures in your modfolder?
And within that folder lies; Things/Building/Production/PowerCellProduction/PowerCellProductionTable.PNG?
thats correct, but it gives the exception in the first post when i try to place the production table (it does place if i turn off debug log auto-open) also the texture does show

Stolij

Is it actually possible to make a rotatable object from one picture?

Master Bucketsmith

#8
Quote from: Stolij on September 20, 2016, 12:13:49 PM
Is it actually possible to make a rotatable object from one picture?
Yeah, I've had no problem with that.
Where do you add the rotatable tags?

P.S.:
You have:
<placeWorkers>
<li>PlaceWorker_ShowFacilitiesConnections</li>
</placeWorkers>

But you don't have this in your comps:
      <li Class="CompProperties_AffectedByFacilities">
        <linkableFacilities>
          <li>ToolCabinet</li>
        </linkableFacilities>
      </li>


Perhaps that's causing an issue?

Stolij

First i tried in <graphicData> then it said there was no such function as "<rotatable>"
Then i tried it in the <ThingDef ParentName="Buildingbase"> and it didnt give a error, but once i tried to build the table it gave the same error as before.

Master Bucketsmith

Quote from: Stolij on September 20, 2016, 12:19:48 PM
First i tried in <graphicData> then it said there was no such function as "<rotatable>"
Then i tried it in the <ThingDef ParentName="Buildingbase"> and it didnt give a error, but once i tried to build the table it gave the same error as before.
Yeah it goes anywhere under the ThingDef tags, but not inside other tags.

Anyways, try removing the placeworker lines. You can comment them out for testing.
It's looking for linked facility buildings when the comps say there is no such property to your workbench.

Unless you want it to be affected by other buildings, in which case you have to add the second snippet I posted before and change ToolCabinet to the defname of the special structure you want it to link to.

Stolij

Quote from: Master Bucketsmith on September 20, 2016, 12:25:26 PM
Quote from: Stolij on September 20, 2016, 12:19:48 PM
First i tried in <graphicData> then it said there was no such function as "<rotatable>"
Then i tried it in the <ThingDef ParentName="Buildingbase"> and it didnt give a error, but once i tried to build the table it gave the same error as before.
Yeah it goes anywhere under the ThingDef tags, but not inside other tags.

Anyways, try removing the placeworker lines. You can comment them out for testing.
It's looking for linked facility buildings when the comps say there is no such property to your workbench.

Unless you want it to be affected by other buildings, in which case you have to add the second snippet I posted before and change ToolCabinet to the defname of the special structure you want it to link to.
removing the linked facility buildings (which were none) helped, now it does not give the error anymore, Thanks!

Master Bucketsmith

Nice, grats!
Haha, all that trouble we went through and it was such a simple thing. :)