Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Tuv0x

Pages: [1]
1
Modding Resources / [GUIDE] Setting up Visual Studio Code to mod
« on: December 16, 2020, 02:29:57 AM »
Setting up VSCode for modding

There are a few guides here for intelliJ but I personally am a fan of VScode, I coded my first mod in NetBeans 10.0 but some of the features I'm used to in VSCode I just couldn't live without.
Also, if images aren't showing up when you click the spoilers, just reload the page, not sure what's going on there.

Anyways, here goes:
  • You can get vscode directly from their website or use your given package manager to download it (apt, pacman, etc.)
  • Once you have vscode installed, open it up and head over to the extensions tab
    Spoiler
    Should looks something like this
    [close]
  • Once you're there, pick up these two extensions (If it asks you to reload, go ahead and reload)
    Spoiler
    [close]
  • Now for the fun stuff: go ahead and hit Ctrl+Shift+P to bring up the command palette and type "Java", find "create Java project"  it should look like this after you click it:
    Spoiler
    [close]
  • Click "No Build Tools" to make this easier.
  • Now select a parent folder to put your project in (hint: it's about to ask you for a project name, this creates a folder with that name)
  • Name it whatever you want, it doesn't matter.
  • It's going to auto generate a project for you now, you can delete the App.java, README, and lib folder (unless you want to use them)

Now here's the very specific stuff for making this work for Starsector.

  • Starsector requires that you use Java 7 (aka jdk 1.7.0) when coding, so go pick that up from here
  • Now to make sure that the project manager is going to use Jdk1.7.0_80 to compile the .Jar go ahead and bring up the command palette with Ctrl+Shift+P.
  • Type "settings" and find "Preferences: Open Settings (JSON)"

At the very bottom paste this in.

Code
"java.configuration.runtimes": [
    {
      "name":"JavaSE-1.7",
      "path":"C:\\Program Files\\Java\\jdk1.7.0_80",
      "default":true
    }
]
NOTE: This is for Windows setups, given that jdk1.7.0_80 was installed in it's default location (64 bit), If you grabbed the 32 Bit version, it will be in C:\\Program Files (x86)... instead
If you grabbed an OpenJDK version, or just downloaded a zip, you'll have to point it to the correct directory yourself. Also, the double "\\" is intended, it's escaping the backslash, which Windows won't let die.
Linux Users: Most likely location is: /usr/lib/jvm/...
On Linux, I personally had to download the Zip and unzip it to that location.


If by default something else was there (It might use any previously installed Jdk's or installed openJDK and populated this already), delete it and replace it with this.

Okay, that's sorted.

Now how do I use this?
  • In the file explorer (Pages icon, top left), there should be a tab called "JAVA PROJECTS", open that up and make sure your project is expanded like so.
    Spoiler
    [close]
  • If you want to add libraries (starfarer.api.jar for example) click the plus sign that pops up when you mouse-over "Referenced Libraries" and find the .Jar
  • If you want to add a Class hit the plus sign that pops up next to "src." This supports names like "org.tuvox.TestMod" It will autocreate folders and the .java as well as include the correct package information in said file.
  • To build your project, when you mouse-over that panel, you will see this up top
    Spoiler
    [close]
  • Click it and uncheck everything except "bin" if you have dependencies (this ensures your dependencies don't get thrown into the compiled .Jar)
  • The default behavior for this is to just spit out the jar in the project folder, if you'd like to change that behavior click the Settings Cog all the way in the bottom left
  • Once there, type "Export Jar: Target Path" and you can change it. CAUTION: If User is selected in the top left, it will do this globally for EVERY project you work on, if you just want to change it for this Project, click Workspace.

And if you're familiar with Gradle and Git, I suggest you check out this template repo made by Jaghaimo here and use something like the Gradle Tasks extension in VScode.



2
Mods / [0.96a-RC10] Dynamic Tariffs 2.0
« on: December 16, 2020, 01:08:55 AM »
Dynamic Tariffs
Created by: Tuv0x
Download
Source

During a vanilla play-through, I decided that a 30% tariff while dealing with a faction I have good reputation with, just didn't make sense.
I figured I might as well break into the modding scene with a mod that handles this problem, not to mention it let me practice my seriously rusty Java.

DISCLAIMER:
I'm assuming there are no issues with 0.96a-RC10, this mod relies on very basic principles. If anything should come up reach out to me on Discord: tuv0x
I'll update the mod_info.json again once the release candidates slow down after a while.

What It Does:
Whenever you open a market, it modifies the tariff based on your reputation with the owning faction.
When you close a market, the modifications are removed, hence why this is a utility mod.

Compatibility:
This mod shouldn't have any issues with other mods because of the whitelist feature (which you can turn off too).
The whitelist in the settings.json are the only markets effected by this mod (currently only vanilla markets).
This was done because there are a handful of mods out there that handle markets in their own way when it comes to tariffs.
You could potentially have issues with this mod if you (or a mod) edited the default tariff in /data/campaign/econ/economy.json

Default Tariffs:
Suspicious: 30% Neutral: 25% Favorable: 20% Welcoming: 15% Friendly: 10% Cooperative: 5%
There's an extra number in the settings.json "dt_percents" array at the end (0 is default), that is just for calculations for the granular option. If you were at 100 rep and had granular on, you would end up at 0% tariff.
Commission discount: 5%
All of these values are sort of random, I haven't tested them that much.
If you don't like these edit the settings.json


Thanks
Huge thanks to the folks in discord including:
LazyWizard, stormbringer951, extremely loweffort art god, Rubin, and Jaghaimo (for the capital P in modPlugin).

Be warned:
Take account of your faction reps when doing trader runs, it can make things more tricky

Settings.json
Spoiler
dt_percents defines what tariffs should be at each level of reputation from Suspicious to Cooperative.
dt_granular if set to true (default) will offer all values in-between the set percents based on your actual reputation level. Note: if set true, if you reach 100 reputation with a faction your tariffs will be 0%.
dt_commission if enabled (default) will give you a discount when commissioned with the market's owning faction.
dt_commDiscount is how much it should discount (default is 5%)
dt_whitelist contains all of the vanilla market id's, these will be the only markets that are effected, if you wish to add some markets, just add their market id's to the list.
[close]
Changelog:
Spoiler
2.0 - Rewrote almost everything, now supports turning off the whitelist feature with "dt_usewhitelist" in the settings.json
1.4 - Updated the mod_info.json for the 0.95.1a release.
1.3 - Added Granular Tariffs (percentage tariffs in between each milestone)
1.2h - Hotfix for crashing when a market doesn't exist, added commission feature that can lower tariffs further in markets you are commissioned with.
1.1 - Reworked the code a bit. Instead of modifying on every market open/close, it now modifies all whitelisted markets when you load your save. Before you save, it removes all modifications, and after you save (if you're just quick saving) it reimplements all of the modified changes. It will also do this on the fly if your rep changes with a faction (I see you selling all those drugs on the black market).
1.0 - Release!
[close]



3
Discussions / Testing whether or not I can post *FIXED*
« on: December 16, 2020, 01:04:57 AM »
I'm having trouble posting a topic in the Modding sub for some reason. The window title is Database Error, and it just keeps telling me to try again.

I've tried 3 different browsers now.

Edit: I included some special characters that were not kosher when it comes to the Database.

Pages: [1]