Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 509 510 [511] 512 513 ... 710

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

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7650 on: July 02, 2021, 01:05:20 AM »

If you add the ALWAYS_PANIC ship hint that should achieve a similar if not identical result.
Is there a way to add ship hints via hullmod?


Edit: A separate question: Are beams treated as a separate weapon to energy weapons, or as a subset of them?

If I wanted to half all energy weapon's flux cost, would I need to modify both  getBeamWeaponFluxCostMult and getEnergyWeaponFluxCostMult, or just the energy one?

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7651 on: July 02, 2021, 09:09:41 AM »

Is there a way to add ship hints via hullmod?

I don't think so.

Edit: A separate question: Are beams treated as a separate weapon to energy weapons, or as a subset of them?

If I wanted to half all energy weapon's flux cost, would I need to modify both  getBeamWeaponFluxCostMult and getEnergyWeaponFluxCostMult, or just the energy one?

That would actually be pretty easy to test - set the getEnergyWeaponFluxCostMult() to zero and see if beams still generate flux.
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7652 on: July 02, 2021, 09:54:36 AM »

That would actually be pretty easy to test - set the getEnergyWeaponFluxCostMult() to zero and see if beams still generate flux.
I... am dumb.
I was thinking of all these complex ways to test with various logging that I don't even know how to instigate, and then I could just do this.


Another another question (sorry):
What's the difference between ModifyPercent and ModifyMult (other than one taking a percentage and the other a float), and what's the order of operation for ModifyPercent/Mult/Flat?

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7653 on: July 03, 2021, 02:26:24 PM »

Another another question (sorry):
What's the difference between ModifyPercent and ModifyMult (other than one taking a percentage and the other a float), and what's the order of operation for ModifyPercent/Mult/Flat?

It's: (base + base * (percent/100) + flat) * mult
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3023
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7655 on: July 04, 2021, 08:52:52 AM »

How can you tell if a ship module is still attached or not?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7656 on: July 04, 2021, 09:41:56 AM »

How can you tell if a ship module is still attached or not?

module.getStationSlot() != null
Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7657 on: July 04, 2021, 12:59:25 PM »

i have a hullmod that depends on some FleetMemberAPI values, and to get that i would usually use MutableShipStatsAPI.getFleetMember(). when i added a "affectsOPCosts" override set to true, the method applyEffectsBeforeShipCreation was called twice, and the second time has a MutableShipStatsAPI that doesn't have a fleet member assigned to it. (as a side note: i'm pretty sure this MutableShipStatsAPI object is the one that you can find under ShipVariantAPI.getStatsForOpCosts())

is there a way to easily get the fleetmember that doesn't involve looping through every single ship in a fleet and its variant and all of its modules' variants to look for a specific MutableShipStatsAPI object? if i have the hullmod on a lot of ships (tried with 8 ) the game noticably hitches whenever these hullmods run applyEffectsBeforeShipCreation because of the method.

this is what i needed to do as a result, and what also causes the hitching

Hmm - have you considered just bailing out if stats.getFleetMember() and stats.getEntity() both return null? IIRC that would only happen in some edge cases and it's more of a safety precaution to check for this rather than a case where it's required for things to work.


i can't bail out here, unfortunately. the member data that i need determines whether to reduce OP costs of weapons or not, and the second call to "applyEffectsBeforeShipCreation" only happens if "affectsOPCosts" on the hullmod returns true. to help illustrate this i added some logging which shows that the first call doesn't have a stats.getFleetMember or a stats.getEntity return value, so it must loop:

Spoiler
Code
568942 [Thread-3] INFO  extrasystemreloaded.util.FleetMemberUtils  - finding member for stats
568942 [Thread-3] INFO  extrasystemreloaded.util.FleetMemberUtils  - must loop for variant stats!
568942 [Thread-3] INFO  extrasystemreloaded.util.FleetMemberUtils  - finding member for stats
568942 [Thread-3] INFO  extrasystemreloaded.util.FleetMemberUtils  - was in a fleet member
[close]

it seems the hitching isn't an issue any more, oddly enough, as i gave the upgrade to around 15 ships and didn't notice it while jumping around the market. the hitching was the main reason why i brought up this issue, however i still think it's weird the first stats object from the first call never has the fleet member set
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7658 on: July 04, 2021, 01:25:53 PM »

Hmm, you're right, there looks to be an issue there. I'll make a note to have a look at some point; unfortunately it seems like something I'd have to change some API method signatures to make work properly.
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7659 on: July 04, 2021, 09:05:57 PM »

Is there any API hook to return what ship is selected/if a ship is selected in the command UI?
(the one where you can issue orders/retreat..not sure if that's the right name for it)

There isn't, no. (Command UI is about right; I'm never quite sure what to call it, myself.)

argh..is this something that could possibly be added to the API in the future?
actually, even if it were possible, it probably wouldn't work for what I want
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7660 on: July 05, 2021, 09:39:30 AM »

I'm getting a weird "Inconsistent constant value type" error with this:
Code
package data.scripts;

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.campaign.ids.Stats;

public class YunruHeavyMissileIntegration extends BaseHullMod {

public static final float YUNRU_COST_REDUCTION  = 10;

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

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

@Override
public boolean affectsOPCosts() {
return true;
}

}
What makes it weird is that it's identical to Heavy Ballistics Integration, just switched to missiles, with nothing else touched.

michail

  • Lieutenant
  • **
  • Posts: 88
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7661 on: July 05, 2021, 09:49:54 AM »

I'm getting a weird "Inconsistent constant value type" error with this:
<snip>
What makes it weird is that it's identical to Heavy Ballistics Integration, just switched to missiles, with nothing else touched.

Maybe your compiler is more picky than the one used to compile the API jar? Try "10.0f" for maximum pedantry.
Logged

Tecrys

  • Admiral
  • *****
  • Posts: 596
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7663 on: July 06, 2021, 11:08:52 AM »

Hi!

I need to get rid of weapon arcs of specific weapons in a EveryFrameWeaponEffectPlugin.
I mean the drawn weapon arc not the arcs of weapon mounts, in case that isn't clear.
Can anyone help me with this, in the best case with a code example?

Thanks in advance!
« Last Edit: July 06, 2021, 11:18:58 AM by Tecrys »
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7664 on: July 06, 2021, 12:46:00 PM »

Ah, as far as I know, that's not possible. If it's a proper weapon that can be fired, the arcs are just a UI thing.
Logged
Pages: 1 ... 509 510 [511] 512 513 ... 710