[A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)

Started by Master Bucketsmith, August 14, 2016, 12:04:08 PM

Previous topic - Next topic

Master Bucketsmith

Quote from: MoatBordered on August 22, 2016, 02:58:09 AM
Sweet.. pretty useful and balanced. No more rushing to build torches right before raider attacks.

Speaking of glowers neatly following targets, have you checked out this mining helmet mod? I specifically remember using this back in A12, and I recall the effect looking pretty nice. Concept seems same-ish with the quick glower spawning. Not sure about the code efficiency though, but maybe it can help. Good luck! 8)

EDIT: woops. did some backreading.. looks like you already know. my bad.  :o
Yes, I already tried McGuyvering the code together (with permission) but being an absolute scrub at C# I didn't get it working yet.
I'm still planning on getting that in somehow, 'cause I'm fairly sure it should work and would look a lot more neat. Also make the entire thing work better on a code level.

Dave-In-Texas

keep it up, this is shaping up to be a great mod, well they both sound great

Master Bucketsmith

#17
HUGE new A15 & v2.0 update!

Version 2.0
   - Removed CCL dependency & features
   - Completely changed the backend code to this mod (almost) from scratch
   - Spotlights now follow their target as long as it is valid
   - Added glow effect around spotlight itself once light is on
   - Removed UI icon, reverted back to vanilla style
   - Added back in sound effect for when the light goes on
   - Added new custom texture
   - Reverted cost to now include stuff cost again (also includes option to build a wooden base!)
   - Code-wise, turret no longer fires - just targets at something
   - Cleaned up the XML files

After a lot of work, I present version 2.0 of my Spotlights mod! Not just an update to A15, I've basically rewritten the entire thing.
I've added a metric shitton of C# code which is the start of my C# modding attempts! Some parts are inspired by other mods, some parts are supplied by others, some parts are my own work entirely. I consider this more to be a collaboration between some people than solely my mod! :)
The manual version was acting up when using the Force Target button in the UI, so I decided to release it without the manual version to show you guys the new functionality! :)

Please provide me some feedback! As much as I tested it, there might be situations that I simply didn't think of.

BaconBits

Wow, seems like a lot of work, but, I'm happy to see you got it updated.

Master Bucketsmith

Quote from: BaconBits on September 07, 2016, 03:45:44 PM
Wow, seems like a lot of work, but, I'm happy to see you got it updated.
That it was. It made me understand C# though! I tried sooooo many different things to get it to work! XD
In the end I put in some effort to copy the vanilla Building_TurretGun code and make an edited version of it that I could use.
Wasn't easy getting some important parts that weren't being decompiled correctly, but I got it there.
Now for that pesky manned version...

EldVarg

Cool idea. But you should raise the watt used to match vanilla lights. Yes LED takes less power, but then every light should have a LED version.

Master Bucketsmith

Quote from: EldVarg on September 08, 2016, 08:47:01 AM
Cool idea. But you should raise the watt used to match vanilla lights. Yes LED takes less power, but then every light should have a LED version.
They're supposed to draw 550W when active. It's a powerful focused beam of light that throws it over quite a long distance, it's power hungry.
The 50W is for the 'automated sensory system' that scans for targets and points the spotlight on them. Since that is always on, it always draws 50W minimal.
Vanilla lamps draw 150W.

So what are you saying? You want the spotlight to draw less or more power when active?

MoatBordered

#22
Ooh. Another CCL dependent mod that became stand-alone.

What part of CCL did it previously use? What'd you do so that it didn't need CCL anymore? I'm studying up on mods that grew out of it, and maybe help other mods with updating.

Short answers are fine, I think I still have a copy of your A14 version, so I can probably decompile that one and see the magic for myself.

Master Bucketsmith

Quote from: MoatBordered on September 15, 2016, 04:29:11 AM
Ooh. Another CCL dependent mod that became stand-alone.

