Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 230 231 [232] 233 234 ... 711

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

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 #3465 on: July 23, 2017, 10:46:59 PM »

Anybody know how to detect Starsector's memory(I wanna know how my class use memory)?
Logged
My mods


TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3466 on: July 24, 2017, 02:58:03 AM »

Anybody know how to detect Starsector's memory(I wanna know how my class use memory)?

Run Starsector's VM with a memory profiler attached; the JDK comes with one, as do most IDEs.
Logged

Undefined

  • Ensign
  • *
  • Posts: 38
    • View Profile
    • Protector World
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3467 on: July 26, 2017, 05:18:13 AM »

I've been plugging away at my mod and it's all coming along nice but have a couple of questions..
I have decent technical, but limited Java knowledge, which I'm using creating this mod to help me develop.

I'm trying to find somewhere to inject myself into the Surveying process in order to potentially add an additional possible find to interesting planets/conditions so I've created myself a SurveyPlugin Implementation which extends SurveyPluginImpl in order to create a modified getSurveyDataType, figuring it's less than an ideal place but I can call my own function before it returns and use the InteractionDialogAPI to deal with adding a notification. I see that this is called from the static addSurveyDataFor function (which would be better but isn't an option) in Misc using Global.getSettings().getNewPluginInstance("surveyPlugin");
Because of this new instancing my override for getSurveyDataType doesn't seem to be called rather the original is used.
Is there someplace I can set a new instance to use my own Implementation instead or perhaps a better place to do what I'm attempting?
I feel like there probably is a simple way using a CoreCampaignPlugin but I'm missing it.

My second Question seems so simple I must be an idiot not being able to find it myself, but I've created a couple of new commodities, these are not really designed to be sold on the market but used with my own nonsense, however I can't seem to find a way to create a new demand class for them, how would I do this? It looks a bit silly using an existing demand class as they're then price adjusted based on demand.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3468 on: July 26, 2017, 06:13:37 AM »

On the first question, I'd think you'd want to extend SurveyPluginImpl, rather than implement SurveyPlugin; you're basically just wanting to tweak a little bit here and there, right?

On the second question, I would think you'd look at extending com.fs.starfarer.api.impl.campaign.ids.Commodities.

Logged
Please check out my SS projects :)
Xeno's Mod Pack

Undefined

  • Ensign
  • *
  • Posts: 38
    • View Profile
    • Protector World
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3469 on: July 26, 2017, 07:22:21 AM »

Ahh, I am extending SurveyPluginImpl rather than SurveyPlugin, but my class isn't being used, I'm assuming because of the way the static function in Misc is calling for a new SurveyPlugin instance. Though I could be wrong here.

I've added the commodity in that way, but I still get a fatal error due to the commodity not existing, my assumption with this one is that it's because that file simply holds the strings for the commodity but no actual commodity data.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3470 on: July 26, 2017, 07:36:21 AM »

Bear in mind that a lot of things like this require a new game to be started when testing :)

When you say your "class isn't getting used", are you verifying that by printing out to the Log?

And don't forget that Commodities need to be present in the CSV, etc.

Not sure that your approach (using "shadow commodities" to manipulate Stuff) is a great idea; I suspect it'd be easier to write an EveryFrameScript to do Market analysis / changes, if that's what you're after.  Not sure what your business case is here, though; a bit more explanation might be helpful.
« Last Edit: July 26, 2017, 07:45:52 AM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Undefined

  • Ensign
  • *
  • Posts: 38
    • View Profile
    • Protector World
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3471 on: July 26, 2017, 08:26:47 AM »

Yup, my class is very simple, extends SurveyPluginImpl, overrides getSurveyDataType and simply has a log output added. The logging never occurs:

Code
public class ArkSurvey extends SurveyPluginImpl {

public static Logger log = Global.getLogger(ArkSurvey.class);

public String getSurveyDataType(PlanetAPI planet) {

log.info("***ARK*** MY SURVEY GUFF");

-snip for size, same as source-
}

}

regarding the commodities, I didn't explain well I think, they're research material items of various types that are potential drops from combat, I have that all working fine including the trade in categorising them as supplies demand class. I'd like to create my own demand class of "research_materials" which I could then loop through when checking cargo.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24149
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3472 on: July 26, 2017, 09:06:53 AM »

Re: the plugin - you need to tell the game to use it, by pointing to it from settings.json in your mod:
"plugins":{
   "surveyPlugin":"com.fs.starfarer.api.impl.campaign.SurveyPluginImpl",
}

(Replace the class name/package w/ yours.)


Re: commodities, demand class: pick one of your commodities to be the "primary" commodity and use its id as the demand class for all of them. You don't need to define it anywhere else, a demand class is literally just the id of the primary commodity in that class. The price of the other commodities is equal to the base commodity's price, modified by their relative utility. E.G. if the base commodity has utility 1 and another commodity in the class has utility 2, the other commodity will cost double.
Logged

Undefined

  • Ensign
  • *
  • Posts: 38
    • View Profile
    • Protector World
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3473 on: July 26, 2017, 11:07:28 AM »

Wow how foolish of me, I fully forgot about adding plugins to the settings.
Thanks Alex, much appreciated.  :)
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3474 on: July 26, 2017, 11:32:55 AM »

It's totally cool, we've all been there :)
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3475 on: July 27, 2017, 09:47:17 AM »

I'm trying to manipulate the Hyperspace clouds (I'm trying to write a method to get rid of them near JumpHoles).  I tried all sorts of things in HyperSpaceTerrainPlugin, but I didn't find a method that would eliminate them.  Do I need to do that during SectorGen / ProcGen?
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24149
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3476 on: July 27, 2017, 10:03:23 AM »

Not knowing what you tried, it's hard to say why it didn't work. Take a look at NebulaEditor, though - that can be passed in a HyperspaceTerrainPlugin, and is what the game uses to clear hyper clouds in procedurally generated areas.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3477 on: July 27, 2017, 10:25:57 AM »

Aha, I'll take a look at that.  I was going down a dead end trying to check distances against SectorEntityTokens with the activeCells, etc.  ::)
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3478 on: July 27, 2017, 11:40:06 AM »

OK, that was really straightforward!  I wrote a new function in 3 minutes, lol.  Thank you, Alex!

Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24149
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3479 on: July 27, 2017, 11:51:29 AM »

Nice!
Logged
Pages: 1 ... 230 231 [232] 233 234 ... 711