[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



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 for enhanced darkness.
Flare mortars by me 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 for creating the original code (and textures?) as part of an obsolete version of his Turret Collection 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:

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
"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
   - 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
   - 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
   - Added automated spotlight
Version 1.0
   - Initial release

Screenshots:
Version 2.0

Version 1.2 (size of spotlights changed, not size of light radius!)

Version 1.1

Master Bucketsmith

#1
To-Do:
- Fix the manned version

eskoONE


Sarelth

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?

Master Bucketsmith

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.

Master Bucketsmith

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!

JT

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.

Master Bucketsmith

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?

JT

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. ;-)

Sylph

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?

Master Bucketsmith

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? :)

Master Bucketsmith

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

Master Bucketsmith

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

Master Bucketsmith

#13
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

MoatBordered

#14
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