Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95.1a is out! (12/10/21); Blog post: Hostile Activity (09/01/22)

Pages: 1 ... 423 424 [425] 426 427 ... 616

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1360258 times)

ShadowDragon8685

  • Ensign
  • *
  • Posts: 45
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6360 on: May 07, 2020, 05:40:26 AM »

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.)
« Last Edit: May 07, 2020, 05:43:39 AM by ShadowDragon8685 »
Logged

ShadowDragon8685

  • Ensign
  • *
  • Posts: 45
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6361 on: May 07, 2020, 05:42:44 AM »

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.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6362 on: May 07, 2020, 08:20:34 AM »

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...
Logged

ShadowDragon8685

  • Ensign
  • *
  • Posts: 45
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6363 on: May 07, 2020, 08:53:21 AM »

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...
« Last Edit: May 07, 2020, 08:55:19 AM by ShadowDragon8685 »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6364 on: May 07, 2020, 09:19:47 AM »

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.)
Logged

ctuncks

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6365 on: May 07, 2020, 09:48:38 AM »

I've been curious about this one, how does accuracy actually work?

I Know it's made up of Min Spread, Max Spread, spread/shot and spread decay/sec, but the mechanics explained by a wiki I read don't seem to add up.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6366 on: May 07, 2020, 09:51:23 AM »

You mean here?
https://starsector.fandom.com/wiki/Weapon_data.csv

That seems accurate to me; what's not adding up?
Logged

ShadowDragon8685

  • Ensign
  • *
  • Posts: 45
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6367 on: May 07, 2020, 10:55:11 AM »

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."
Logged

boggled

  • Admiral
  • *****
  • Posts: 804
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6368 on: May 07, 2020, 01:43:05 PM »

I'm trying to add an option in my mod settings file to hide/disable a custom ship in my mod. I tried modifying the hints and tags on the ShipHullSpecAPI, but that doesn't seem to do anything. It is possible to do this?
Logged

ctuncks

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6369 on: May 07, 2020, 02:34:53 PM »

You mean here?
https://starsector.fandom.com/wiki/Weapon_data.csv

That seems accurate to me; what's not adding up?

Yes from there, perhaps it's just the way my brain compiles it all together but here's how it looks to me.

1. Min Spread is the minimum amount of spread in degrees that a shot can deviate.
2. Max Spread is the maximum amount of spread in degrees that a shot can deviate.
3. Spread/shot is the number of extra degrees added to Min Spread each shot. This value can accumulate up to the Max Spread then increase no further.
4. A weapon will fire with degrees of deviation equal to Min Spread + Accumulated Spread/Shot
5. When the weapon is not firing spread decay/sec will subtract it's value from the Accumulated Spread/Shot value until it hits zero or the weapon resumes firing.

From my perspective of not firing this would mean that a weapon like the Arbelest Autocannon despite it's accuracy rating to actually have perfect aim in the hands of the AI since it has a chargedown of 1 second which would be more then enough to clear it's accumulated Spread/shot. [My perspective of actively firing is when there's actually stuff coming out of the barrel]

I know this can't be true since I've seen the AI fire the weapon and seen shots deviate.

I suppose as a follow-up question to help answer my previous one does chargedown count as part of the firing cycle for purpose of spread decay/sec? As in does spread decay/sec not kick in until after charagedown is cleared?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6370 on: May 07, 2020, 02:47:01 PM »

I'm trying to add an option in my mod settings file to hide/disable a custom ship in my mod. I tried modifying the hints and tags on the ShipHullSpecAPI, but that doesn't seem to do anything. It is possible to do this?

Have you added the HIDE_IN_CODEX hint for it in ship_data.csv? Depends on what you mean by hide/disable, though, I'm not sure exactly what that means to you.

I suppose as a follow-up question to help answer my previous one does chargedown count as part of the firing cycle for purpose of spread decay/sec? As in does spread decay/sec not kick in until after charagedown is cleared?

Ah, gotcha. Yeah, this is correct - another way to think of it is spread reduces only when the weapon could fire, but isn't.
Logged

ctuncks

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6371 on: May 07, 2020, 02:55:26 PM »

Quote
Ah, gotcha. Yeah, this is correct - another way to think of it is spread reduces only when the weapon could fire, but isn't.

Thanks for that, makes it alot clearer. Kinda of wish the wiki had stated that. Intuitively (at least for me) it's easy to think of something not firing the moment shells/bullets stop coming out of the barrel.
Logged

ShadowDragon8685

  • Ensign
  • *
  • Posts: 45
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6372 on: May 07, 2020, 03:36:45 PM »

Alex, you're amazing. I have another fiddly problem, though:

How does

Code
CORONA_EFFECT_MULT

really work?

Because I changed it as such in my Sundiving mod, yonks and yonks ago;

Code
public static final float CORONA_EFFECT_REDUCTION = 0.0f;
...
stats.getDynamic().getStat(Stats.CORONA_EFFECT_MULT).modifyMult(id, CORONA_EFFECT_REDUCTION);

Then there's this, in StarCoronaTerrainPlugin.java:

Code
float resistance = member.getStats().getDynamic().getValue(Stats.CORONA_EFFECT_MULT);

With a 0 in CORONA_EFFECT_MULT from the Solar Shielding mod when installed, that means that

Code
float adjustedLossMult = (0f + params.crLossMult * intensity * resistance * lossMult * CR_LOSS_MULT_GLOBAL);

should have a 0 for resistance, thus yielding an adjustedLossMult of 0.

And yet, as observed by myself and others, when venturing into a sun even with every ship possessing Solar Shielding, supplies evaporate.

I'm trying to figure out why this is happening and how to fix it.

I think it has to do with this, from StarCoronaTerrainPlugin:
Code
float loss = (-1f * recoveryRate + -1f * lossRate * adjustedLossMult) * days * 0.01f;
Is that correct?

Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6373 on: May 07, 2020, 03:57:32 PM »

Yeah basically what CORONA_EFFECT_MULT == 0 does is prevent the ship from losing CR while in corona, but not because it's not losing it - rather, because the repair rate matches the loss rate. I've got a TODO item to look at it at some point, since, yeah, the way this works right now makes Solar Shielding rather less good than what it looks like at first glance.
Logged

ShadowDragon8685

  • Ensign
  • *
  • Posts: 45
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6374 on: May 07, 2020, 04:14:28 PM »

Yeah basically what CORONA_EFFECT_MULT == 0 does is prevent the ship from losing CR while in corona, but not because it's not losing it - rather, because the repair rate matches the loss rate. I've got a TODO item to look at it at some point, since, yeah, the way this works right now makes Solar Shielding rather less good than what it looks like at first glance.

Oooof. So setting CORONA_EFFECT_MULT to 0 actually makes supplies evaporate worse because instead of taking more damage than can be repaired at once, it's losing and fully repairing at every tick, and every tick consumes 1u of supply? At least, that's my current hypothesis?

I'm trying to figure out a way to fix that in the hullmod as-is, but... That looks as if it may not be possible without replacing StarCoronaTerrainPlugin?
Logged
Pages: 1 ... 423 424 [425] 426 427 ... 616