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)

Pages: 1 ... 528 529 [530] 531 532 ... 706

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7935 on: September 08, 2021, 10:23:43 AM »

How do I tweak an item to only boost production to only a single supplied commodity of an industry? Say, I want the special item to only increase supply of Metals from a Refining, instead of increasing both Metals and Transplutonics production.

If you look in the ItemEffectsRepo class you should find some examples of similar things.

About DamageListener...seems that if hit by a beam, the damage would be unreasonable....

Hmm? I'm not sure I understand what the question is here, if there is one. AFAIK it would reportDamageApplied() every beam tick.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7936 on: September 08, 2021, 06:11:03 PM »

Hmm? I'm not sure I understand what the question is here, if there is one. AFAIK it would reportDamageApplied() every beam tick.
So while I get the damage from result, beam damage seems to be much more than other damage...
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7937 on: September 08, 2021, 06:18:08 PM »

Hmm - this sort of thing in a hullmod:
Code
@Override
public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
ship.addListener(new DamageListener() {
public void reportDamageApplied(Object source, CombatEntityAPI target, ApplyDamageResultAPI result) {
System.out.println(result.getDamageToHull());
System.out.println(result.getTotalDamageToArmor());
}
});
}
Seems to produce as-expected results.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7938 on: September 08, 2021, 06:43:22 PM »

Hmm - this sort of thing in a hullmod:
Code
@Override
public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
ship.addListener(new DamageListener() {
public void reportDamageApplied(Object source, CombatEntityAPI target, ApplyDamageResultAPI result) {
System.out.println(result.getDamageToHull());
System.out.println(result.getTotalDamageToArmor());
}
});
}
Seems to produce as-expected results.
Oh...seems that there are some struncture problems in my code which would multiple the damage...Thanks for explanation :'(
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7939 on: September 08, 2021, 06:57:50 PM »

No problem, glad you figured it out!
Logged

theDragn

  • Captain
  • ****
  • Posts: 305
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7940 on: September 08, 2021, 08:19:11 PM »

What do the MOVEMENT_DEST and REACHED_WAYPOINT ship AI flags mean? I'm working on a toggleable long-range travel drive system, and need some way to figure out if the ship AI is close to a place it wants to stop.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7941 on: September 08, 2021, 08:32:40 PM »

What do the MOVEMENT_DEST and REACHED_WAYPOINT ship AI flags mean? I'm working on a toggleable long-range travel drive system, and need some way to figure out if the ship AI is close to a place it wants to stop.
MOVEMENT_DEST iirc gets set to a Vector2f with the location of whatever task the ship is currently assigned. REACHED_WAYPOINT is... not anything meaningful right now and is generally not set.
Logged

NuclearStudent

  • Ensign
  • *
  • Posts: 20
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7942 on: September 09, 2021, 01:55:14 PM »

Hi! I'm new to the forum.

Where is GroundRaidObjectivePlugin in the API/scripts? GroundRaidTargetPickerDelegate, losses, and a lot of other scripts refer to it, but I haven't a devil of a clue where it is.

For reference, what I'm trying to implement is a hullmod that adds a 200 ground support per 100 marines instead of merely 1 support 1 marine.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7943 on: September 09, 2021, 05:56:49 PM »

Hi! I'm new to the forum.

Where is GroundRaidObjectivePlugin in the API/scripts? GroundRaidTargetPickerDelegate, losses, and a lot of other scripts refer to it, but I haven't a devil of a clue where it is.

For reference, what I'm trying to implement is a hullmod that adds a 200 ground support per 100 marines instead of merely 1 support 1 marine.
For the plugins themselves (crossposting from Discord), search for extends BaseGroundRaidObjectivePluginImpl in the API to find the different implementations. The GroundRaidObjectivePlugin interface itself is at com.fs.starfarer.api.impl.campaign.graid.

On the hullmod idea, I'm not actually sure it's possible to inject a ground support bonus that exceeds the marine count, without modifying MarketCMD...
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7944 on: September 11, 2021, 06:24:00 PM »

Is there any way to make a weapon  deco render BENEATH engines?  :'(
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7945 on: September 11, 2021, 11:27:30 PM »

When creating a fleet with a DelayedFleetEncounter (or some other hub mission), can I make the fleet scale to approximate a certain fraction of the player fleet's size/strength (e.g. "75% as strong as player")?

