[MODDING HELP] Looking to give Implant Hediffs weapon properties

Started by PM_ME_NAKED_SINGULARITIES, December 11, 2018, 09:51:11 PM

Previous topic - Next topic

PM_ME_NAKED_SINGULARITIES

Hi! I am very new to modding rimworld, and in general, but I figured you have to start somewhere right? Anyway I have been doing a lot of tweaking around with other mods to try and deduce as much as possible. My main goal is to create a class I can use in a HeDiff definition of a implant to give a pawn access to special melee properties found in another mod. I'm very new to Object Oriented Programing (OOP), and especially OOP in C# but I am definitely willing to learn as I go. So I just want to apologize ahead of time If i ask a lot of basic questions.

The main error Im getting right now looks like this:
Exception loading list from XML: System.InvalidCastException: Cannot cast from source type to destination type.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_castclass (object,intptr)
  at Verse.DirectXmlToObject.ObjectFromXml[HediffCompProperties] (System.Xml.XmlNode xmlRoot, Boolean doPostLoad) [0x00000] in <filename unknown>:0
  at Verse.DirectXmlToObject.ListFromXml[HediffCompProperties] (System.Xml.XmlNode listRootNode) [0x00000] in <filename unknown>:0
Verse.Log:Error(String, Boolean)
Verse.DirectXmlToObject:ListFromXml(XmlNode)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
Verse.DirectXmlToObject:ObjectFromXml(XmlNode, Boolean)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
Verse.DirectXmlToObject:ObjectFromXml(XmlNode, Boolean)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
Verse.DirectXmlLoader:DefFromNode(XmlNode, LoadableXmlAsset)
Verse.LoadedModManager:ParseAndProcessXML(XmlDocument, Dictionary`2)
Verse.LoadedModManager:LoadAllActiveMods()
Verse.PlayDataLoader:DoPlayLoad()
Verse.PlayDataLoader:LoadAllPlayData(Boolean)
Verse.Root:<Start>m__1()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__1()



From what little I can gleam, it seems like the class that is being called in the implant HeDifff was originally intended for use with a thingdef type object, and only from a particular mod at that. So getting the communication between the two separate directories is key, and any changes I'd have to make in order for the class properties to be apply to a HeDiff as well. Those are the two biggest blockers that I'm stuck on that i know of :o. Any advice or help is greatly appreciated!