Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: Tecrys on June 05, 2014, 04:13:17 AM

Title: Mount indicaters are drawn underneath decorative weapons
Post by: Tecrys on June 05, 2014, 04:13:17 AM
Hi Alex and David!

I don't know if this can be considered a bug but it seems that in refit the mount indicators (blue circle, yellow box, white reticule) are drawn underneath decorative weapons.

Now most people won't have problems with this but I do since I am hiding the ship sprite underneath a decorative weapon which equals the ship sprite to hide vanilla damage textures.
This makes it very hard to actually click on the weapon mounts and swap out weapons, one can hardly see the slots partly because I didn't make visual indicators on the sprite itself.

In my opinion the mount indicators should be on top of everything.

Added a screenshot to show what I mean:
Spoiler
(http://i.imgur.com/DbW5Jpn.png)
[close]
As soon as you hover over the mounts they get highlighted but on the left you can clearly see that the yellow box is underneath the decorative weapon.
PS: Sorry if this is the wrong subforum, I didn't really know where to post this.
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: Tartiflette on June 05, 2014, 05:43:04 AM
That's weird, I use a lot of decoratives and they are not drawn in the refit screen... But in their script I have a "render below all weapons" flag, so maybe that's why.
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: Tecrys on June 05, 2014, 06:16:48 AM
That's weird, I use a lot of decoratives and they are not drawn in the refit screen... But in their script I have a "render below all weapons" flag, so maybe that's why.

I do that as well depending on which "layer" the decorative needs to be but I guess the difference is that you don't use entire ship sprites as decoratives.
In the picture shown above you basically see two ships on top of each other, so to say.
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: xenoargh on June 05, 2014, 12:01:32 PM
While we're at it; the other major thing about Decoratives is that they'll show up in combat, too; the player can't do anything with them, but they're showing up in weapons groups. 

Unless I'm doing that wrong?
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: Alex on June 05, 2014, 12:15:22 PM
Re: OP - hmm, yeah. This isn't super easy to fix, let me think about it.

Unless I'm doing that wrong?

The slot type should be DECORATIVE.
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: xenoargh on June 05, 2014, 12:20:57 PM
Slot type is DECORATIVE.

Code
    {
      "angle": 135,
      "arc": 0,
      "id": "WS0006",
      "locations": [
        56,
        37
      ],
      "mount": "TURRET",
      "size": "SMALL",
      "type": "DECORATIVE"
    },

Still shows up in weapons groups in battles... unless I use the Auto button in the Weapon Groups editor.  Hmm.  Probably I can disable that "weapon" and remove it from all of the groups, though, via script, when it initializes.  I'll go look at that.
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: Alex on June 05, 2014, 12:24:51 PM
Well, yeah, if you have the decorative weapon assigned to a group in your .variant, it'll show up. Don't do that :)
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: xenoargh on June 05, 2014, 12:31:32 PM
Yeah, well, SFEd does that.  It won't allow weapons to not get assigned a Group.  I guess I can bug MendoncaTrylobot about that, since Decoratives are much more widely in use than they used to be.

I've gotten around this mainly by piling them into Group 5, so that it's not irksome.

I guess I could grep-comment them all out; then I gotta remember to do it again whenever I change anything with SFEd.  
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: Tecrys on June 05, 2014, 12:48:44 PM
What do you mean by SFEd?

When I build ships with Trylobots editor I simply put all decoratives into group 5 and afterwards open it with a simply text editor and remove the whole group, problem solved.

I don't quite understand why that wouldn't work for SFEd.

Thanks for looking into it, Alex!
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: xenoargh on June 05, 2014, 12:58:07 PM
Quote
When I build ships with Trylobots editor I simply put all decoratives into group 5 and afterwards open it with a simply text editor and remove the whole group, problem solved.
Well, I have to maintain 196 ships atm, and I change their loadouts pretty frequently, so it's a major pain, lol.

Anyhow, this got me to be un-lazy enough to write a grep script to clean it; now all I gotta do is run it once and everything's cleaned up.
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: Alex on June 05, 2014, 01:18:45 PM
(Fixed the original rendering issue.)
Title: Re: Mount indicaters are drawn underneath decorative weapons
Post by: xenoargh on June 05, 2014, 08:49:05 PM
Muahaha; laziest method ever.  Run in a Decorative EveryFrameWeaponEffectPlugin in a one-time loop, to remove those pesky Decoratives from weapon groups automatically:

Code: java
        if(runOnce){
            String weaponSlot = weapon.getSlot().getId();
            List<WeaponGroupSpec> weaponGroups = weapon.getShip().getVariant().getWeaponGroups();
            for(WeaponGroupSpec group : weaponGroups){
                List<String> slots = group.getSlots();
                String slotID = new String();
                for(String slot : slots){
                    if(slot.equalsIgnoreCase(weaponSlot)){
                        slotID = slot.toString();
                    }
                }
                if(slotID.equalsIgnoreCase(weaponSlot)) group.removeSlot(slotID);
            }
        }

I think that's one for the Code Dump, lol.