Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: [0.9.1a] Transparent planetary shield v1.1  (Read 4937 times)

Mondaymonkey

  • Admiral
  • *****
  • Posts: 777
    • View Profile
[0.9.1a] Transparent planetary shield v1.1
« on: March 11, 2020, 10:17:33 AM »


Inspired by Stormy Fairweather and his great idea.

I was messing around with a textures and suddenly realize, I can share it with a someone who might need it. Should be working as an ordinary game mod. I am not a modder, so if someone can frame this idea better - you have my blessing.


ZIP contains separate folders for each shield color (red, green, blue, etc). Just place your choice to the "mods" folder and activate it with the launcher menu. You can install all the folders, but you've better not activate them at a same time. We all will DIE! Was not tested.

Changes
V1.1b - added rainbow version by DarkOmegaMK2
V1.1a - some sober bugfixes.
V1.1 - Industry icons added. Added clear, pink and yellow colors.
V1.0 - Initial drunken release.
[close]
« Last Edit: March 15, 2020, 10:47:47 PM by Mondaymonkey »
Logged
I dislike human beings... or I just do not know how to cook them well.

e

  • Captain
  • ****
  • Posts: 288
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #1 on: March 12, 2020, 06:41:44 PM »

Make a rainbow shield. :)
Logged

e

  • Captain
  • ****
  • Posts: 288
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #2 on: March 12, 2020, 07:14:05 PM »

e
« Last Edit: October 06, 2020, 10:33:34 AM by DarkOmegaMK2 »
Logged

Cyber Von Cyberus

  • Commander
  • ***
  • Posts: 212
  • Warcrimes are very profitable...
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #3 on: March 13, 2020, 05:53:38 AM »

Thank you, that's very useful.
Logged
Diktat Admiral:"What do we have here ? A dissident ? A pirate ? Or maybe a degenerate ?"

Me:"Yes, I'm all of those."

Mondaymonkey

  • Admiral
  • *****
  • Posts: 777
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #4 on: March 13, 2020, 09:03:09 AM »

Can't start the game with the RED version, as it displays a very weird error message that crashes the game as it loads.

That is correct. I was drunk and messing with code. Nothing useful is a result. Then I forgot to delete some code from a red version. Sorry. Currently fixed. You can just delete "industries.csv" or re-download.

Quote
Make a rainbow shield.

Will do. Horizontal or vertical? In fact, it should be diagonal. Diagonal-spherical.
Spoiler
[close]
Logged
I dislike human beings... or I just do not know how to cook them well.

e

  • Captain
  • ****
  • Posts: 288
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #5 on: March 13, 2020, 09:46:59 AM »

Quote
Make a rainbow shield.

Will do. Horizontal or vertical? In fact, it should be diagonal. Diagonal-spherical.
Spoiler
[close]

Yes, that should be fine. Pony and all.
Logged

Mondaymonkey

  • Admiral
  • *****
  • Posts: 777
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #6 on: March 15, 2020, 10:49:47 PM »



Rainbow shield by DarkOmegaMK2 added.
Logged
I dislike human beings... or I just do not know how to cook them well.

Alluvian

  • Lieutenant
  • **
  • Posts: 53
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #7 on: March 16, 2020, 05:11:05 AM »

Very interesting mod! I do have one suggestion at this time.

How about adding a (non industry) buildable option at the colony, that depends upon the presence of the Red Shield (original) version; when present a list of alternative color options are available. When one of those is built, it replaces the original (and then precludes the others from showing up).

You would need some code like this to remove the original shield:
Code
    protected void buildingFinished() {
        super.buildingFinished();
        this.market.removeIndustry("PLANETARYSHIELD", (MarketAPI.MarketInteractionMode)null, false);
    }

The new 'Industries' would just need to be copies (variations) of the original PLANETARYSHIELD, save with a different link to the color option.

You could then add entries to a custom settings.json:
Code
"industry":{
"shield_texture_pink":"graphics/planets/planetary_shield_pink.png",
"shield_texture_blue":"graphics/planets/planetary_shield_blue.png",
}

And then you would need the industry itself (copy pasta from the original, region of interest shown below):
Code
public class PlanetaryShield_Blue extends BaseIndustry {
[stuff]

# changes go here, otherwise would be the same as class PlanetaryShield
   public static void applyVisuals(PlanetAPI planet) {
      if (planet != null) {
         planet.getSpec().setShieldTexture(Global.getSettings().getSpriteName("industry", "shield_texture_blue")); # blue version
         planet.getSpec().setShieldThickness(0.1F);
         planet.getSpec().setShieldColor(new Color(255, 255, 255, 175));
         planet.applySpecChanges();
      }
   }

« Last Edit: March 16, 2020, 05:20:39 AM by Alluvian »
Logged

Mondaymonkey

