Fractal Softworks Forum

Starsector => Mods => Modding Resources => Topic started by: Tartiflette on October 26, 2018, 01:15:15 AM

Title: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Tartiflette on October 26, 2018, 01:15:15 AM
(https://i.imgur.com/OR5wYZM.jpg)


 The goal of MagicLib is to create an Open Source, community-driven "library" of useful (and well documented) scripts and plugins that can be leveraged and contributed to by every modder.

All contributions are welcome!

(https://i.imgur.com/GMCkkky.png)
Download (https://bitbucket.org/CodingTartiflette/magiclib/downloads/MagicLib_0.29_rc3.zip)
NexusMods mirror (https://www.nexusmods.com/starsector/mods/10/)
Requires LazyLib (http://fractalsoftworks.com/forum/index.php?topic=5444.0)


(https://i.imgur.com/8EpNARt.png) (http://starsector.wikia.com/wiki/MagicLib)


(https://i.imgur.com/AnkilqL.png) (https://bitbucket.org/CodingTartiflette/magiclib)


 Fully usable release, if anyone wants to contribute you are more than welcome to do so as it is intended to be a community tool. Do check the Wiki to get a lot of details on the current content.

Curent content:

Functions

    MagicModuleRetreatCleaner
Fixes the bug with retreating ships with modules preventing the combat from ending.

    MagicIncompatibleHullmod
A uniform solution for the "incompatible hullmod" issue with vanilla hullmods.

    MagicInterference
Adds a cross-mod mechanic to balance very powerful weapons.

    MagicAnim
A collection of functions to make smooth animations.

    MagicFakeBeam
Creates convincing punctual beams from arbitrary coordinates.

    MagicLensFlare
Creates "cinematic" lens flares.

    MagicRender
Draw arbitrary sprites on-screen with constraints to entities/camera when needed. (aka "SpriteRenderManager")

    MagicTargeting
Allows "smart" target selection for systems and missiles within distance and search cone parameters, plus it can use ship-class preferences.

    MagicTrails
Allows to create missile-style trails anywhere, from ships to bullets, with a lot of customization options. Also includes a CSV based manager that should be able to handle most projectile use cases with negligible overhead.

    MagicUI
Draws UI elements such as a system-like charge-bar/tick box next to the normal ship-system for special systems, or an extra status bar above the flux/hull bars.

Loose scripts
Scripts that can be used "as it is" or can be copied to individual mods to personalize the result.

    MagicVectorThruster
Manages vectoring or vernier-style attitude thrusters.

    MagicMissileAI
A very customizable and lightweight missile AI script usable without any java knowledge.

    MagicGuidedProjectileScript
A weapon script that allows regular projectiles to track their target.

Planned / considered content:

    MagicRotary
A loose script to make rotary weapons animations with smooth spin up and down.




Contributors:
Dark.Revenant (MagicUI)
Deathfly (MagicFakeBeam)
jtyotJOTJIPAEFVJ (MagicAnim.cycle)
Kitta Khan (bugfixes)
Nicke (MagicTrails, MagicGuidedProjectileScript)
Snrasha (MagicUI)
Tartiflette

(https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png) (http://creativecommons.org/licenses/by-nc-sa/4.0/)
MagicLib is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-nc-sa/4.0/).
Any derivative work must also comply with Starsector's EULA
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Originem on October 26, 2018, 08:08:37 PM
I have a suggestion that,if you could provide a method that register the mod at the beginning of game, if there is no mod needs it, turn off all its plugins to prevent the possible waste of memory.
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Midnight Kitsune on October 26, 2018, 08:29:43 PM
Why again do we need ANOTHER library? I'd rather not see SS turned into a version of minecraft with every mod having their own required library. This stuff could have been easily put into Graphics Lib...
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Originem on October 26, 2018, 08:38:24 PM
Why again do we need ANOTHER library? I'd rather not see SS turned into a version of minecraft with every mod having their own required library. This stuff could have been easily put into Graphics Lib...
*Agree with you*
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Tartiflette on October 27, 2018, 01:08:50 AM
Why again do we need ANOTHER library? I'd rather not see SS turned into a version of minecraft with every mod having their own required library. This stuff could have been easily put into Graphics Lib...
Because we have already several mods using stuf like direct sprite rendering or fake beams (including all of my owns) and incompatibility/versioning issues are already not uncomon. For example, for months all my mods had their visual effects removed due to another mod using an outdated version of the same plugin that overrode mine, leading to a waste of ressources because several instances of the same plugin with different names had to be run at the same time to avoid conflicts. Also this provides a whole bunch of methods that could improve new and existing mods.

And while some of this stuff could have been added to GraphicLib, a whole lot has no place in there. But be reassured: the intent is for this to be a community library, meaning that a-priori if it pickup no other library will ever be necessary. (Plus come on! That's just one thing to tick in your launcher for a lot of benefits on the modding side)

Is that a bad thing?
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Tartiflette on October 27, 2018, 01:16:14 AM
I have a suggestion that,if you could provide a method that register the mod at the beginning of game, if there is no mod needs it, turn off all its plugins to prevent the possible waste of memory.
The two plugins currently present start with a check to see if something is using them or not, skipping them if that's not the case. They shouldn't have any performance impact if not used.
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Takion Kasukedo on October 29, 2018, 11:55:10 AM
Why again do we need ANOTHER library? I'd rather not see SS turned into a version of minecraft with every mod having their own required library. This stuff could have been easily put into Graphics Lib...
Because we have already several mods using stuf like direct sprite rendering or fake beams (including all of my owns) and incompatibility/versioning issues are already not uncomon. For example, for months all my mods had their visual effects removed due to another mod using an outdated version of the same plugin that overrode mine, leading to a waste of ressources because several instances of the same plugin with different names had to be run at the same time to avoid conflicts. Also this provides a whole bunch of methods that could improve new and existing mods.

And while some of this stuff could have been added to GraphicLib, a whole lot has no place in there. But be reassured: the intent is for this to be a community library, meaning that a-priori if it pickup no other library will ever be necessary. (Plus come on! That's just one thing to tick in your launcher for a lot of benefits on the modding side)

Is that a bad thing?

When you put it that way, no it's not a bad thing, considering the benefits of having a -lib which other modders can contribute to.

This wouldn't come close to being some sort of Minecraft, mind. If it did, we'd be somewhere near square 1. This lib will, as stated, make it easier on others in the long run if successful.
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: Tartiflette on October 31, 2018, 01:13:29 AM
Micro update with proper Version Checker file (oops). On the other hand the Wiki documentation is now complete with all the current content.
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: TJJ on October 31, 2018, 03:00:35 AM
ponctual ?
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: Tartiflette on October 31, 2018, 03:01:30 AM
They deal all of their damage on their first frame., not over time like regular beams.
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: Nick XR on October 31, 2018, 08:34:55 AM
Any way this could be merged with lazy lib?  They seem like they encompass a similar mandate.
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: Tartiflette on October 31, 2018, 09:01:45 AM
Not really: LazyLib only provides passive and simple methods that are only used when called from a script and then return a result to that script. MagicLib on the other hand has multiple very complex plugins that do their own stuff over time when activated. Additionally LazyLib is an ubiquitous highly optimized precision tool that should not be tampered with lightly, thus not really suited for MagicLib's "Community Toybox" purpose.
Title: Re: [0.9.0] MagicLib v0.20 (2018/11/17)
Post by: Tartiflette on November 17, 2018, 01:37:55 AM
0.9.0 update! This library is now fully usable and contains quite a few very handy scripts. If a moderator can move this thread in modding ressources and add it to the mod index that would be great! Thanks.
Title: Re: [0.9.0] MagicLib v0.21 (2018/11/17)
Post by: Tartiflette on November 17, 2018, 09:03:38 AM
Oops, small update snafu, everything should work better now! Please redownload, sorry!
Title: Re: [0.9.0] MagicLib v0.23 (2019/03/03)
Post by: Tartiflette on March 03, 2019, 02:12:48 AM
Small update with a new trail render algorithm that should help a lot with trails that have a crisp texture, new UI elements functions to add proper status bars, and a CSV based plugin to efficiently manage projectile trails rather than having concurrent plugins in every mods.

Download available in the OP.
Title: Re: [0.9.0] MagicLib v0.24 (2019/03/07)
Post by: Tartiflette on March 07, 2019, 01:06:50 AM

0.24

MagicTrail CSV plugin:
   . Added a velocity randomization parameter.

MagicTargeting:
   . Fixed issue with random missile targeting only working in the front of the source ship.


Sorry for the frequent updates these days. This should be the final version for a while, I swear!
Download available in the OP.
Title: Re: [0.9.0] MagicLib v0.25 (2019/03/18)
Post by: Tartiflette on March 18, 2019, 02:02:19 AM
0.25

MagicTrail CSV plugin:
   . Added a bunch of default textures.
   . Fixed trail duplication bug on save reload from a battle.
   . Fixed trail_data corruption using Ron's editor

MagicFakeBeam:
   . Added spawnAdvancedFakeBeam that can use custom vanilla-like textures.


This one was meant for modders due to an issue with a popular editing program, but I added a few goodies to make it worthwhile for everyone.

This won't break saves obviously.
Title: Re: [0.9.0] MagicLib v0.25RC2 (2019/03/19)
Post by: Tartiflette on March 19, 2019, 12:06:52 AM
Once again I have to apologize for the multiple updates in a row, but I received help from more competent people and should have finally NAILED that string of bugs to the changelog.
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Tartiflette on May 11, 2019, 09:55:37 AM
(https://i.imgur.com/OR5wYZMl.jpg)


0.9.1 update: Added render order overrides for MagicTrail and MagicRender, plus an optional override boolean for the CSV based Trail manager.

Download available in the OP (http://fractalsoftworks.com/forum/index.php?topic=13718.)
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: wolfraider on May 16, 2019, 10:52:41 AM
Hi, I have a problem on Linux:
https://ibb.co/vQYMYJ5 (https://ibb.co/vQYMYJ5)

Do you need a log file?
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Snrasha on May 16, 2019, 01:07:21 PM
Hi, I have a problem on Linux:
https://ibb.co/vQYMYJ5 (https://ibb.co/vQYMYJ5)

Do you need a log file?

Just go on the path and rename the file "base_trail_fuzzy" per "BASE_trail_fuzzy", same for everything else, curse windows for that(He ignore lower/uppercase when he read pathname), i suppose. Tartiflette will out a fix probably soon, i think?
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: wolfraider on May 19, 2019, 06:38:17 AM
Thank you!
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Glissa Ravidelle on May 23, 2019, 06:34:35 PM
Hi, I have a problem on Linux:
https://ibb.co/vQYMYJ5 (https://ibb.co/vQYMYJ5)

Do you need a log file?

Was just about to ask the same question on discord. Glad I checked here before bothering anyone.

Cheers Snrasha
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: silentsnack on May 25, 2019, 11:59:48 AM
Encountered a crash with ScyNation (whenever a SN ship enters combat) but the actual cause might be this error that appears when loading the game:

Spoiler
148451 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 31
148451 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 32
148451 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 33
149043 [Thread-4] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading CSV data from [DIRECTORY: C:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\..\mods\MagicLib]
149044 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - Invalid line, skipping
[close]
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Tartiflette on May 25, 2019, 12:17:35 PM
Pretty sure that's your Scy mod that is outdated.
And even if it's not, that's not MagicLib that is at fault since this is just a debug line, not the actual line of the crash.
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: ShadowStalkar on May 28, 2019, 10:28:18 PM
I used only lazilib and magiclib to test does it work,and the game crashes,when i use only lazilib nothing happends,sadly lots of mods use magiclib so i have to fix this somehow
https://drive.google.com/file/d/10-7P61h5Mu9ot3rUYJwU-Y8jgQgm51dU/view?usp=sharing
If you need a log i can send one
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Snrasha on May 29, 2019, 08:43:15 AM
I used only lazilib and magiclib to test does it work,and the game crashes,when i use only lazilib nothing happends,sadly lots of mods use magiclib so i have to fix this somehow
https://drive.google.com/file/d/10-7P61h5Mu9ot3rUYJwU-Y8jgQgm51dU/view?usp=sharing
If you need a log i can send one

You do not have the latest version of Starsector, maybe that?
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: ShadowStalkar on June 02, 2019, 11:15:28 AM
I used only lazilib and magiclib to test does it work,and the game crashes,when i use only lazilib nothing happends,sadly lots of mods use magiclib so i have to fix this somehow
https://drive.google.com/file/d/10-7P61h5Mu9ot3rUYJwU-Y8jgQgm51dU/view?usp=sharing
If you need a log i can send one

You do not have the latest version of Starsector, maybe that?
0.9a,wich is the latest,maybe i should check for updates but i dont think its that
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Tartiflette on June 02, 2019, 01:37:25 PM
You should check because there has been an update.
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: atretador on August 01, 2019, 08:27:52 PM
So....had to rename all the files on ./MagicLib/graphics/magic/fx


Game wasnt been able to locate the correct file

Fatal: Error loadind [graphics/Magic/fx/BASE_trail_aura.png]

but the files on the fx folder were all on lower case....So, I renamed all the files and the game started normaly...after I fixed FDS and SCY.... xD

base_trail_aura -> BASE_trail_aura


Not sure if its a problem with my file manager, decompression method, or if the files are misnamed

I`m running the Linux version
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Harmful Mechanic on August 01, 2019, 09:13:07 PM
It's just Linux case-sensitivity biting the rest of us, nothing you're doing.

I can't speak for anyone else, but these are some of the nicest, easiest bugfix requests I ever get, so I make a priority to fix themwhen someone points them out.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on August 07, 2019, 05:09:43 AM
(https://i.imgur.com/OR5wYZMl.jpg)

Small bugfixes update to solve the Linux case issue as well as the Screencheck culling function being too aggressive.

This won't break any saves or mods.

Download available in the OP (http://fractalsoftworks.com/forum/index.php?topic=13718.)
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Shuhei on August 15, 2019, 02:19:15 AM
The mod crashes during the game loading phase. Updated Java to the newest version but it didn't solve the problem.

Quote
Code
[code]60965 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.fs.starfarer.loading.scripts.ScriptStore.?00000(Unknown Source)
at com.fs.starfarer.settings.StarfarerSettings.o00000(Unknown Source)
at com.fs.starfarer.launcher.ModManager.getEnabledModPlugins(Unknown Source)
at com.fs.starfarer.loading.ResourceLoaderState.init(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
[/code]
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on August 15, 2019, 05:02:55 AM
That's strange. Does it crashes with only MagicLib and LazyLib enabled?
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Shuhei on August 15, 2019, 12:30:57 PM
Yeah, but I reinstalled the game and... well... it helped.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Dark on September 20, 2019, 05:33:53 PM
im getting a crash on startup from this mod, heres the log

47554 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.weapons.MagicVectorThruster]
java.lang.RuntimeException: Error compiling [data.scripts.weapons.MagicVectorThruster]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: data.scripts.weapons.MagicVectorThruster
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:179)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on September 20, 2019, 11:28:18 PM
Are you sure you have the latest MagicLib mod ticked on in the launcher? That's all I can think of to cause that specific error.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Ed on September 26, 2019, 09:47:33 AM
Can objectspace() be used to simulate the effect of the phase cloak glow? Is there any code sample of this?
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on September 26, 2019, 10:19:35 AM
It can but I think you'd be better off using a deco weapon.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Ed on September 26, 2019, 10:31:56 AM
It can but I think you'd be better off using a deco weapon.
You mean using the deco weapon with the glow sprite? I don't quite get how to simulate the effect, do you have a sample?
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on September 26, 2019, 11:18:12 AM
Exactly that, there are many ships with deco weapons to simulate glow (Thalan comes to mind) and it requires only a little bit of code to get that running.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: NoFoodAfterMidnight on October 18, 2019, 08:45:00 PM
When using magictrails, how do you make a trail texture not scroll and not move as it's generated the entire flight of the projectile? Currently the closest I can get it is to not scroll but then it stretches until the projectile disappears.

I'm trying to get a texture of some bubbles to look good, but if they're moving constantly or getting stretched it looks pretty bad.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on October 18, 2019, 10:05:43 PM
That's  a limitation of the current implementation. Static textures regardless of variable length is a tough nut to crack but you can talk to Nicke if you have ideas to solve it.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: NoFoodAfterMidnight on October 18, 2019, 10:09:59 PM
Aww, RIP my dreams. Thanks though.
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Tartiflette on November 09, 2019, 03:03:30 AM
(https://i.imgur.com/OR5wYZMl.jpg)

Added a couple new functionalities as per a few modder request:
MagicAnim.cycle (allows a variable to cycle within an arbitrary range)
MagicGuidedProjectileScript (allows projectiles to track their target)

This won't break any saves or mods.

Download available in the OP (http://fractalsoftworks.com/forum/index.php?topic=13718.)
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Mongreal on December 15, 2019, 04:28:47 AM
Quote
MagicGuidedProjectileScript (allows projectiles to track their target)
What could prevent this script from working ?

Does this (well, it's not the complete script I'm using but it's the part used with projectile that use the MagicGuidedProjectileScript) should work ? :
Spoiler
Code
List<DamagingProjectileAPI> projectiles = engine.getProjectiles();
            int size = projectiles.size();
            for (int i = 0; i < size; i++) {
                proj = projectiles.get(i);
                String spec = proj.getProjectileSpecId();
                WeaponAPI mainWeapon = proj.getWeapon();

                if (mainWeapon.getShip().getShipTarget() != null) {
                    target = mainWeapon.getShip().getShipTarget();
                } else {
                    target = AIUtils.getNearestEnemy(proj);
                }

                switch (spec) {
                       case LIGHT_PLASMA_DART_PROJECTILE_ID:
                              isGuided = true;
                       break;

             if (isGuided) {
                  engine.addPlugin(MagicGuidedProjectileScript(proj, target));
             }
[close]
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: alexwtb234 on December 17, 2019, 12:47:21 PM
I get this error : Index= 0 size = 0  only with magic lib installed
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Tartiflette on December 17, 2019, 02:52:05 PM
Magic lib requires Lazy lib
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: alexwtb234 on December 19, 2019, 07:52:33 AM
Magic lib requires Lazy lib


Does not work even with lazy lib
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Mongreal on January 06, 2020, 01:17:55 PM
What does growth affect on MagicRender.battlespace ? When does growth and size get reset ?
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Tartiflette on January 06, 2020, 09:31:01 PM
I'm not sure I understand the question. Growth is the size change of the drawn sprite over its lifetime, it doesn't get "reset" nor is the initial size.
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Mongreal on January 07, 2020, 11:31:41 AM
Well, in my case, I'm using this :
Spoiler
Code
            vSize = new Vector2f(sprite.getWidth() * modifier, sprite.getHeight() * modifier);
            vGrowth = new Vector2f(2f * modifier, 2f * modifier);
            vVelocity = new Vector2f(burstSpread / 2f * modifier, burstRange / 2f * modifier);
            //VectorUtils.rotateAroundPivot(vVelocity, barrelLocation, weapon.getCurrAngle());
            MagicRender.battlespace(sprite,
                    barrelLocation,
                    vVelocity,
                    vSize,
                    null,
                    weapon.getCurrAngle() - 90f,
                    0f,
                    flashColor,
                    true,
                    0.15f,
                    0.25f,
                    0.05f
            );
[close]
as part of a EveryFrameWeaponEffectPlugin.
This particular battlespace is called with each shot of the weapon itself (which may be the problem but I'll wait for your answer).
Each shot fired from the magazine of the gun increase the modifier value, which add an unknown value to the original size, growth speed, and velocity, if I'm not mistaken.
On the next shot, the size of the sprite doesn't goes back to the initial witdh and height set by the vSize variable : The sprite stays bigger until the last round of this magazine, which suddenly pushes the size to extreme values (should multiply it but 1.5 or 1.8, but instead, the sprite fill the entire screen).
Does the battlespace stay "active" between two reading of this section, and thus, doesn't get "reset" anywhere ? From what I tried, I can only assume that the MagicRender.battlespace shouldn't be use this way on everyframe stuff ? Can I achieve something like this with singleframe instead ?
If you don't mind, I can give you my discord on mp. I don't know if you remember me, but I used to chat with you on Skype three years ago. And, I'm french too, by the way.
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Tartiflette on January 07, 2020, 02:00:28 PM
You should use the single frame render for that, battlespace renders are for sprite spawned once and are then entirely managed by the Magiclib plugin.
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: NephilimNexus on February 11, 2020, 08:06:30 PM
I get this error : Index= 0 size = 0  only with magic lib installed

Same here, which is really weird because it was working just fine yesterday.  I haven't altered either MagicLib or LazyLib.  It just... stopped working.

Edit: Never mind, I found the problem.  I went to reinstall a few files from the base game and didn't notice that I had 0.9a sitting right next 0.9.1a and grabbed the wrong version.  Once I had the right version installed, MagicLib started working again.
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Wispborne on February 13, 2020, 05:44:17 PM
I'm getting a crash, probably because I'm using the method wrong but I didn't find any sample code to go off of.

Code
33855 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.campaign.CustomCampaignEntity.readResolve(Unknown Source)
at com.fs.starfarer.campaign.CustomCampaignEntity.<init>(Unknown Source)
at com.fs.starfarer.campaign.BaseLocation.addCustomEntity(Unknown Source)
at data.scripts.plugins.MagicCampaignTrailPlugin.advance(MagicCampaignTrailPlugin.java:59)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

The calling code is identical to:

Global.getSector().addScript(new MagicCampaignTrailPlugin());

The player is on the campaign layer, in a dialog, when that's called.
Here's the actual source: https://github.com/davidwhitman/Gates-Awakened/blob/331041fad49b6f0518d99e02fd17c1f6d019759c/src/main/kotlin/org/wisp/gatesawakened/jumping/Jump.kt#L64

Any thoughts? It's crashing inside of addCustomEntity in this MagicLib code:
Code
            associatedEntity = Global.getSector().getPlayerFleet().getContainingLocation().addCustomEntity("nictoy_unique_custom_trail_tracker_object", "YOU SHOULD NOT SEE THIS",
                    "nictoy_campaign_trail_custom_entity", Factions.INDEPENDENT, this);
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Nicke535 on February 25, 2020, 09:30:43 AM
I'm getting a crash, probably because I'm using the method wrong but I didn't find any sample code to go off of.

Might be my bad: that code is non-implemented. I... honestly didn't remember that stuff was still in the release branch. Thought it was on a private dev branch.

Either way, campaign trails are non-implemented, so you cannot use them.
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Tartiflette on April 26, 2020, 01:52:13 AM
(https://i.imgur.com/OR5wYZMl.jpg)


Fixed a few bugs and added a couple of new functionalities as per a few modder request:
0.29

Added MagicInterferencePlugin
   . Makes exceptionally strong weapons with the "Interference" trait have negative effects when more that one is mounted on a given ship.
   . Those weapons need to trigger the plugin to check for possible other interference sources from a CSV file.
   . If other sources are found, it will add a hullmod that reduced the ship's dissipation depending on the number of interfering weapons and their interference strength.

Added MagicBasicInterferenceEffec loose weapon script to trigger an interference check.

Added MagicIncompatibleHullmods
   . Proposes a uniform "incompatible hullmod" solution.
   . When triggered as two incompatible hullmods are added, it will remove the offending hullmod and add a hullmod to warn the player about that operation.
   . The added hullmod's tooltip will indicate which hullmod was removed and why.

Added MagicModuleRetreatCleaner
   . Fixes the bug with retreating ships with modules preventing the combat from ending.

MagicRender:
   . Added optional blending modes to the sprite renders.

MagicUI:
   . Fixed crash when used the first frame in combat.
[close]

This won't break any saves or mods.

Download available in the OP (http://fractalsoftworks.com/forum/index.php?topic=13718.)
Title: [0.9.1] MagicLib v0.2.9 (2020/04/26)
Post by: Zangetsuke on April 27, 2020, 10:15:34 AM
I have some problems with the lastest version

Spoiler
74474 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_4cmrailgunshot
74474 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_4cmrailgunshot
74475 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_6cmrailgunshot
74475 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_6cmrailgunshot
74475 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_9cmrailgunshot
74475 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_9cmrailgunshot
74475 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_12cmrailgunshot
74475 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_12cmrailgunshot
74475 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_20cmrailgunshot
74475 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_20cmrailgunshot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_NTKcannon_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_squiggle_whistler_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_howler_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_hellspear_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_hellspear_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_omniblaster_core_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_artillery_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_artillery_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_scatterlaser_core_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_scatterlaser_sub_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_blaze_shot
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_TBM_submunition
74476 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bomblet2
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_electrogun_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_electrogun_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_plasmadisruptor_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_plasmadisruptor_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_pulseripper_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_pulseripper_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_plasmadriver_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_plasmadriver_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_plasmadriver_shot
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_dem_pulse
74477 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_dem_pulse
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_thermalmortar_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_thermalmortar_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_jackalblade_lg
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_jackalblade
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_breakerLRMbombB
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_shellback_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_shellhead_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_phaserail_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_phaserail_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_phaserail_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_miniphaserail_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_miniphaserail_shot
74478 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_miniphaserail_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_energymortar_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_energymortar_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_calliope_submunition
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_phaseblaster_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_phaseblaster_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_phasedbuster_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_phasedbuster_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_phasedbuster_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bravepulse_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bravepulse_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bravekinetic_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bravekinetic_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bravekinetic_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bravemissile_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bravemissile_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_bravemissile_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_alaudapulse_shot
74479 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - missing layer override for istl_alaudapulse_shot
74480 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - Invalid line, skipping
[close]
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Harmful Mechanic on April 27, 2020, 05:02:01 PM
Just a check, since those errors are DME trail entries; it's not crashing after this, just giving you those errors in the log, right?

I got this before a while ago; it was new field in the MagicLib trail_data.csv file that I hadn't added to my implementation, but it wasn't crashing. So I'll take a look tonight and see what I need to do to match this latest version, but it ran perfectly well last time and should still run fine with this.
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Tartiflette on April 27, 2020, 11:32:32 PM
Yeah, MagicLib is perfectly save compatible, it's just a matter of optional fields present or not.
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Professor Pinkie on July 04, 2020, 12:31:54 PM
Can anyone tell me any mod using MagicIncompatibleHullmod?

I want to see how it should work.
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Cabbs on July 05, 2020, 01:45:34 PM
Can anyone tell me any mod using MagicIncompatibleHullmod?

I want to see how it should work.

Don't have a clean example to refer you too, but its super-easy to implement. 

You add code to your applyEffectsBeforeShipCreation like this:

Quote
if(stats.getVariant().getHullMods().contains("swp_shieldbypass")){

 MagicIncompatibleHullmods.removeHullmodWithWarning(stats.getVariant(), "swp_shieldbypass", "CBCC_shieldscaling");

 }

In my example:

1.  applyEffectsBeforeShipCreation runs every time you add a hullmod to a ship, so this check occurs whenever you change something
2.  If the mod with ID "swp_shieldbypass" is present, the IF triggers
3.  'MagicIncompatibleHullmods.removeHullmodWithWarning' removes "swp_shieldbypass" and replaces it with a dummy warning mod that specifies "CBCC_shieldscaling" as the reason, so these two mods can never be present together.


This is how it works as far as I know.
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Professor Pinkie on July 05, 2020, 10:11:11 PM
Silly me.

This is exactly what I was trying to do. My problem was: "eficiency_overhaul" instead of "efficiency_overhaul" in MagicIncompatibleHullmods.removeHullmodWithWarning(stats.getVariant(), "eficiency_overhaul", "my_hullmod");

In the future, I should read the log before asking people questions.

I apologize most deeply.
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: SafariJohn on July 06, 2020, 07:14:28 PM
Don't feel too bad, I thought a typo might be the problem and still missed that.
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Morrokain on July 07, 2020, 01:44:41 PM
I did as well.  :P
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Titann on July 11, 2020, 01:56:43 AM
first download link doesnt work and nexusmod requires login to download. First link says ERR_SSL_PROTOCOL_ERROR and its not safe, not sure why

edit: nvm i cant see download pictures with links on them because imgur is not allowed in our country for some reason lol
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: jn_xyp on July 19, 2020, 07:50:33 AM
Hi,

In order to facilitate Chinese players to download this essential mod, I would like to ask permission to repost this mod on the Starsector Chinese Forum (https://www.fossic.org/).

I will keep all the description and author information, and follow further update of this post.
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Tartiflette on July 19, 2020, 09:20:33 AM
Wait, it wasn't there already? Of course you can, and you should!
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: jn_xyp on July 19, 2020, 09:59:39 AM
Wait, it wasn't there already? Of course you can, and you should!

Actually it was there already, but we are now going through every reposts to check if there's proper authorization for reposting, and make sure the lib mod like this get updated in time  :D
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Neitronus on September 23, 2020, 08:41:03 AM
Is it possible to update to fix version checker issue? There's an issue with version file being unreacheble on bitbucket after recent bitbucket change AFAIK.
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Stealthlake2305 on October 01, 2020, 09:36:34 PM
Tried to run it but it didn't work. The mods I have running are autosave 1.1bm, common radar 2.5b, lazylib 2.4f, Nexerelin 0.9.7b and they all work fine. Did I install it wrong?
Title: Re: [0.9.1] MagicLib v0.29 (2020/04/26)
Post by: Tartiflette on October 02, 2020, 12:39:48 AM
MagicLib doesn't do anything by itself. It's a toolbox to make other mods easier to code.