[MOD] Shields!

Started by Darker, March 25, 2014, 09:06:53 PM

Previous topic - Next topic

Darker

So, because some aspects of the game (metal and energy being main resources) reminded me of Supreme Commander and it's ancestor Total Annihilation, I couldn't resist adding forcefield shields to the game. Here they come:

Shields
Shields prevent any projectiles from getting through from the outside.

Behaviour
Once the shield is connected to power, it will need 17 seconds to prepare before deploying the shield field.
When the warm-up is over, the shield gains 100 shield power and continues charging up to 1000 points.
When hit, the shield will re-charge just as fast as it charged when it went first online. If the shield field is destroyed, the shield will automatically start the warm-up phase again.

Power consumption
The requirements are following:





Warm-up1000 W/d
Charge the field2750 W/d
Hold the field1820 W/d
Build costs
The shields does only require 80 metal, however, you'll need 500 silver to assemble the complicated electronics inside. And it takes long to build.



500
80
0
Silver

Screenshots
All images can be seen here.




Test with turrets
Last stand
It's magic proof!
... except for lightings.

Planned features


  • Create nicer shield field visualisation
  • Change ShieldField class into ThingComp implementation to allow easy use
  • Better graphics. (Yes, the shield building IS modified blasting charge)
  • Research project for the shield.
  • ...? There was more, but I can't recall anything


Download - Alpha 4 update by Haplo
Alpha 3 version

Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

ItchyFlea

I like. I like a lot. Works as advertised, preventing shots from entering, yet allowing shots to be fired out, as well as blocking shots that are targeting something outside the shield on the other side of it.

They also seem fairly well balanced, not posing as something overpowered. At least not from the brief test I just gave them. 4 raiders were enough to drain 3 fully charged shields in a lengthy battle.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Rokiyo

Agreed, this is really cool.

I especially like the particle effects, and how the power requirements vary depending on the state of the shield.

Tynan

This is awesome! Would you be okay if I included it with the main release?
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Tynan

#4
Oh, another thing. Don't call ExposeData yourself. Instead of this


          base.ExposeData();
            if(shield==null)
              shield = new ShieldField(base.Position);
            shield.ExposeData();
            //Scribe_Values.LookValue<int>(ref this.heat, "turretHeat", 0, false);


You should do this:


Scribe_Deep.LookDeep( ref shield, "shield" );


It will handle nulls for you.

You're also using two separate namespaces. Might get confusing.

And this isn't the right way to do enums:


        //Status constants
        //Disabled and offline
        public const int DISABLED = 2;
        //Warming up
        public const int LOADING = 4;
        //Online and gathering power
        public const int CHARGING = 8;
        //Charged and sustaining
        public const int SUSTAINING = 16;


Instead, just make a normal enum the C# way.


public enum ShieldStatus
{
Disabled,
Loading,
Charging,
Sustaining,
}

...

if( status == ShieldStatus.Sustaining )
DoSomething();

Tynan Sylvester - @TynanSylvester - Tynan's Blog

Darker

Thanks for the notes to my code, I appreciate this a lot!

As of the scribes, I was IlSpying like hell but I couldn't find how to do this nice trick, thanks :)

One thing I didn't change are those two namespaces. I'm planning to use these random helper functions I create in my own library for my personal use, independend on plug-in.
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Darker

Quote from: TynanWould you be okay if I included it with the main release?
Of course. All my mods are distrubuted under the I don't care license. Including, modifying code, raping the code... Everything is allowed.
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Tynan

Thanks.

I should start asking people to ship mods with licenses. If you could include a creative commons license in the About folder that'd be good. Choose one here: http://creativecommons.org/choose/

If you include one that allows it I'll probably ship with this mod as an example. I hope you'll clean up those little code issues; others will be looking to your work as an example.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Darker

I'm not sure what am I expected to license... :D

The image? The HTML they generate?
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Tynan

You attach a license to the mod, including all the code and content. This license says how people are allowed to use your work (which you automatically own exclusive copyright over by default).
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Darker

I updated the code, added license and fixed some glitches.
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Evul

I am impressed! this is cool!

Forecaster

It'd be neat if the AI would attempt to cut the power to the generator they are trying to assault!

Also, does the shield use energy when it is hit or is there just the flat drain of keeping it up?

Darker

QuoteAlso, does the shield use energy when it is hit or is there just the flat drain of keeping it up?
Yes, the shield will drain more if it's reduced down from 100% power. However, there is no penalty for the hit itself - if 50% shield is hit, the power requirements will remain the same.
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

a89a89

Can you please update this for alpha 3!