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 ... 258 259 [260] 261 262 ... 706

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3885 on: May 17, 2018, 10:25:21 PM »

Fair enough, just in this case it doesn't seem like a good idea. Looking through the WeakHashMap javadoc, there are ways to mess this up and (in this case) end up with a memory leak. And since you're already putting it into persistent data...
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 #3886 on: May 18, 2018, 07:37:04 AM »

Fair enough, just in this case it doesn't seem like a good idea. Looking through the WeakHashMap javadoc, there are ways to mess this up and (in this case) end up with a memory leak. And since you're already putting it into persistent data...
hmm, I will have a try to see if it works.
Btw what's the difference between memory and persistent data in saving information
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3887 on: May 18, 2018, 08:59:54 AM »

Btw what's the difference between memory and persistent data in saving information

No real difference. getPersistentData() was just around before I added the memory stuff, which also has other uses.
Logged

Sarissofoi

  • Captain
  • ****
  • Posts: 405
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3888 on: May 18, 2018, 09:20:24 AM »

Is possible to make a carrier to carry a frigate instead of fighter wing?
Frigate that behave like normal frigate not like a fighter wing.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3889 on: May 18, 2018, 12:58:47 PM »

Not without some serious coding-fu.  I built a "missile launcher" that launched Frigates at one point, though... so yeah, doable, just not easy.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Sarissofoi

  • Captain
  • ****
  • Posts: 405
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3890 on: May 19, 2018, 02:44:57 AM »

Not without some serious coding-fu.  I built a "missile launcher" that launched Frigates at one point, though... so yeah, doable, just not easy.
That its hilarious actually.
Let me precise my question.
Can it would be possible to make carriers launch small vessels size of frigates that have collision?

Harmful Mechanic

  • Admiral
  • *****
  • Posts: 1340
  • On break.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3891 on: May 19, 2018, 09:47:23 AM »

You can try it for yourself, change the collision class of a fighter wing.

Mind you, it doesn't precisely work...
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3892 on: May 19, 2018, 02:21:23 PM »

Quote
Can it would be possible to make carriers launch small vessels size of frigates that have collision?
Yes.  What it launched was, technically, a Missile, that I used code to replace with a Frigate immediately.  Not a Fighter or a Wing.

That's not the hard part; the hard part was weird- it was making sure said Frigates weren't added to the player's fleet at the end of the fight, if they survived. 

Anyhow, yes, this is all possible, yes.  Easy... nope.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

MajorTheRed

  • Captain
  • ****
  • Posts: 288
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3893 on: May 19, 2018, 06:46:20 PM »

A quick one, easy to answer, not easy to explain clearly. Can a mod modify a value of something in the core game? The question can be divided into two smaller one. Are duplicate of files possible. And does the mod has priority over the core game in this case?

Two exemples:
-Let say I want to modify the caracteristic of the Wolf frigate (armor, speed, etc...). Can I copy paste its value in th ship.csv of my mod and just change the relevant value.
-Same thing with a hull mod. Let sayI just want to change the rengebonus of the targeting core. Can I copy-paste the relevant file in my mod folder, change the relevant value, and the game will take in consideration the file in the mod? Or will the game just crash because of duplicatas?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3894 on: May 19, 2018, 06:51:21 PM »

-Let say I want to modify the caracteristic of the Wolf frigate (armor, speed, etc...). Can I copy paste its value in th ship.csv of my mod and just change the relevant value.

Yes; just make sure the ship ID matches.

-Same thing with a hull mod. Let sayI just want to change the rengebonus of the targeting core. Can I copy-paste the relevant file in my mod folder, change the relevant value, and the game will take in consideration the file in the mod? Or will the game just crash because of duplicatas?

You'll have to add a line to your mod's hull_mods.csv to point that hullmod to a different implementation script, one provided by your mod.
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 #3895 on: May 22, 2018, 02:34:27 AM »

So how could I know if a FleetMemberAPI is removed in other places? If I put it into a Map, the reference will be continue, so when could I remove it.
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3896 on: May 22, 2018, 10:38:57 AM »

So how could I know if a FleetMemberAPI is removed in other places? If I put it into a Map, the reference will be continue, so when could I remove it.

I'm mainly talking about not using a static reference to the instance. That just strikes me as a very bad idea.

Also, make sure that your BowlData does not refer to the fleet member, or to anything that may refer to the fleet member indirectly, as that would prevent it from getting garbage collected.
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 #3897 on: May 23, 2018, 08:38:02 AM »

I'm mainly talking about not using a static reference to the instance. That just strikes me as a very bad idea.

Also, make sure that your BowlData does not refer to the fleet member, or to anything that may refer to the fleet member indirectly, as that would prevent it from getting garbage collected.
Well BowlData only has a float. So I could use WeakHashMap?
And another question:
Code
	/**
* Base value of the stat is 1.
* @param id
* @return
*/
MutableStat getStat(String id);

/**
* Base value of the stat is 1.
* @param id
* @return
*/
float getValue(String id);


StatBonus getMod(String id);
float getValue(String id, float base);

float getValue(String id); this method gets float from MutableStat map
float getValue(String id, float base); and this method gets float from StatBonus map, right?
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3898 on: May 23, 2018, 08:57:20 AM »

Well BowlData only has a float. So I could use WeakHashMap?

I think so. I don't have a lot of experience using these kinds of classes, though.

float getValue(String id); this method gets float from MutableStat map
float getValue(String id, float base); and this method gets float from StatBonus map, right?

Correct.
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 #3899 on: May 25, 2018, 12:51:59 AM »

I think so. I don't have a lot of experience using these kinds of classes, though.

Well.
com.fs.starfarer.combat.CombatMain  - java.util.ConcurrentModificationException
java.util.ConcurrentModificationException

xxxx.entrySet() in a foreach
seems I have to find another way
Logged
My mods


Pages: 1 ... 258 259 [260] 261 262 ... 706