Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 315 316 [317] 318 319 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4740 on: July 26, 2019, 09:27:13 AM »

Complaint
I recently had a bug which resulted from ActionStage's enoughMadeIt() check not taking into account whether the fleet was spawned with ignoreMarketFleetSizeMult, when calculating how many ships made it vs. how many should have. This means that a sufficiently high fleet size mult on the origin market will cause the stage to fail even if no fleet took any losses.

It's pretty straightforward to add my own check in derived classes, but might be good for the vanilla code to do it as well. Perhaps mark the fleet as having ignored size mult as a memory flag, then have enoughMadeIt() check for that?

Ahh, that's a really good point. Added a $spawnFPMult to fleet memory; this is set in FleetFactoryV3 and is the number-of-ships multiplier. So in enoughMadeIt() that's used instead of checking the market's value.

Quick update on this: changed $spawnFPMult to be the ratio of actual fleet points in the spawned fleet to the total points specified in the FleetParamsV3.

That way it also covers cases like asking for too many points, i.e. when the fleet has to be cut down to fit in the 30 ship limit, or even just when the total number of points doesn't quite match the asked-for number because, say, there's 2 points left and no ship that costs that little.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4741 on: July 26, 2019, 08:22:58 PM »

Thanks for the help and the work, Alex :)

How long does the "Recent trade/events" modification to commodity availability last?
Is there an API method to apply/modify the recent trade availability bonus to a market? (Searched for "Recent trade/events" in API but couldn't find anything)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4742 on: July 26, 2019, 09:02:34 PM »

How long does the "Recent trade/events" modification to commodity availability last?
Is there an API method to apply/modify the recent trade availability bonus to a market? (Searched for "Recent trade/events" in API but couldn't find anything)

30 days, see: BaseSubmarketPlugin.TRADE_IMPACT_DAYS

Also see CommodityOnMarketAPI:
addTradeMod()
addTradeModPlus()
addTradeModMinus()
getTradeMod()
getTradeModPlus()
getTradeModMinus()

The duration is passed in as a parameter to those methods.

The Plus and Minus versions can only ever increase (or decrease, for Minus) the "available" units. It's a bit dodgy, though, I forget exactly the circumstances that cause it, but using *Minus can lead to profitable buy/sell cycles (i.e. infinite money), so I'd say probably don't use that. AFAIK the other (i.e. not *Minus) methods work fine.
Logged

Ross

  • Ensign
  • *
  • Posts: 4
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4743 on: July 30, 2019, 04:21:26 PM »

Is there a way to get what key/button is bound for a certain action in-game? For example, if I wanted to get the "strafe left" key?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4744 on: July 30, 2019, 09:45:25 PM »

Sort of.

Global.getSettings().getControlStringForEnumName(<string>)

However, the enum in question is not exposed in the API. Here's the subset for ship commands:

Spoiler
SHIP_FIRE("Fire selected weapon group", Category.FLIGHT),
      SHIP_SHIELDS("Toggle shields or phase cloak", Category.FLIGHT),
      //SHIP_SHIELDS_LOCK("Lock omni-directional shields to a relative facing", Category.FLIGHT),
      SHIP_USE_SYSTEM("Use ship's active system", Category.FLIGHT),
      SHIP_VENT_FLUX("Vent flux", Category.FLIGHT),
      SHIP_HOLD_FIRE("Hold fire", Category.FLIGHT),
      SHIP_PULL_BACK_FIGHTERS("Toggle fighter engage/regroup", Category.FLIGHT),
      SHIP_ACCELERATE("Accelerate", Category.FLIGHT),
      SHIP_ACCELERATE_BACKWARDS("Accelerate backwards", Category.FLIGHT),
      SHIP_DECELERATE("Decelerate", Category.FLIGHT),
      SHIP_TURN_LEFT("Turn left", Category.FLIGHT),
      SHIP_TURN_RIGHT("Turn right", Category.FLIGHT),
      SHIP_STRAFE_KEY("Strafe and turn to cursor", Category.FLIGHT),
      SHIP_STRAFE_LEFT_NOTURN("Strafe left", Category.FLIGHT),
      SHIP_STRAFE_RIGHT_NOTURN("Strafe right", Category.FLIGHT),
      SHIP_SELECT_GROUP_1("Select weapon group 1", Category.FLIGHT),
      SHIP_SELECT_GROUP_2("Select weapon group 2", Category.FLIGHT),
      SHIP_SELECT_GROUP_3("Select weapon group 3", Category.FLIGHT),
      SHIP_SELECT_GROUP_4("Select weapon group 4", Category.FLIGHT),
      SHIP_SELECT_GROUP_5("Select weapon group 5", Category.FLIGHT),
      SHIP_TOGGLE_GROUP_1("Toggle autofire for weapon group 1", Category.FLIGHT),
      SHIP_TOGGLE_GROUP_2("Toggle autofire for weapon group 2", Category.FLIGHT),
      SHIP_TOGGLE_GROUP_3("Toggle autofire for weapon group 3", Category.FLIGHT),
      SHIP_TOGGLE_GROUP_4("Toggle autofire for weapon group 4", Category.FLIGHT),
      SHIP_TOGGLE_GROUP_5("Toggle autofire for weapon group 5", Category.FLIGHT),
      SHIP_TARGET_SHIP("Target ship/clear target", Category.FLIGHT),
      SHIP_TOGGLE_XPAN_MODE("Switch view to target", Category.FLIGHT),
      SHIP_SHOW_WARROOM("Show map & command UI", Category.FLIGHT, Category.C2, Category.C2_WAYPOINT, Category.C2_FRIENDLY, Category.C2_HOSTILE),
      SHIP_TOGGLE_WEAPON_ARCS("Toggle weapon arcs", Category.FLIGHT),
      SHIP_RETREAT("Initiate travel drive to retreat", Category.FLIGHT),
      SHIP_RAISE_FLUX("Raise flux levels", Category.UNCONFIGURABLE),
[close]
Logged

Ross

  • Ensign
  • *
  • Posts: 4
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4745 on: July 31, 2019, 04:17:34 AM »

Cool, thanks!

And it looks like I can use Keyboard.getKeyIndex() to get the integer key code from the control string. (In case anyone else is trying the same thing I am.)
« Last Edit: July 31, 2019, 04:41:16 AM by Ross »
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4746 on: August 01, 2019, 04:26:50 AM »

Calling market.setFreePort(true) on a market with free port boolean set to false but having the Free Port market condition, still adds a second Free Port condition >:(

I suppose someone should yell at the modders to fix their market generation code (to not add the condition without applying the boolean), but I doubt we can count on them actually doing so. Meh, I'll just add the check for the condition to my own code.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4747 on: August 01, 2019, 08:22:05 AM »

Argh. Yeah, it's not a condition that ought to be added manually, just via setFreePort(). Made it not add duplicates, although that doesn't fix the underlying problem of "adding the condition manually gets it out of sync with the boolean so don't do that"...
Logged

Harmful Mechanic

  • Admiral
  • *****
  • Posts: 1340
  • On break.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4748 on: August 01, 2019, 04:21:37 PM »

I suppose someone should yell at the modders to fix their market generation code (to not add the condition without applying the boolean), but I doubt we can count on them actually doing so.

Well, this is the first I'm hearing about it, so I guess you'll never know.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4749 on: August 02, 2019, 11:54:00 PM »

When I create a SectorEntityToken with LocationAPI.createToken(), then assign it an orbit with setCircularOrbit, it remains stationary (I can tell from the things I put in orbit around the token). How should I work around this?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4750 on: August 03, 2019, 02:50:03 PM »

I think the missing step is to location.addEntity(token), which will make sure the orbit's advance() method gets called. The createToken method does not actually add it to the location as it's not required for many of the uses.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1727
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4751 on: August 04, 2019, 04:13:55 PM »

Am I correct in thinking that these are the only methods available for dynamically adjusting the specs of a ship system?
Code
    @Override
    public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
        ShipSystemAPI myShipSystem = ship.getSystem();
        myShipSystem.setCooldown((float) Math.PI);
        myShipSystem.setFluxPerSecond((float) Math.E);
        myShipSystem.setFluxPerUse(Float.MAX_VALUE);
    }
I'm trying to adjust ship system values like those, but I was hoping for a way to adjust charge regen rate as well.

Also, is there a better way to get ship system specs than loading ship_systems.csv?
« Last Edit: August 04, 2019, 04:15:55 PM by Sundog »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4752 on: August 05, 2019, 09:53:19 AM »

Correct, yeah.

Made a few additions:
Added to SettingsAPI:
   ShipSystemSpecAPI getShipSystemSpec(String id);
   List<ShipSystemSpecAPI> getAllShipSystemSpecs();
Added a lot of methods to ShipSystemSpecAPI
Logged

Stargazer7x

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4753 on: August 05, 2019, 10:32:47 AM »

How would I go about increasing the maximum amount of random constellations and planets generated in the sector?
I already modified the sector's size and I am not sure if that makes a difference or not, but I would like to use a method that allows more fine tuning if at all possible.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1727
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4754 on: August 05, 2019, 11:04:18 AM »

Many thanks!
Pages: 1 ... 315 316 [317] 318 319 ... 710