  • Admiral
  • *****
  • Posts: 777
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #8 on: March 16, 2020, 05:33:41 AM »

Spoiler
Code
    protected void buildingFinished() {
        super.buildingFinished();
        this.market.removeIndustry("PLANETARYSHIELD", (MarketAPI.MarketInteractionMode)null, false);
    }

The new 'Industries' would just need to be copies (variations) of the original PLANETARYSHIELD, save with a different link to the color option.

You could then add entries to a custom settings.json:
Code
"industry":{
"shield_texture_pink":"graphics/planets/planetary_shield_pink.png",
"shield_texture_blue":"graphics/planets/planetary_shield_blue.png",
}

And then you would need the industry itself (example):
Code
public class PlanetaryShield_Blue extends BaseIndustry {
[stuff]

# changes go here, otherwise would be the same as class PlanetaryShield
   public static void applyVisuals(PlanetAPI planet) {
      if (planet != null) {
         planet.getSpec().setShieldTexture(Global.getSettings().getSpriteName("industry", "shield_texture_blue")); # blue version
         planet.getSpec().setShieldThickness(0.1F);
         planet.getSpec().setShieldColor(new Color(255, 255, 255, 175));
         planet.applySpecChanges();
      }
   }

[close]



I was thinking about it. And about changing "red planet quest". And about adjusted by player color/transparency. And different texture variant. And planetary phase field...

But my programming skills located at [-0;+0] interval.

Sorry, I cannot do any of you propose. But if you can - that would be great. The only reason that thread exist - I was thinking it is unwise replacing original game files, so create this. And if someone can do it in a correct way - thread shall be deleted.
Logged
I dislike human beings... or I just do not know how to cook them well.

e

  • Captain
  • ****
  • Posts: 288
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #9 on: March 16, 2020, 01:43:38 PM »

How about adding a (non industry) buildable option at the colony, that depends upon the presence of the Red Shield (original) version

I'm gonna stop you right here!

It's not a good idea to clutter the colony menu with more things to build, as per your suggestion, it would take 2 slots to get a blue planetary shield, that's complete madness.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #10 on: March 16, 2020, 02:09:48 PM »

How about adding a (non industry) buildable option at the colony, that depends upon the presence of the Red Shield (original) version

I'm gonna stop you right here!

It's not a good idea to clutter the colony menu with more things to build, as per your suggestion, it would take 2 slots to get a blue planetary shield, that's complete madness.

What I would do is make a meta-option for the planetary shield like orbital station has. Then you can pick any of the colors when you build it.

Not sure how I'd set up changing the color of an existing shield. Can always demo and rebuild, though.
Logged

Alluvian

  • Lieutenant
  • **
  • Posts: 53
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #11 on: March 16, 2020, 02:26:36 PM »

I'm gonna stop you right here!

It's not a good idea to clutter the colony menu with more things to build, as per your suggestion, it would take 2 slots to get a blue planetary shield, that's complete madness.

As shown in my prior post, it can be coded to replace the shield using "removeIndustry"; thus only taking one slot.
Logged

e

  • Captain
  • ****
  • Posts: 288
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #12 on: March 16, 2020, 10:38:36 PM »

I'm gonna stop you right here!

It's not a good idea to clutter the colony menu with more things to build, as per your suggestion, it would take 2 slots to get a blue planetary shield, that's complete madness.

As shown in my prior post, it can be coded to replace the shield using "removeIndustry"; thus only taking one slot.

Alright, just making sure.
Logged

Üstad

  • Commander
  • ***
  • Posts: 131
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #13 on: June 04, 2020, 11:30:46 AM »

Is it possible to make shields don't affect the planets appearance? Like as if they don't exist from outside?
Logged

Mondaymonkey

  • Admiral
  • *****
  • Posts: 777
    • View Profile
Re: [0.9.1a] Transparent planetary shield v1.1
« Reply #14 on: June 04, 2020, 12:05:29 PM »

Is it possible to make shields don't affect the planets appearance? Like as if they don't exist from outside?

Well... Yes. All you need is a full transparent image. One of a half-transparent variants from here is "clear", it is almost invisible. Try it.

If it does not fit you demands, replace a texture file with this:
Spoiler
[close]

It might looks like black/white/grey, but it is invisible. Do not forget to name it "planetary_shield.png".
Logged
I dislike human beings... or I just do not know how to cook them well.