Really stuck on New Worktable type for Mod...no recipes show!

Started by white_altar, March 12, 2017, 09:05:59 PM

Previous topic - Next topic

white_altar

I have a really annoying repeating error when all else seems ok.  The C# builds nicely, the defs are tidy, and I just don't know what's wrong. :'(  From reading the posts I see that I could be using the wrong class, but isn't that the point of defining my own thingclass with the C# assembly?

--- Main thread ---
160ms Loading assets of type UnityEngine.AudioClip for mod MusicJoy
- 57ms Loading file Bach
- 13ms Loading file Bartok
- 18ms Loading file Beethoven
- 21ms Loading file Chopin
- 21ms Loading file Rachmaninov
- 27ms Loading file Rossini


(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

--- Main thread ---
7ms Loading assets of type UnityEngine.Texture2D for mod MusicJoy


(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Could not load UnityEngine.AudioClip at Sounds/Beethoven in any active mod or in base resources.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Grain couldn't resolve: Clip not found at Sounds/Beethoven

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Could not load UnityEngine.AudioClip at Sounds/Rossini in any active mod or in base resources.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Grain couldn't resolve: Clip not found at Sounds/Rossini

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

--- Main thread ---
888ms Load backstories.


(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

--- Main thread ---
1ms Inject selected language data into game data.


(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Could not load reference to Verse.ThingDef named Gun_ak74_cwm

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Could not load reference to Verse.ThingDef named Gun_coltmustang_cwm

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Unloading 5 Unused Serialized files (Serialized files now loaded: 0)

Unloading 22 unused Assets to reduce memory usage. Loaded Objects now: 6792.
Total: 44.802021 ms (FindLiveObjects: 0.241662 ms CreateObjectMapping: 0.243710 ms MarkObjects: 44.274227 ms  DeleteObjects: 0.042129 ms)

Unloading 3 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 0.343476 ms

Unloading 34 unused Assets to reduce memory usage. Loaded Objects now: 6810.
Total: 44.038414 ms (FindLiveObjects: 0.220012 ms CreateObjectMapping: 0.246928 ms MarkObjects: 43.522030 ms  DeleteObjects: 0.049151 ms)

Initializing new game with mods Core and MusicJoy

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Unloading 0 Unused Serialized files (Serialized files now loaded: 0)

Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 12943.
Total: 101.008102 ms (FindLiveObjects: 0.454360 ms CreateObjectMapping: 0.613517 ms MarkObjects: 99.908043 ms  DeleteObjects: 0.031890 ms)

Exception filling tab RimWorld.ITab_Bills: System.InvalidCastException: Cannot cast from source type to destination type.
  at RimWorld.ITab_Bills.get_SelTable () [0x00000] in <filename unknown>:0
  at RimWorld.ITab_Bills.FillTab () [0x00000] in <filename unknown>:0
  at Verse.InspectTabBase+<DoTabGUI>c__AnonStorey3C6.<>m__566 () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)


Code is at: https://github.com/gustable/MusicJoy/

RawCode

protected Building_WorkTable SelTable
{
get
{
return (Building_WorkTable)base.SelThing;
}
}


    public class Building_MusicPlayer : Building, IBillGiver, IBillGiverWithTickAction

fix inheritance

white_altar

So you would use code similar to what you posted, or exactly as? ...(please forgive my lack of knowledge) I'm understanding the issue I think, but not clear on how to implement.

Should I extend the ITab_Bills class into the Building_MusicPlayer class def?  Or perhaps I should do something else?

RawCode


white_altar

I'm sorry, @RawCode, but I'm not understanding you.  I'm not trying to use the Building_Worktable class.  I'm writing another new class, "Building_MusicPlayer".  Your response is initially helpful, but now the single word answers are not helping much.  Can you elucidate?

RawCode

what exactly you do not understand?

you must inherit from Building_WorkTable

skullywag

As Rawcode states, where you have building replace it with building_worktable. The stuff the right of your classname is the stuff you are inheriting into this class. Your class isnt deemed a worktable by the rest of the core code until it inherits it.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

white_altar

So maybe I was a little grandiose in trying to write a whole new BillTab using class.  Hmm.  I will think on this.  The Building_Worktable class doesn't sem to like my setup.  I will rewrite and try to get it to work.  Thanks.

On the side of creativity, Any idea what Transferrable does?