Ludeon Forums

RimWorld => Releases => Mods => Outdated => Topic started by: Master Bucketsmith on August 14, 2016, 12:04:08 PM

Title: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: Master Bucketsmith on August 14, 2016, 12:04:08 PM
(http://i.imgur.com/qHo7EzR.png)

Download link: https://www.dropbox.com/s/ivethxtiwfa5i9l/A15%20MBS%20Spotlights%20v2.0.7z?dl=1
Steam Workshop link: http://steamcommunity.com/sharedfiles/filedetails/?id=744745312

All new version! Neatly follows target now!

Description:
Adds an automated spotlight that lights the target area up in a small radius.
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.
It's got a range of 50 tiles, slightly further than any handheld weapon.
Uses the same clunky AI a vanilla improvised turret has.

Auto Spotlight:
Power draw: 50W standby, 550W active
Research requirement: Electricity, GunTurrets
Cost to make: 70 stuff, 80 steel, 2 components

Recommended:
Realistic Darkness by Willowisp (https://ludeon.com/forums/index.php?topic=23244.0) for enhanced darkness.
Flare mortars by me (https://ludeon.com/forums/index.php?topic=24463) for longer range light support. (Not updated yet!)

Compatibility:
Should have no compatibility issues with savegames and other mods.

Current issues:
- Manual version not functional yet.

Credits:
- Ludeon Studios for the game and assets on which this mod is based
- eatKenny (https://ludeon.com/forums/index.php?action=profile;u=13374) for creating the original code (and textures?) as part of an obsolete version of his Turret Collection (https://ludeon.com/forums/index.php?topic=6895.0) mod
- Thanks go out to Dieter, GHXX, skullywag, Rikiki, dubwise and others for their code submissions and feedback! (Sorry if I missed your name!)

Short version of license:
(https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png) (http://creativecommons.org/licenses/by-nc-sa/4.0/)
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. (http://creativecommons.org/licenses/by-nc-sa/4.0/)
"You can do nearly everything you want, but must credit the original author and redistribute it under the same license."
I'd totally wanna know what you made and how my work might have helped you! ;D

Changelog:
Version 2.0 (https://www.dropbox.com/s/ivethxtiwfa5i9l/A15%20MBS%20Spotlights%20v2.0.7z?dl=1)
   - Removed CCL dependancy & 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
Version 1.2 (https://www.dropbox.com/s/5et26wzj8o6klov/A14%20Spotlight%20v1.2.7z?dl=0)
   - Added UI Icon so it shows the spotlight in the architect bar instead of just the base (wtf vanilla RimWorld)
   - Added the display radius for range once installed (not just during placement)
   - Removed "Spotlight On" sound until I can find a better solution
   - Reduced size of spotlights to 1x1
   - Reduced hit on beauty
   - Increased duration of light effect and cooldown of spotlight to 5 seconds
   - Changed cost to just steel - no more stuff
   - Changed passability of the invisible building that spawns the light radius to be standable (instead of pass through only)
   - Spotlights can now be placed under roofs (and thus in buildings)
   - Spotlights no longer explode when critically damaged
   - Spotlights now no longer fire overhead like mortars, but require line-of-sight like improvised turrets
   - Auto spotlight now also requires Gun Turrets research
Version 1.1 (https://www.dropbox.com/s/zfmvlf73m6rtolu/A14%20Spotlight%20v1.1.7z?dl=0)
   - Added automated spotlight
Version 1.0 (https://www.dropbox.com/s/xcqfyqn3k1qr1jy/A14%20Spotlight%20v1.0.7z?dl=0)
   - Initial release

Screenshots:
Version 2.0
(http://i.imgur.com/G3SNeP6.jpg) (http://i.imgur.com/G3SNeP6.jpg)
Version 1.2 (size of spotlights changed, not size of light radius!)
(http://i.imgur.com/BPa4zhN.jpg) (http://i.imgur.com/BPa4zhN.jpg)
Version 1.1
(http://i.imgur.com/nHewITI.jpg) (http://i.imgur.com/nHewITI.jpg)(http://i.imgur.com/txllC9C.jpg) (http://i.imgur.com/txllC9C.jpg)(http://i.imgur.com/5pBjarT.jpg) (http://i.imgur.com/5pBjarT.jpg)
Title: Re: [WIP][A14] Spotlight - light those raiders up in the wilderness!
Post by: Master Bucketsmith on August 14, 2016, 12:04:15 PM
To-Do:
- Fix the manned version
Title: Re: [WIP][A14] Spotlight - light those raiders up in the wilderness!
Post by: eskoONE on August 14, 2016, 02:09:51 PM
cant wait for the screenshots :)
Title: Re: [WIP][A14] Spotlight - light those raiders up in the wilderness!
Post by: Sarelth on August 14, 2016, 07:14:57 PM
This is almost a must have for the Realistic Darkness mod. I hope you can figure out how to get the light to follow the target.

Would setting the light time to the same as the Aim/fire time work, so the light is replaced every time the Spotlight fires?
Title: Re: [WIP][A14] Spotlight - light those raiders up in the wilderness!
Post by: Master Bucketsmith on August 15, 2016, 07:59:30 AM
Quote from: Sarelth on August 14, 2016, 07:14:57 PM
This is almost a must have for the Realistic Darkness mod. I hope you can figure out how to get the light to follow the target.

Would setting the light time to the same as the Aim/fire time work, so the light is replaced every time the Spotlight fires?
That is exactly how it works now.
It stays for 40 seconds and the cooldown on the 'weapon' of the spotlight is the same, so it fires a new one the moment the old one dies.
But it doesn't follow a target, it just spawns an invisible glower building on the tile the targetting is pointing at, at the time.

I could make it so it fires every second and the light gets replaced every second, but you'd also hear the sound of it going on every single time.
Plus, I think that'd be a performance hog.

I've seen the code to Rikiki's Mining Helmet, and I've seen some things in CCL. I know it is possible to get code together that would have a lightsource follow the target, I just lack the C# experience to put it together.
Title: Re: [WIP][A14] Spotlight v1.0 - light those raiders up in the wilderness!
Post by: Master Bucketsmith on August 15, 2016, 09:29:52 AM
I've released v1.0 - the simple update of the old version of this mod.
Have fun with it and don't shy away from giving me feedback!
Title: Re: [WIP][A14] Spotlight v1.0 - light those raiders up in the wilderness!
Post by: JT on August 15, 2016, 11:27:29 AM
Could I suggest that the spotlight itself also get a (much smaller) glow when it activates?  One of the disadvantages of spotlights in the real world is that once the enemy recovers from the sudden dazing effect of being subjected to intense light, they act as big "SHOOT HERE" signs. =)

Actually one of the most major reasons militaries tend to use artillery flares and tripflares instead... which would also be a pretty sweet mod, come to think of it.
Title: Re: [WIP][A14] Spotlight v1.0 - light those raiders up in the wilderness!
Post by: Master Bucketsmith on August 15, 2016, 11:31:35 AM
Quote from: JT on August 15, 2016, 11:27:29 AM
Could I suggest that the spotlight itself also get a (much smaller) glow when it activates?  One of the disadvantages of spotlights in the real world is that once the enemy recovers from the sudden dazing effect of being subjected to intense light, they act as big "SHOOT HERE" signs. =)

Actually one of the most major reasons militaries tend to use artillery flares and tripflares instead... which would also be a pretty sweet mod, come to think of it.
Didn't think of that. I'll see to adding a glow to the spotlight.
Ideally I'd like for it to have a cone shaped lightbeam coming out of it. But as long as the game only handles radius(circles), I don't think I can even begin to make that a reality.

I'll have a look around if there already are mods about flares. Tripflares are tripwires set up to flares, I presume?
Title: Re: [WIP][A14] Spotlight v1.0 - light those raiders up in the wilderness!
Post by: JT on August 15, 2016, 11:54:44 AM
Quote from: Bucketsmith on August 15, 2016, 11:31:35 AM
Ideally I'd like for it to have a cone shaped lightbeam coming out of it. But as long as the game only handles radius(circles), I don't think I can even begin to make that a reality.

I'll have a look around if there already are mods about flares. Tripflares are tripwires set up to flares, I presume?

Depending on sophistication, they come in various varieties.  The simplest is just a garden variety flare attached to a tripwire, so when the tripwire is hit the flare lights up the ground where it is staked in.  More sophisticated versions fire multiple pyrotechnics in the air like a common firework, although this is mostly a dazzling effect rather than a long-term light source.  The most sophisticated ones act like bounding mines that physically launch a parachute flare into the air, which lasts for a minute or so. =)

In game terms, the ground flares would probably have a much smaller radius (~3-5 tiles) but also a long duration -- 1/2 day or so -- whereas the launched flares would have a massive radius (~12-16 tiles, just long enough that a shooter can stand outside the illuminated radius under conventional ranges) but also a short duration -- 1-2 hours or so.  Since there's no functional altitude in the game, it would be simple enough to split the difference as a single type of flare -- say, a radius of 8 tiles and a burn time of 4-6 hours.

This is all hypothetical: I'm not demanding you make it. ;-)
Title: Re: [A14] Spotlight v1.0 - light those raiders up in the wilderness!
Post by: Sylph on August 16, 2016, 06:07:30 AM
Great idea for a mod. A necessity when playing with realistic darkness I think.

Following on from the mention of flares, how about parachute mortar flares? And a flare gun?
Title: Re: [A14] Spotlight v1.0 - light those raiders up in the wilderness!
Post by: Master Bucketsmith on August 16, 2016, 06:27:44 AM
I'm afraid adding a glow to the base spotlight once it's turned on is proving impossible for me.
It requires C# work and I can't figure it out. So unless someone with knowledge of C# wants to help out, I can't get that done.
The glow property is set to a building in such a way it just permanently goes on if it has the property.
CCL has code to make it toggleable, but again, that's C# and I have no idea how to implement it. :(

I've already made an automated version of the spotlight though, that was easy. Someone requested it somewhere.

I've also made the simple flare mortar, I'm in the process of finalizing that one.
Not that great of an artist so the shell is just a recoloured vanilla projectile shell. Which are quite ugly, btw.
The game doesn't allow for anything to 'hover in the air', so it's actually just a temporary structure that gets spawned. But I hope the illusion works. :)
I'm thinking it's handiest if the flare stuff get their own mod so people can pick and choose what they want from my stock, so to say. Don't you think? :)
Title: Re: [A14] Spotlights v1.1 - light those raiders up in the wilderness!
Post by: Master Bucketsmith on August 16, 2016, 10:02:20 AM
Updated to version 1.1. I've added a fully automated version of the spotlight, double the construction price.
Draws 50W when on standby and 550W when it's 'firing'.

Side-note; anyone who sneakishly grabbed v1.1 since it first went up and the time of this post should redownload it.
There were a few odd minor bugs that I had to fix but I've released it under the same version, since it was like.. what.. 10 minutes? :P
Title: Re: [A14] Spotlights v1.1 - light those raiders up!
Post by: Master Bucketsmith on August 16, 2016, 02:07:40 PM
I've finished the flare mortar. https://ludeon.com/forums/index.php?topic=24463
I'll upload screens and add download links later on, time for a break. ;D :P
Title: Re: [A14] Spotlights v1.1 - light those raiders up!
Post by: Master Bucketsmith on August 21, 2016, 12:39:17 PM
Pretty big update to this mod! :D
I made a bunch of smaller and larger changes.
Still not any closer to having the light neatly follow the target, though.

Version 1.2
   - Added UI Icon so it shows the spotlight in the architect bar instead of just the base (wtf vanilla RimWorld)
   - Added the display radius for range once installed (not just during placement)
   - Removed "Spotlight On" sound until I can find a better solution
   - Reduced size of spotlights to 1x1
   - Reduced hit on beauty
   - Increased duration of light effect and cooldown of spotlight to 5 seconds
   - Changed cost to just steel - no more stuff
   - Changed passability of the invisible building that spawns the light radius to be standable (instead of pass through only)
   - Spotlights can now be placed under roofs (and thus in buildings)
   - Spotlights no longer explode when critically damaged
   - Spotlights now no longer fire overhead like mortars, but require line-of-sight like improvised turrets
   - Auto spotlight now also requires Gun Turrets research
Title: Re: [A14] Spotlights v1.1 - light those raiders up!
Post by: 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  (https://ludeon.com/forums/index.php?topic=14711.0) 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
Title: Re: [A14] Spotlights v1.1 - light those raiders up!
Post by: Master Bucketsmith on August 22, 2016, 03:23:02 AM
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  (https://ludeon.com/forums/index.php?topic=14711.0) 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.
Title: Re: [A14] Spotlights v1.2 - light those raiders up!
Post by: Dave-In-Texas on August 22, 2016, 08:13:42 AM
keep it up, this is shaping up to be a great mod, well they both sound great
Title: Re: [A15] Spotlights v2.0 - light those foes up!
Post by: Master Bucketsmith on September 07, 2016, 03:33:16 PM
HUGE new A15 & v2.0 update!

Version 2.0 (https://www.dropbox.com/s/ivethxtiwfa5i9l/A15%20MBS%20Spotlights%20v2.0.7z?dl=1)
   - 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.
Title: Re: [A15] Spotlights v2.0 - light those foes up!
Post by: 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.
Title: Re: [A15] Spotlights v2.0 - light those foes up!
Post by: Master Bucketsmith on September 07, 2016, 03:51:05 PM
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...
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: 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.
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: Master Bucketsmith on September 08, 2016, 09:02:01 AM
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?
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: 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.
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: Master Bucketsmith on September 15, 2016, 06:14:22 AM
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!
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: crazybmanp on January 09, 2017, 03:15:46 PM
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.
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: 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
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: faltonico on January 12, 2017, 12:40:24 AM
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.
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: Arigitine on January 12, 2017, 02:50:46 AM
It is updated
http://steamcommunity.com/sharedfiles/filedetails/?id=744745312 (http://steamcommunity.com/sharedfiles/filedetails/?id=744745312)
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: MaxP on February 11, 2017, 11:15:21 AM
Doesn't work with A16, just consuming resources for build.
Title: Re: [A15] MBS Spotlights v2.0 - light those foes up! (07-09-2016)
Post by: kPherox on February 28, 2017, 01:48:54 AM
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 (https://github.com/kPherox/MBSSpotlights)

Download page:
MBS Spotlights v2.0 for A16 (https://github.com/kPherox/MBSSpotlights/releases/tag/v2.0)
MBS Spotlights v3.0 for A17 (https://github.com/kPherox/MBSSpotlights/releases/tag/v3.0)