Ludeon Forums

Ludeon Forums

  • August 17, 2022, 07:28:10 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 8

Author Topic: [MOD] Shields!  (Read 52371 times)

Darker

  • Colonist
  • ***
  • Posts: 378
  • I'm Jack's twisted mind
    • View Profile
    • Rim world editor
[MOD] Shields!
« on: March 25, 2014, 09:06:53 PM »

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

« Last Edit: June 04, 2014, 10:53:14 AM by Darker »
Logged
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

ItchyFlea

  • Who's a good kitty?
  • Administrator
  • Planetologist
  • *****
  • Posts: 1921
  • Psychotic Squirrel
    • View Profile
Re: [MOD] Shields!
« Reply #1 on: March 26, 2014, 01:51:42 AM »

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.
Logged
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

  • Colonist
  • ***
  • Posts: 162
    • View Profile
Re: [MOD] Shields!
« Reply #2 on: March 26, 2014, 08:02:04 AM »

Agreed, this is really cool.

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

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 12484
    • View Profile
    • Tynan's Blog
Re: [MOD] Shields!
« Reply #3 on: March 26, 2014, 12:59:23 PM »

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

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 12484
    • View Profile
    • Tynan's Blog
Re: [MOD] Shields!
« Reply #4 on: March 26, 2014, 01:01:49 PM »

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

Code: [Select]
          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:

Code: [Select]
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:

Code: [Select]
        //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.

Code: [Select]
public enum ShieldStatus
{
Disabled,
Loading,
Charging,
Sustaining,
}

...

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

« Last Edit: March 26, 2014, 01:04:19 PM by Tynan »
Logged
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Darker

  • Colonist
  • ***
  • Posts: 378
  • I'm Jack's twisted mind
    • View Profile
    • Rim world editor
Re: [MOD] Shields!
« Reply #5 on: March 26, 2014, 05:29:40 PM »

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.
Logged
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Darker

  • Colonist
  • ***
  • Posts: 378
  • I'm Jack's twisted mind
    • View Profile
    • Rim world editor
Re: [MOD] Shields!
« Reply #6 on: March 26, 2014, 07:36:05 PM »

Quote from: Tynan
Would 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.
Logged
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 12484
    • View Profile
    • Tynan's Blog
Re: [MOD] Shields!
« Reply #7 on: March 26, 2014, 07:47:54 PM »

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.
Logged
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Darker

  • Colonist
  • ***
  • Posts: 378
  • I'm Jack's twisted mind
    • View Profile
    • Rim world editor
Re: [MOD] Shields!
« Reply #8 on: March 26, 2014, 07:58:56 PM »

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

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

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 12484
    • View Profile
    • Tynan's Blog
Re: [MOD] Shields!
« Reply #9 on: March 26, 2014, 08:14:14 PM »

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).
Logged
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Darker

  • Colonist
  • ***
  • Posts: 378
  • I'm Jack's twisted mind
    • View Profile
    • Rim world editor
Re: [MOD] Shields!
« Reply #10 on: April 01, 2014, 12:13:22 PM »

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

Evul

  • Moderator
  • Planetologist
  • ***
  • Posts: 1656
  • Quality Assurance
    • View Profile
    • Evul Development
Re: [MOD] Shields!
« Reply #11 on: April 01, 2014, 01:24:54 PM »

I am impressed! this is cool!

Forecaster

  • Drifter
  • **
  • Posts: 23
    • View Profile
    • Tower of Awesome
Re: [MOD] Shields!
« Reply #12 on: April 02, 2014, 05:33:00 PM »

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?
Logged

Darker

  • Colonist
  • ***
  • Posts: 378
  • I'm Jack's twisted mind
    • View Profile
    • Rim world editor
Re: [MOD] Shields!
« Reply #13 on: April 03, 2014, 06:25:56 AM »

Quote
Also, 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.
Logged
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

a89a89

  • Colonist
  • ***
  • Posts: 226
  • Tri-sexual helicopter
    • View Profile
Re: [MOD] Shields!
« Reply #14 on: May 09, 2014, 05:25:54 PM »

Can you please update this for alpha 3!
Logged
Pages: [1] 2 3 ... 8