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: Anubis-class Cruiser (12/20/24)

Pages: 1 [2]

Author Topic: [0.97a-RC11] Mirror 1.4 & DecoLib 0.3  (Read 53323 times)

Wyvern

  • Admiral
  • *****
  • Posts: 3878
    • View Profile
Re: [0.97a-RC11] Mirror 1.3 & DecoLib 0.3
« Reply #15 on: March 09, 2024, 04:39:28 PM »

Mod is updated for Starsector 0.97.

Instructions for a modder wanting to mirror weapons in their mod:

Case 1: The weapon in question does not already have an EveryFrameEffectPlugin attached to it.
 • Add an appropriate dependencies entry to your mod's mod_info.json, like so:
Code
"dependencies": [ { "id":"wyv_decolib","name":"DecoLib" } ],
• Add an everyFrameEffect entry to the .wpn file using one of the two completely pre-built weapon-mirroring classes in DecoLib:
Code
"everyFrameEffect": "data.scripts.wyv.MirrorQuadLeft",
Or
Code
"everyFrameEffect": "data.scripts.wyv.MirrorQuadRight",

Case 2: The weapon does have an EveryFrameEffectPlugin, or you want different mirroring behavior than the default quad-left or quad-right.
 • Add a dependencies entry to your mod's mod_info.json, as per case 1.
 • Do whatever steps you need to do to get your IDE to recognize DecoLib.jar as a referenced library.
 • Make your existing EveryFrameEffectPlugin extend MirrorQuadLeft, MirrorQuadRight, or just Mirror.
 • If your class doesn't implement its own init or advanceAfter methods, and you extended MirrorQuadLeft or MirrorQuadRight, you're done!
   • If your class implements init, or you extended Mirror, then you need to call super.init() from your own init method - setting isMirrored first if you're extending Mirror.
   • If your class implements advanceAfter and the weapon is animated, then you need to call super.advanceAfter() from your own advanceAfter method.

Extra step for decorative weapons:
 • Add "NEVER_RENDER_IN_CAMPAIGN" to the "renderHints" field in the .wpn file. Something like this:
Code
"renderHints":[NEVER_RENDER_IN_CAMPAIGN],
• This is needed because weapon mirroring does not work in campaign contexts; setting this renderHint makes the game simply not show the weapons in such contexts.
 • This is not needed for non-deco weapons, as they don't naturally show in campaign contexts in the first place.

And that's it! Simple, right?

If you want to see examples of how this works, take a look at the Mirror mod.

Now, is there more that you can do with DecoUtils? Yes! For example, you can use the ManagedWeapon class to have your weapon read mirroring behavior and custom sprite centerpoint offsets from a json file. But that starts to get beyond the really simple basics, here; if you've got specific questions (or specific things you want DecoUtils to do that it doesn't), feel free to reach out to me via PM or post in this thread.
« Last Edit: March 09, 2024, 04:52:02 PM by Wyvern »
Logged
Wyvern is 100% correct about the math.

Wyvern

  • Admiral
  • *****
  • Posts: 3878
    • View Profile
Re: [0.96a-RC10] Mirror 1.4 & DecoLib 0.3
« Reply #16 on: March 10, 2024, 03:55:52 PM »

next version should include mining lasers and ion beams
...And somehow I still forgot to include these in Mirror 1.3, so now we've got a Mirror 1.4. Hopefully that's the last update Mirror will need for a while...

(DecoLib, by contrast, is still actively being worked on. I want space dragons with articulated wings and tails, darn it! And while I'm not there yet, I do have all the base pieces I need for it... just need to actually do the trig/matrix calculations, wire it all together, and actually build some ship graphics...)
Logged
Wyvern is 100% correct about the math.

gfe20010

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: [0.97a-RC11] Mirror 1.4 & DecoLib 0.3
« Reply #17 on: May 07, 2024, 04:24:57 AM »

What a great mod!!!
I'm really wish I could share your mod with more people that can't get in this forum,or can't read English%u2014%u2014like most of Chinese players
May I post your mod on the Starsector foum in China? I will note that you are the author, and give a link to this original page
Here is the address of the forum where I will post
https://www.fossic.org/
I look forward to your reply very much
« Last Edit: May 07, 2024, 04:28:31 AM by gfe20010 »
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3878
    • View Profile
Re: [0.97a-RC11] Mirror 1.4 & DecoLib 0.3
« Reply #18 on: August 25, 2024, 01:04:04 PM »

May I post your mod on the Starsector foum in China?
Apologies for the very belated response.

Yes, you (or anyone else who's interested in doing so) are welcome to cross-post Mirror & DecoLib to wherever, assuming that proper credit is given. (Which you'd said you'd do - I add in that disclaimer because I'm giving blanket permission to anyone.)

...In fact, let me just put this up in the original post's FAQ section, too.
Logged
Wyvern is 100% correct about the math.

gfe20010

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: [0.97a-RC11] Mirror 1.4 & DecoLib 0.3
« Reply #19 on: August 30, 2024, 12:37:19 PM »

May I post your mod on the Starsector foum in China?
Apologies for the very belated response.

Yes, you (or anyone else who's interested in doing so) are welcome to cross-post Mirror & DecoLib to wherever, assuming that proper credit is given. (Which you'd said you'd do - I add in that disclaimer because I'm giving blanket permission to anyone.)

...In fact, let me just put this up in the original post's FAQ section, too.

THX!!!
Here is the link of my cross-post : https://www.fossic.org/forum.php?mod=viewthread&tid=11192
Logged
Pages: 1 [2]