(Solved) Problems with minifying turrets

Started by RemingtonRyder, April 28, 2015, 01:19:32 PM

Previous topic - Next topic

RemingtonRyder

I decided to try making turrets minifiable to see if it was possible.

Alas, I get an error:

GetInspectString exception on Steel_Turret_Kit208928:
System.NullReferenceException: Object reference not set to an instance of an object

  at RimWorld.Building_TurretGun.GetInspectString () [0x00000] in <filename unknown>:0

  at RimWorld.MinifiedThing.GetInspectString () [0x00000] in <filename unknown>:0

  at RimWorld.InspectPaneFiller.DrawInspectStringFor (Selectable t, System.Single& y) [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)


I also get this text in the inspector box when I click on the minified turret when it is fresh off the smithing table, but NOT after installing the turret, then uninstalling it, then I get an inspector box which looks like the one for the turret.

I also get a more serious bug if I upgrade the minified turret on the smithing bench and then try to install that.

Here's the mod in drop box: https://www.dropbox.com/s/hi71o89zocm93mo/HotCold_Minification.zip?dl=0

Thanks in advance if you can help!

BBream

#1
I think it has problem.
1) Minified thing call Building_TurretGun.GetInspectString
2) Building_TurretGun find this.gun info but it is not spawned in world! ERROR!
Because gun is made when it is spawned.

I don't have easy solution without dll code.

It is good idea. I'll make some dll code for it if you want.

Edit1: I thought it is easy but it is little complicated.
Edit2: I have no idea for avoiding error. MinifiedThing cannot be changed because MinifyUtility use only MinifiedThing class. I try to change it but it is failed. And if I change Building_TurretGun then it will be not work.

Edit3: It can be fixed by adding dummy comp.
1) Add dummy comp that initialize turret gun.
2) Then it will not print error message.

Yes!, I did it. Here. It will work and not print error message. When it is upgraded, same error message is printed. So it is solved.

[attachment deleted due to age]

BBream

#2
Wow! it is really good. It can be put in backpack.
I should add code for it.

And I want sleeping bed kit for camper!

RemingtonRyder

Cool. And thanks! I never thought about adding beds. :)