What part of CCL did it previously use? What'd you do so that it didn't need CCL anymore? I'm studying up on mods that grew out of it, and maybe help other mods with updating.

Short answers are fine, I think I still have a copy of your A14 version, so I can probably decompile that one and see the magic for myself.
Yeah, I wasn't happy with how long it was taking CCL to get to A15. Nothing against CCL or the team behind it, of course! :)
It's just that, practically, for a dependency I didn't see it being worth it in the long run. Maybe it's a conjuncture of situations as to why it is taking long, I understand that.

It was actually only using the 'draw low power when idle'(or 'draw no power when off', depending on how you set it up) comp property for the automated version.
Over time, with the help of some people, I created custom C# code for the functionality of this mod. One of the last changes was the implementation of that power draw thing depending on the spotlight's state. Which apparently was rather easy. Not that I have anything to do in that part, GHXX solved that. :) (I feel I don't credit the people who helped out enough!)

Source files should be provided with my downloads. I hope I didn't forget that! If they're not there, you can let me know and I'll get them to you.
I'm trying to move over from Dropbox to Github. I've heard some awful news on Dropbox and on the other hand, I think Github would be great - but it's a bit of an 'information overload' thing for me to get into at the moment. Someone pointed me to use SourceTree. :)

Hope that answers your questions!

crazybmanp

i'm getting this error, followed by many others on loading ReflectionTypeLoadException getting types in assembly Spotlights2.0: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
  at Verse.ModAssemblyHandler.AssemblyIsUsable (System.Reflection.Assembly asm) [0x00000] in <filename unknown>:0

Loader exceptions:
   => System.TypeLoadException: Could not load type 'Spotlights.Building_TurretSpotlight' from assembly 'Spotlights2.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
   => System.TypeLoadException: Could not load type 'Spotlights.Building_Spotlight' from assembly 'Spotlights2.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
   => System.TypeLoadException: Could not load type 'Spotlights.Building_Spotlight' from assembly 'Spotlights2.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
   => System.TypeLoadException: Could not load type '<>c__DisplayClass36_0' from assembly 'Spotlights2.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
   => System.TypeLoadException: Could not load type '<GetGizmos>d__52' from assembly 'Spotlights2.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
   => System.TypeLoadException: Could not load type '<>c__DisplayClass33_0' from assembly 'Spotlights2.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
   => System.TypeLoadException: Could not load type '<GetGizmos>d__41' from assembly 'Spotlights2.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.

Verse.Log:Error(String)
Verse.ModAssemblyHandler:AssemblyIsUsable(Assembly)
Verse.ModAssemblyHandler:ReloadAll()
Verse.ModContentPack:ReloadAllContent()
Verse.LoadedModManager:LoadAllActiveMods()
Verse.PlayDataLoader:DoPlayLoad()
Verse.PlayDataLoader:LoadAllPlayData(Boolean)
Verse.Root:<Start>m__735()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__733()

However this may be also related to one of the other many mods i have installed.

Arigitine

I tested on a new install of game running only MBS Spotlights and got same errors

faltonico

Quote from: Arigitine on January 11, 2017, 06:21:56 PM
I tested on a new install of game running only MBS Spotlights and got same errors
This is not updated yet and:
Quote from: Master Bucketsmith on August 14, 2016, 12:04:08 PM
"When enemies come in range, the spotlight 'fires' and the target becomes lit, increasing the chance of hitting the target for your pawns and turrets."
No longer true as of A16.
Still, It would be cool to use with realistic darkness.


MaxP

Doesn't work with A16, just consuming resources for build.

kPherox

Fix System.Reflection.ReflectionTypeLoadException error.

This error is caused by inconsistency in .NET version. Since RimWorld is developed in .NET 2.0 - 3.5 it will be necessary to build with .NET 3.5
The following links will be those build with .NET 3.5.

GitHub:
https://github.com/kPherox/MBSSpotlights

Download page:
MBS Spotlights v2.0 for A16
MBS Spotlights v3.0 for A17