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.

Messages - ShadowDragon8685

Pages: 1 [2] 3
16
So, I've just had a devil of a time troubleshooting a problem I had: I wanted to make a set of Logistics hullmods, alternative implementations to the vanilla Augmented Drive Field hullmod. They needed to be incompatible with one another and the vanilla Augmented Drive Field, as well as counting-as Logistics hullmods.

What I discovered, after considerable trial-and-error, was that the way vanilla hullmod incompatibilities are handled, and the way vanilla Logistic hullmods being rejected for the ship already having too many Logistic hullmods, was the same implementation; an @override, specifically something like this:

Code
@override
public boolean isApplicableToShip(ShipAPI ship) {...};
public String getUnapplicableReason(ShipAPI ship) {...};

Thus, when I implemented the hullmod incompatibility checks (so you couldn't detune the engines at the cost of Burn for fuel-efficiency, and then retune them for speed,) it, well, overrode the vanilla "Too Many Logistics Hullmods!" check, and would let me install those hullmods when there were too many Logistics hullmods, which then kicked off another Logistics hullmod the way the shipyard normally does.

So it didn't actually let you build an illegal ship, but it didn't give good feedback about what it was doing.

It would be nice if, instead of this current system, you had something like, I dunno... Pardon my arse-pulled psuedocode here because I'm very much not-a-coder working with things I barely understand, but...

Code

public class mySuperAwesomeHullMod extends BaseHullMod {...

public boolean conflictsWithHullmods(ShipAPI ship) {
if !ship.getVariant().getHullMods().contains("hullmod 1");
String text = "mySuperAwesomeHullMod conflicts with hullmod 1...";
if !ship.getVariant().getHullMods().contains("hullmod 2");
String text = "mySuperAwesomeHullMod conflicts with hullmod 2...";
if !ship.getVariant().getHullMods().contains("hullmod 3");
String text = "mySuperAwesomeHullMod conflicts with hullmod 3...";
else return null
}
[code]

For extra rigor, it might or might not be desirable to spin-off the "too many Logistics hullmod checking" from the same

[code]
public boolean isApplicableToShip(ShipAPI ship) {...}

into something like, I dunno,

Code
	public boolean isTooManyLogisticsHullmods(ShipAPI ship) {...}

So it would be significantly less likely for a modder to accidentally override it when attempting to render a hullmod incompatible for another reason.

17
Modding / Re: Disabling ship control whilst firing a weapon
« on: May 07, 2020, 10:58:15 AM »
The big ***-off siege ship from Sylphon works like that, IIRC. You could take a look at that.

18
Ok, nice. This seems all good, then. (Edit: aside from the max shown in the tooltip thing, which, right, I've just changed on my end.)

Huzzah! Though it might be nice if there was some kind of pop-up handler for "X was removed and here is why," or at least an alert "something you did caused a hullmod that you didn't uninstall to be removed, and the game doesn't know what it was."

19
If you uninstall the hullmod granting extra logistics slot, resulting in too-many-logistics-mods, the topmost (IE, the first-added) Logistics hullmod is automatically kicked off the ship. (I guess it got voted off by the others.)

Ah, ok, cool! Fixed up the number-of-logistics mod display in the tooltip, btw.

What confuses me now is this is your method signature:
public void applyEffectsBeforeShipCreation(ShipAPI ship, MutableShipStatsAPI stats, String id)

But that's not actually a method in HullModEffect. The methods there are:
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id);
void applyEffectsAfterShipCreation(ShipAPI ship, String id);

So your code as is seems like it wouldn't work at all, i.e. that method would just never get called. But it'd still compile, because the base class has (empty) implementations of the two actual methods that get called. Am I missing something? That fact that this is working for you kinda makes me wonder if what you posted and what you're actually running are the same thing...

Ack! I skipped a step in my edit, yes. >_< That had been confusing the hell out of me. This is what I've currently got going:

Code
package data.hullmods;

import com.fs.starfarer.api.combat.BaseHullMod;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import com.fs.starfarer.api.impl.hullmods.BaseLogisticsHullMod; // Let me see if this fixes it...
import com.fs.starfarer.api.impl.campaign.ids.Stats; //Needed this to grab MAX_LOGISTICS_HULLMODS_MOD

import com.fs.starfarer.api.combat.ShipAPI; // Needed for vanilla incompatibility catch - I think.
// import data.scripts.util.MagicIncompatibleHullmods; //Needed for handling incompatibilities with hullmods not in my mod.
import com.fs.starfarer.api.Global; // Needed to grab the alert sound to play.

public class sd_AHM_LogisticSlot extends BaseHullMod {

private static final int LOGISTICS_HULLMOD_SLOTS_BONUS = 1;

public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
stats.getDynamic().getMod(Stats.MAX_LOGISTICS_HULLMODS_MOD).modifyFlat(id, LOGISTICS_HULLMOD_SLOTS_BONUS);
}

public String getDescriptionParam(int index, HullSize hullsize) {
if (index == 0) return "" + LOGISTICS_HULLMOD_SLOTS_BONUS;
return null;
}

}

And here, it is working as-expected:

At maximum hullmods it won't let me add more, by giving me the tooltip (in this case, I had set the maximum Logistics hullmods to 3 in settings previously).

Adding the Logistics Slot increaser allows me to add another Logistics hullmod again...

Having done so, it now correctly prohibits me from adding another logistics hullmod, though the tooltip does not accurately reflect that my new Logistics hullmod cap is 4 rather than three.

Lastly, removing the Logistics Slot Increaser does not give me back its OP and let me keep a freebie logistics mod; it kicks the topmost logistic mod off the ship.

Now I just need to troubleshoot why, if I'm at the logistics mod cap, my clone-alternates of Augmented Drive Field are still showing as permissible in the shipyard UI, and, if taken, will kick off the topmost Logistics hullmod.

They both have the Logistics tag in the hull_mods.csv and they both extend BaseLogisticsHullMod...

20
Can you edit the hullmods in the starfarer.api.zip files directly and save it? i want to edit the numbers a bit on expanded cargo holds, fuel tank, deck crew and ground support,

if not,how to make a simple mod to edit these hullmods?  thanks in advance.

What you're going to need to do is make a mod that copies those files out to

Raevenmod/data/hullmods

You're going to need to copy the hull_mods.csv lines pertaining to those hull mods as well into a hull_mods.csv in that folder.

Edit the copies of the .java files in that folder, then save them. You'll also need a mod_info, and it's probably a decent practice to use the REPLACE method in mod_info, but it's not strictly necessary.

Then just drop that in your Starsector/mods folder, activate it in the launcher, and Ludd's your uncle.

21
What happens if you install this mod, then install 3 logistics mods, and then uninstall this mod? IIRC this is only really supported as a built-in and wouldn't handle this sort of case (i.e. where removing the mod with this bonus is possible).

If you uninstall the hullmod granting extra logistics slot, resulting in too-many-logistics-mods, the topmost (IE, the first-added) Logistics hullmod is automatically kicked off the ship. (I guess it got voted off by the others.)

22
I'm trying to make a hullmod that increases the number of logistics mods that may be added to a ship by 1. I've managed to get it into Starsector, with costs appropriate to hull size, I've finagled it so that the shipyard UI doesn't mistakenly categorize it as a Logistics hullmod in one form or another.

In every respect it works, except that it does not actually increase the number of Logistics hullmods that can be applied to a ship.

Am I missing something really obvious here?

Code
public class sd_AHM_LogisticSlot extends BaseHullMod {

private static final int LOGISTICS_HULLMOD_SLOTS_BONUS = 1;

public void applyEffectsBeforeShipCreation(ShipAPI ship, MutableShipStatsAPI stats, String id) {
ship.getMutableStats().getDynamic().getMod(Stats.MAX_LOGISTICS_HULLMODS_MOD).modifyFlat(id, LOGISTICS_HULLMOD_SLOTS_BONUS);
}

public String getDescriptionParam(int index, HullSize hullsize) {
if (index == 0) return "" + LOGISTICS_HULLMOD_SLOTS_BONUS;
return null;
}

}

I'm feeling very dumb at the moment.

[edit]

Okay, so, thanks to TaxPriest, it's almost-all-working now: by changing

Code
ship.getMutableStats()
to simply
Code
stats
it is in almost all respects working.

The only thing that's left somewhat unideal is that the shipyard still shows the normal maximum number of logistics hullmods when you have the newly-enlarged number of logistics hullmods installed and mouse-over an additional one. But still!

23
Modding / Re: Any mods that disable phase ships?
« on: April 16, 2020, 07:31:05 AM »
So, any mods to disable these stupid things? Carriers and missiles are not a counter to phase ships. They are just you praying AI screws up enough for the ship to die. Phase ships have no counter.

I feel the same way. Phase ships are nothing but an obnoxious pain in the ass, and they need a more easily-accessible hard counter than "get carriers and the good fighters."

What *would* be nice is if they had a built-in limitation that prevented the phase cloak from cycling too rapidly; something like at least a five second delay after it drops before it can go up again; phasing can get you into trouble, or out of it, but not both in rapid succession. There needs to be a window in which slow ships can bring heavy ordnance to bear if the phase ship phases up to it, or the phase ship should have to be exposed whilst closing in order to phase out of dodge once it drops its ordnance.

24
So, twelve is basically a soft-cap for industries and structures combined unless you're okay with being entirely unable to adjust the ones at 13 and beyond?

Fie.

25
I'm about to run into this problem myself. Have you heard anything?

26
HMI is...

Well, in a word, fantastic.

But, if I might;

The HMI-added resources seem to only exist to be smuggled for credits (or exported for same, if you happen to seize the systems where they're produced.)

I would really like for them to have a purpose for the player other than just getting credits, and preferably this wouldn't require building all-new industries, etc, that inevitably wind up competing with the player's existing industry slots from both vanilla and half a dozen other mods. Preferably they could be used to enhance vanilla functions somehow.

Quantum Liquid: This one's a bit tricky, since there isn't really anything the player can do in terms of research & development. The only vanilla activity I can think of that it might enhance somehow is techmining; with quantum liquid to supercharge the computers crunching through and trying to restore all those wrecked data systems, results that otherwise would take until the heat-death of the universe become potentially plausible; perhaps, then, quantum liquid will let a techmining industry run without depleting itself, or run normally if it already has?

Nanite Mass: This seems simple enough, since nanite mass is said to allow for one-time construction of any theoretical component, there's a lot of potential uses for it, which would surely be asinine to code. My suggestions would be:

1: Allows the player the duplicate any one piece of hardware they have an example of and want more of. Uses equivalent cost in nanite mass (rounded up; minimum 1 unit of mass), or perhaps twice that?

2: Allow the player to expedite buildings or industries on their colonies, at great expense in nanite mass. Something like being able to cut the construction time in half, by paying in up to the construction's cost worth of nanite mass to add one-half that value in progress to the construction timer.

3: Feedstock for Heavy and Light Industries, covering resource shortfalls?

Red Water: Honestly, it should just fill the need for recreational drugs. But given what it says it does instead, perhaps instead of fulfilling that need, it grands industries a production bonus, at the drawback of stability - everyone gets inspired to work real hard when on the red water, but being tormented by the demons of their past isn't exactly great for a harmonious dinnertime conversation.

27
Some experimenting has revealed something interesting to me:

The replace function in mod_info.json apparently - at least, this is my hypothesis, supported by the evidence I've observed - only works for files in folders that starsector expects.

For example, starsector expects a data\hulls\skins folder, but it doesn't expect a data\config\exerelinFactionConfig folder, so it isn't appropriately replacing and locking out files in that folder - specifically dassault_mikoyan.json, for the example I've been tinkering with.

Granted there may be another factor at work here, but I have clearly observed that I can use the replace function on DME hull files and variant files, and it works as-expected. However it did not override the Nex config file, so my current hypothesis is that it's ignoring files in folders it doesn't expect. I confirmed that it wasn't a matter of "this needs a new game" by editing the file in DME's folder and it worked as I expected.

28
Back at it again, and I've made another discovery about how Starsector decides which-override-which.

The behavior for lines in .csv files and the behavior for other files seems to be exactly opposite to one another. This baked my brain all night last night, and it hit me like a bolt of the thunderingly obvious this morning.

Everything up-thread about how comma separated value files take priority remains true; the mod which loads first as determined by alphabetical entry in the mod load order "locks in" lines from its CSV, and Starsector will discard any later-loading csv lines with the same id.

However, the way it behaves for other files - for example, .ship and .variant files - is exactly the opposite, with the mod which loads later in the load order as determined by alphabetical entry in the mod load order overrides earlier ones.

So, for a non-hypothetical private example, if I wanted to override DME's ordnance weapons to have reloading in combat in the style of Missiles and Sundries, I would need to ensure that whatever mod I made to do so had a name which came before "Dassault-Mikoyan Engineering" in the mod load order, which is easily, if inelegantly, ensured by naming my mod something beginning with "$D".

But, if I then want DME's fantastic strike craft to not derp around doing nothing for two minutes waiting for their missiles to regenerate rather than landing back on the carrier, I would need to make duplicate .ship and .hull entries (DME instituted its strike-craft weapons in both places), but I would also need to ensure that those are loaded from a mod which comes alphabetically later than "Dassault-Mikoyan Engineering" in the mod load order, which would have to be a separate mod.

Just some findings worth knowing, probably. This might help someone sort out mod incompatibilities, and it very much makes me yearn for end-user-definable mod load orders.

----

All of those findings I just wrote are in fact true as far as I can tell; however, as Xenoargh pointed out much earlier, it is far simpler to use a "replace:[]," tag in mod_info.json, and I am an idiot for not figuring that out earlier.

29
Mods / Re: [0.9.1a] Shadowy Broker (v0.3.6 - 2020/03/08)
« on: March 30, 2020, 11:53:20 AM »
Is there any chance you would make the Shadowy Broker's fee configurable?

I blew 15K before I realized he was charging me 5,000 credits and only searching the local system because he defaults to 0LY radius, and then I blew another 5K when I did a long-range search but forgot where he suggested that I sell the goods I had just bought, and he never even bothered to write it down anywhere!

Also he tried to suggest I buy in a pirate port in a system with a neutron star, which I didn't realize, and that... Led to a series of escalating poor decisions that wound up with me having to abandon a save.

That was not 40,000 credits worth of service. Also, I haven't noticed any difference in the system bars.

Frankly, all he's doing is saving me two hours of work searching the trade routes and running the math. But the thing is, I command a ship - a fleet of ships. On those ships are computers. Manning those computers are subordinates.

I shouldn't have to pay for that at all, frankly, I should tell my number one to have the quartermaster look for potential profitable freelance trades. So I'd like to be able to set the fee down to something more reasonable, like 500 credits.

What would be worth paying for is if the Shadowy Broker could just conjure a bar-style trade mission on-demand. 5,000 credits to grease the right wheels, make the right connections, some for himself, and then "here's a job that isn't open for just anyone. Take it or leave it, but, I found a guy - you don't need to know who, they don't wanna know you - who needs this stuff moved to this place by X time. Get it done, and here's the pay."

Also, perhaps a parameter for the Shadow Broker to not suggest trades involving hostile factions? It's one thing to trade on the black market of a place I can land at, it's another thing for the Broker to suggest a trade which sends me into the jaws of a gigantic Luddic Path fleet. Okay, nevermind that, I misunderstood the function of 'Approach Lawfully/Lawlessly'. I thought 'lawless approach' meant "I don't mind trading illegal goods/selling the black market," not "send me somewhere I'd have to either sneak or shoot my way into port".

Nope! Nevermind the Nevermind! https://imgur.com/a/788x80E It's still sending me to Soul, a Luddic Path world, and if I fly into that system I'm gonna get dogpiled by approximately thirty ships.

30
Modding / Re: [0.9.1a] Relaxed Logistics.
« on: July 20, 2019, 03:39:14 PM »
It is not that simple.

First, you must make a mod with the appropriate full lines in a hull_mods.csv in the appropriate folder; Yourmod/data/logistics

You'll have to add the LOGISTICS tag to the uiTags cell in the csv, but that will only matter for the shipyard UI! It won't actually change the hullmod to be a Logistics hullmod, it'll only make it be treated as such in the shipyard.

Second, you must also copy the relevant hullmod.java to that folder as well! This may even require that you crank open starfarer.api.zip and get at the files that were baked-in to Starsector!

Then you'll have to have the right gaggle of Imports at the top. Importing a class you don't use won't matter, so for safety's sake just make sure that all of the following lines appear, and if they don't, copy them. Here's all the lines you need, or may need:

Code
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import com.fs.starfarer.api.impl.campaign.ids.Stats;
import com.fs.starfarer.api.combat.BaseHullMod;

THEN

There will be a line which begins "Public Class". It will look something like this:

Code
public class SolarShielding extends BaseHullMod {
...
}

You're going to want to change that so that instead of "extends BaseHullMod" it "extends BaseLogisticsHullMod"

And that should let you reclassify a non-Logistics hullmod to a Logistics hullmod.

Pages: 1 [2] 3