EDIT: Hmm, seems I can try estimating the desired size myself and using triggerSetFleetSizeFraction.
« Last Edit: September 11, 2021, 11:34:18 PM by Histidine »
Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7946 on: September 12, 2021, 08:58:39 AM »

is there a way to determine the amount of currently installed vents and capacitors in the refit dialog in applyEffectsBeforeShipCreation? it appears that one of the calls to applyEffectsAfterShipCreation has the correct amount on the ship variant, but every other call to applyEffectsBeforeShipCreation and applyEffectsAfterShipCreation has the amount that is installed on the ship variant before the refit is opened.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7947 on: September 12, 2021, 11:09:46 AM »

Is there any way to make a weapon  deco render BENEATH engines?  :'(

Hmm, I don't *think* so (and some brief checking doesn't turn up anything), though not quite 100% sure.

When creating a fleet with a DelayedFleetEncounter (or some other hub mission), can I make the fleet scale to approximate a certain fraction of the player fleet's size/strength (e.g. "75% as strong as player")?

EDIT: Hmm, seems I can try estimating the desired size myself and using triggerSetFleetSizeFraction.

Right, something like that would probably be the easiest way to go. For clarity, that fraction would be a fraction of the "maximum possible" fleet size (in fleet points) for that faction, given the hulls it has access to. You can get this value using faction.getApproximateMaxFPPerFleet().

Though, of course, "strength relative to the player's fleet" also involves officers, ship quality, and s-mods...


is there a way to determine the amount of currently installed vents and capacitors in the refit dialog in applyEffectsBeforeShipCreation? it appears that one of the calls to applyEffectsAfterShipCreation has the correct amount on the ship variant, but every other call to applyEffectsBeforeShipCreation and applyEffectsAfterShipCreation has the amount that is installed on the ship variant before the refit is opened.

I'm not sure what you're seeing, but something like:
Code
if (stats.getVariant() != null) {
stats.getHullBonus().modifyFlat(id, stats.getVariant().getNumFluxVents());
}
In applyEffectsBeforeShipCreation() seems to modify hull integrity by the correct number.

Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7948 on: September 12, 2021, 03:39:46 PM »

Is there any way to make a weapon  deco render BENEATH engines?  :'(

Hmm, I don't *think* so (and some brief checking doesn't turn up anything), though not quite 100% sure.

When creating a fleet with a DelayedFleetEncounter (or some other hub mission), can I make the fleet scale to approximate a certain fraction of the player fleet's size/strength (e.g. "75% as strong as player")?

EDIT: Hmm, seems I can try estimating the desired size myself and using triggerSetFleetSizeFraction.

Right, something like that would probably be the easiest way to go. For clarity, that fraction would be a fraction of the "maximum possible" fleet size (in fleet points) for that faction, given the hulls it has access to. You can get this value using faction.getApproximateMaxFPPerFleet().

Though, of course, "strength relative to the player's fleet" also involves officers, ship quality, and s-mods...


is there a way to determine the amount of currently installed vents and capacitors in the refit dialog in applyEffectsBeforeShipCreation? it appears that one of the calls to applyEffectsAfterShipCreation has the correct amount on the ship variant, but every other call to applyEffectsBeforeShipCreation and applyEffectsAfterShipCreation has the amount that is installed on the ship variant before the refit is opened.

I'm not sure what you're seeing, but something like:
Code
if (stats.getVariant() != null) {
stats.getHullBonus().modifyFlat(id, stats.getVariant().getNumFluxVents());
}
In applyEffectsBeforeShipCreation() seems to modify hull integrity by the correct number.

the way i am using it is:

Code
    @Override
    public void applyAugmentToStats(FleetMemberAPI fm, MutableShipStatsAPI stats, float quality, String id) {
        int numCapsStats = stats.getVariant().getNumFluxCapacitors();
        int numVentsStats = stats.getVariant().getNumFluxVents();

        ExtraSystemHM.log.info(String.format("[%s] stats caps %s vents %s", this.getKey(), numCapsStats, numVentsStats));

        int maxCaps = (int) fm.getFleetCommander().getStats().getMaxCapacitorsBonus().computeEffective(MAX_FLUX_EQUIPMENT.get(fm.getHullSpec().getHullSize()));
        int maxVents = (int) fm.getFleetCommander().getStats().getMaxVentsBonus().computeEffective(MAX_FLUX_EQUIPMENT.get(fm.getHullSpec().getHullSize()));

        int crReduction = 0;
        if(numCapsStats > maxCaps / 2) {
            crReduction += numCapsStats - (maxCaps / 2);
        }

        if(numVentsStats > maxVents / 2) {
            crReduction += numVentsStats - (maxVents / 2);
        }

        if(crReduction > 0) {
            stats.getMaxCombatReadiness().modifyFlat(this.getName(), -crReduction / 100f, this.getName());
        }
    }

