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: Simulator Enhancements (03/13/24)

Author Topic: Help a guy make hullmods/systems  (Read 4873 times)

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Help a guy make hullmods/systems
« on: November 30, 2018, 03:11:56 AM »

I'm trying to make several things and I need assistance.

1) Hullmod that increases repair speed of all ships in fleet (or supplies used for repair) for a dedicated repair ship.
I can make this for a single ship, but I have NO idea how to it for a fleet. Suggestions?

2) Hullmod that reduces the OP cost of a specific fighter

3) Shipsystem that vents flux on activation, but all flux is directed forward, for a big reverse speed boost. Reduces CR
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #1 on: December 03, 2018, 05:40:32 AM »

help?
Logged

Darloth

  • Admiral
  • *****
  • Posts: 592
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #2 on: December 03, 2018, 04:03:11 PM »

A hacky way of doing 1 might be to edit the character's repair speed bonus (the one that the repair skill modifies).

A less hacky way would probably be to either check whether there's a fleet level MutableStat that applies a repair bonus, or, if there isn't, to go through every fleet member and change their per-ship repair speed bonus.

I haven't tried either of them, but I did poke around at the code of other things that does add a repair bonus so they're not completely untenable suggestions, I just haven't actually put more than 15 minutes into working out how well they'd work.
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #3 on: December 04, 2018, 12:57:40 AM »

Those were my thoughts too, and I looked a bit into that code, but I'm not a great coder, so I'm still stumped.
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #4 on: December 04, 2018, 01:02:30 PM »

I have no problem making various boosters, accelerators and jump shipsystems.

But how do I get the ship to go in reverse and vent? Negative speed value? How DOES the game handle going in reverse?
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #5 on: December 07, 2018, 02:34:52 AM »



Logged

Sarissofoi

  • Captain
  • ****
  • Posts: 405
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #6 on: December 07, 2018, 11:06:32 AM »

What about looking at that skill from industry that increase repair speed? Can it be applied to a ship system?

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #7 on: December 08, 2018, 05:23:45 AM »

That would be this:
And I don't think it can be applies to a shipsystem.

Code
	public static final float REPAIR_RATE_BONUS = 50f;

public static class RepairBayA implements CharacterStatsSkillEffect {
public void apply(MutableCharacterStatsAPI stats, String id, float level) {
stats.getRepairRateMult().modifyPercent(id, REPAIR_RATE_BONUS);
}

public void unapply(MutableCharacterStatsAPI stats, String id) {
stats.getRepairRateMult().unmodify(id);
}

public String getEffectDescription(float level) {
return "" + (int) REPAIR_RATE_BONUS + "% faster ship repairs";
}

public String getEffectPerLevelDescription() {
return null;
}

public ScopeDescription getScopeDescription() {
return ScopeDescription.ALL_SHIPS;
}
}

However, if no one can figure out how to make a repair bay work, what about the other two hullmods?
Logged

Obsidian Actual

  • Commander
  • ***
  • Posts: 102
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #8 on: December 08, 2018, 02:10:54 PM »

Just a guess regarding the "Dedicated Repair Ship" hullmod:

Found the java code for the old Monofilament Tow Cable under com.fs.starfarer.api.impl.campaign (TowCable.java).

It'd take quite a bit of work to get rid of the whole "find the slowest fleet member" portions of the code, but the rudimentary stuff? Iterating through each member of your fleet, applying/removing a buff... it's mostly there.

All that remains is to figure out what method to use to modify MutableShipStatsAPI's getRepairRatePercentPerDay() (i.e. modifyMult, modifyFlat, or modifyPercent?)

If nothing else, it's a viable starting point.
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #9 on: December 12, 2018, 02:55:44 AM »

I'll take a look.

What about hullmods under 2) and 3)?
Logged

Darloth

  • Admiral
  • *****
  • Posts: 592
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #10 on: December 12, 2018, 05:33:54 AM »

3) is just the retro drive from Shadowyards' Clade with a few extra bits and pieces, is it not?
Logged

Clockwork Owl

  • Admiral
  • *****
  • Posts: 790
    • View Profile
    • Starsector South Korean Community
Re: Help a guy make hullmods/systems
« Reply #11 on: December 14, 2018, 08:52:22 PM »

2) AFAIK Heavy Ballistic Integration is hardcoded. Check the hullmod that gives you a makeshift flight deck though
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #12 on: December 15, 2018, 02:55:14 AM »

3) is just the retro drive from Shadowyards' Clade with a few extra bits and pieces, is it not?

Hm..yeah, hat should work. Now, what code triggers venting?
Logged

Darloth

  • Admiral
  • *****
  • Posts: 592
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #13 on: December 18, 2018, 02:48:58 PM »

2) AFAIK Heavy Ballistic Integration is hardcoded. Check the hullmod that gives you a makeshift flight deck though

Heavy Ballistics Integration is not especially hardcoded, though if you want a new dynamic stat for a SPECIFIC fighter (instead of all fighters, or bombers, or interceptors, or support fighters, or whatever) then you will have to do some more code.

You -might- be able to iterate through the weapons mounted on a ship via BaseHullMod.applyEffectsAfterShipCreation() but I'm unsure whether that is run on the outfitting screen.  If it's not, then it's pretty useless changing the OP costs in it :)

As a somewhat hacky solution, you could (if you want to be exclusive about it) warn players that any fighter that ISN'T the SpcSnowflake Mk4 will be massively penalized by installing said hullmod, and then just reduce the cost of all fighters if it's installed, and use an override on BaseHullMod.applyEffectsAfterShipCreation() and/or BaseHullMod.applyEffectsToFighterSpawnedByShip() to check whether the fighters are the correct type and nerf them if not, but this does seem rather inelegant.
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Help a guy make hullmods/systems
« Reply #14 on: December 21, 2018, 10:57:20 AM »

Wait..

When I was suggesting more granulartiy and restrictions to fighters (carrier A can only mount fighters A to K, but no L to Z) people kept telling me it's unnecessary because it's can be EASILY done tough a simple hullmod.

Now people are telling me the hullmod is not simple, but requires quite a bit of coding and jury-rigging to even get one working properly?

I have been lied to.
Logged