Alpha 13 modders stuff

Started by skullywag, March 06, 2016, 03:55:58 AM

Previous topic - Next topic

Nasikabatrachus

Is it possible to add sounds to correlate with social interactions?

skullywag

Maybe, havent looked into it.

Added and updated a few more points in the OP.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Tynan

Quote from: Nasikabatrachus on March 19, 2016, 05:32:56 PM
Is it possible to add sounds to correlate with social interactions?
You could do it pretty easily with a custom InteractionWorker, I think.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

skullywag

#33
Have had a few hours testing, thought id flip over to mod stuff.

Just had a major explosion on loading a save on the latest build containing mods:

Load can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/BaseClass.cpp Line: 426)

Exception from asynchronous event: System.InvalidOperationException: SaveableFromNode exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for TurbinesStuffed.Building_WindTurbineStuffed ---> System.ArgumentException: Load can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

  at (wrapper managed-to-native) UnityEngine.Resources:Load (string,System.Type)

  at UnityEngine.Resources.Load[Texture2D] (System.String path) [0x00000] in C:\buildslave\unity\build\artifacts\StandalonePlayerGenerated\BaseClass.cs:708

  at Verse.ContentFinder`1[UnityEngine.Texture2D].Get (System.String itemPath, Boolean reportFailure) [0x00071] in C:\Dev\RimWorld\Assets\Scripts\Verse\Mods\ContentFinder.cs:29

  at Verse.MaterialPool.MatFrom (System.String texPath) [0x00018] in C:\Dev\RimWorld\Assets\Scripts\Verse\Resources\MaterialPool.cs:31

  at TurbinesStuffed.Building_WindTurbineStuffed..cctor () [0x00000] in <filename unknown>:0

  --- End of inner exception stack trace ---

  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)

  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00119] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:513

  --- End of inner exception stack trace ---

  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0012c] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:519

  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:528

  at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x001b8] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Activator.cs:338

  at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Activator.cs:268

  at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Activator.cs:263

  at Verse.ScribeExtractor.SaveableFromNode[Thing] (System.Xml.XmlNode subNode, System.Object[] ctorArgs) [0x000eb] in C:\Dev\RimWorld\Assets\Scripts\Verse\Map\SaveLoad\Scribe\ScribeExtractor.cs:94
Subnode:
<thing Class="TurbinesStuffed.Building_WindTurbineStuffed"><def>WindTurbine</def><id>WindTurbine55156</id><pos>(137, 0, 149)</pos><health>150</health><stuff>Steel</stuff><faction>Faction_9</faction><parentThing>null</parentThing><updateCounter>22</updateCounter><cachedPowerOutput>541.5908</cachedPowerOutput></thing>

  at Verse.ScribeExtractor.SaveableFromNode[Thing] (System.Xml.XmlNode subNode, System.Object[] ctorArgs) [0x0017c] in C:\Dev\RimWorld\Assets\Scripts\Verse\Map\SaveLoad\Scribe\ScribeExtractor.cs:120

  at Verse.Scribe_Collections.LookList[Thing] (System.Collections.Generic.List`1& list, Boolean saveDestroyedThings, System.String label, LookMode lookMode, System.Object[] ctorArgs) [0x0037d] in C:\Dev\RimWorld\Assets\Scripts\Verse\Map\SaveLoad\Scribe\Scribe_Collections.cs:132

  at Verse.Scribe_Collections.LookList[Thing] (System.Collections.Generic.List`1& list, System.String label, LookMode lookMode, System.Object[] ctorArgs) [0x00000] in C:\Dev\RimWorld\Assets\Scripts\Verse\Map\SaveLoad\Scribe\Scribe_Collections.cs:13

  at Verse.MapIniter_LoadFromFile.InitMapFromFile (System.String fileName) [0x00138] in C:\Dev\RimWorld\Assets\Scripts\Verse\Map\MapIniter\MapIniter_LoadFromFile.cs:67

  at Verse.RootMap.<Init>m__4FF () [0x00000] in C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\RootMap.cs:27

  at Verse.LongEventHandler.RunEventFromAnotherThread (System.Action action) [0x00006] in C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:287


Not sure whats happening here, ill debug some more, but a pointer would be appreciated.

So the mod with the issue seems to be the windturbines mod, the core turbine class has "[StaticConstructorOnStartup]" at the start of its class. Do i need to do some trickery here if im extending this class?
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

skullywag

#34
Added another one i spotted when playing with map components.

Also added the [StaticConstructorOnStartup] stuff.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

skullywag

Also can we move this to the public testers forum, so we can gain more feedback about the modding based changes.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

skullywag

Added Pawn_HealthTracker changes.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

skullywag

Can we get this in the mods sub forum plz
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

NoImageAvailable

Moved this to the Help forum and stickied.
"The power of friendship destroyed the jellyfish."

mrofa

#39
C# code:
Comps props got choped to separate class, there is no longer "One to rule them all"
Old
var affectedComp = affectedDef.GetCompProperties(typeof(CompFacility));

New
var affectedComp = affectedDef.GetCompProperties<CompProperties_Facilities>();

Glower comp is broken cant get/set its status, if on/off unless its within vanilia preset rules, so check the comp checks before and/or wait for ccl
Good days of Snake like googels are gone, now you need switches for glowing...
All i do is clutter all around.

Rikiki

I found how to refresh ComGlower! :)
Just add these two lines to force glower update:
Find.MapDrawer.MapMeshDirty(this.Position, MapMeshFlag.Things);
Find.GlowGrid.MarkGlowGridDirty(this.Position);


To switch it on or off, you might try to set its radius to 0 before a refresh?
this.GetComp<CompGlower>().Props.glowRadius = 0;

skullywag

Glowers have an updateglow method that does the above, you dont need to call that stuff anymore it does it for you.

The issue of the on/off not sure.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Rikiki

I know but this does not work for 'dynamic' glowers (like in my alert speaker mod).

skullywag

Ah i see. I feel we are going to need a compGlowerX again lol
Just when we thought custom glow comps were no longer needed.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

RemingtonRyder

Something I noticed with abstracts is that even within the same file, the <selectable> tag does not propagate down properly.

In other words, if building foo has an abstract parent B and B has an abstract parent A, and A has the <selectable>true</selectable> tag but B does not, then building foo will not be selectable.

Not sure if that's a limitation or a bug, but I thought I should make you aware of it!