code is intended to reduce CR by 1 point for every capacitor and vent installed over half of their respective maximums.
upon opening the ship in refit, i see the below logs

Code
681716 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681716 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681717 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681719 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681719 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681720 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681721 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681721 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681722 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681723 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681755 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681757 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681758 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681758 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681761 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681761 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681762 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681763 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681763 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681764 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681766 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681770 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681771 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681772 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681773 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681774 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
681774 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14

when changing the vents to 15, i see the following
Code
750069 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750069 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750069 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750071 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750071 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750072 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750074 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750074 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750075 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750076 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 15
750104 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 15
750107 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750107 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750107 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750109 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750109 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750110 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750111 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750111 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750112 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750113 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 15
750118 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 15
750119 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750119 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750120 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750120 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14
750121 [Thread-3] INFO  extrasystemreloaded.hullmods.ExtraSystemHM  - [PlasmaCatalyst] stats caps 0 vents 14

to me it seems like certain stats objects are used for certain objects inside the refit dialog, so reducing the CR according to the current number of vents and capacitors without switching to/from another ship doesn't work properly for the displayed CR in the refit dialog. once exiting the refit dialog it applies correctly though, so more of a minor issue than an actual bug.
Logged

Great Wound

  • Captain
  • ****
  • Posts: 268
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7949 on: September 14, 2021, 07:08:52 AM »

Got inspired to pull an old hullmod out of mothball. It still doesn't work, feedback appreciated:

Spoiler
Code
	public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
if (stats.getVariant().getSMods().contains("ordstore")) {

stats.getDynamic().getMod(Stats.SMALL_BALLISTIC_MOD).modifyFlat(id, -1f);
stats.getDynamic().getMod(Stats.MEDIUM_BALLISTIC_MOD).modifyFlat(id, -2f);
stats.getDynamic().getMod(Stats.LARGE_BALLISTIC_MOD).modifyFlat(id, -4f);

stats.getCargoMod().modifyMult(id, 0.75f);

} else {

stats.getDynamic().getMod(Stats.SMALL_BALLISTIC_MOD).modifyFlat(id, -0f);
stats.getDynamic().getMod(Stats.MEDIUM_BALLISTIC_MOD).modifyFlat(id, -1f);
stats.getDynamic().getMod(Stats.LARGE_BALLISTIC_MOD).modifyFlat(id, -2f);

stats.getCargoMod().modifyMult(id, 0.5f);
}

}
[close]

Basically, if the mod is not built-in the Cargo and Ballistic mods apply as intended (yay!),
But when it is built in only the CargoMod updates, the ballistic mod doesn't update (nay!).

The IF values for the Ballistic mods do apply if the referenced hullmod is built in before applying this one. e.g. if I referenced turretgyros and had that built in as an SMod prior to applying this then the IF value would be used.
(Or the event of self referencing, the player can install it as an Smod, save, exit and reload to use the correct value)

So really, what I need is some way to force-update/reapply the hullmod after it is has been installed as an SMod.


I'm guessing we're back in "unsupported by game" territory as you outlined previously:

The other thing to get around somehow is the player installing the hullmod, using the extra OP, and then removing it.  Generally speaking the game assumes that hullmods that modify OP costs are non-removable, and breaking that assumption puts it into "unsupported by the game" territory. Not to say it couldn't be made to work somehow, perhaps!

The new plan was to have it modify the weapon OP only when the hullmod was built in (the else values are currently for testing purposes to check it initially applies). I've got a dirty dirty work around on standby if we can't get this working correctly (Make the OP cost for the hullmod more than any potential gains so you won't see the benefits unless you SMod it).
« Last Edit: September 14, 2021, 07:46:53 AM by Great Wound »
Logged
Pages: 1 ... 528 529 [530] 531 532 ... 706