Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 259 260 [261] 262 263 ... 467

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

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 342
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3900 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: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3901 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: 342
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3902 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


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3903 on: May 25, 2018, 08:15:36 AM »

Could just do "for (Type x : new ArrayList<Type>(xxxx.entrySet())". From what I read the changes to WHM happen in the same thread that's created/using it, so it shouldn't just change w/o you calling a method on it (which may then trigger some keys being cleaned up). So creating a copy of the entry set or whatever you're using would probably do the job.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 2846
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3904 on: May 26, 2018, 06:04:48 AM »

AsteroidBeltGenPlugin creates a pair of ring bands under each asteroid belt. Is there a way to identify all such bands in a system so I can remove them?
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 4882
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3905 on: May 26, 2018, 09:13:14 AM »

Write a custom public class "MyAsteroidBeltGenPlugin" that implements AsteroidBeltGenPlugin, doesn't generate those ring bands, and invoke that instead.

Or hunt through all SectorEntityAPI objects and find ones that use rings_asteroids0 in their SpriteID?  It's too bad they don't have a specific Tag associated with them to make this easier, but that's how that works.
« Last Edit: May 26, 2018, 09:15:05 AM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3906 on: May 26, 2018, 10:58:01 AM »

AsteroidBeltGenPlugin creates a pair of ring bands under each asteroid belt. Is there a way to identify all such bands in a system so I can remove them?

None that I can think of; what's the use case?

Also, added a couple of methods to the API get at the ring band sprite, since as far as I can see that's not currently possible.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 2846
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3907 on: May 26, 2018, 08:35:30 PM »

Seems I can't get the sprite of arbitrary SectorEntityTokens, so yeah. Also don't feel like replacing the star system generation code just for this.

None that I can think of; what's the use case?
A certain modder found the ring textures used for asteroid belts weren't as visually attractive as desired, so he made his own, presently used for the hand-placed asteroid belts in the mod's star system. We were exploring the possibility of using the custom texture for additional asteroid belts created by StarSystemGenerator.addOrbitingEntities() as well.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3908 on: May 26, 2018, 08:49:00 PM »

Hmm, I think replacing this in settings.json:

"rings_asteroids0":"graphics/planets/rings_asteroids0.png",

With the new texture should work? That is, if it's specified in a mod's settings.json, I believe it should override the vanilla texture, at least for new games created after that change is made. Or does this not actually work?
Logged

Histidine

  • Admiral
  • *****
  • Posts: 2846
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3909 on: May 26, 2018, 10:14:47 PM »

Overwriting the asteroid ring texture isn't an option, since 1) the mod texture is set up differently (it uses the whole 1024x512 image to define one texture type, instead of four),
and 2) we don't actually want to modify the ring textures outside this one system, that's an invasive change.

Anyway, I found the easy way to replace the asteroid belt gen plugin (thanks for making StarSystemGenerator.terrainPlugins public) so the specific case is dealt with :)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3910 on: May 26, 2018, 10:22:51 PM »

Ah, gotcha. I thought it was meant to be a global change. Glad you got it worked out!
Logged

gun&drink

  • Ensign
  • *
  • Posts: 27
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3911 on: May 27, 2018, 10:44:57 AM »

So I was trying to revive an old mod (I think that the last time this was updated was in 0.5) and I managed to be able to make the ship and everything appear in-game. the problem is that when trying to fire any of the weapons of this mod the game crashes and this log is what's left:


60095 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 34
60095 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 35
60173 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 36
60173 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 37
60174 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 38
60175 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 39 - last
82423 [Thread-4] INFO  com.fs.starfarer.combat.CombatEngine  - FP1: 135, FP2: 1191, maxFP1: 200, maxFP2: 300
82423 [Thread-4] INFO  org.histidine.chatter.combat.ChatterCombatPlugin  - Chatter plugin initialized
95947 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.combat.entities.ship.A.if.startedChargeup(Unknown Source)
   at com.fs.starfarer.combat.entities.ship.trackers.OoOO.super(Unknown Source)
   at com.fs.starfarer.combat.entities.ship.trackers.D.super(Unknown Source)
   at com.fs.starfarer.combat.entities.ship.trackers.D.super(Unknown Source)
   at com.fs.starfarer.combat.entities.ship.trackers.OoOO.String(Unknown Source)
   at com.fs.starfarer.combat.entities.ship.A.if.advance(Unknown Source)
   at com.fs.starfarer.combat.systems.oOoO.advanceLinked(Unknown Source)
   at com.fs.starfarer.combat.systems.oOoO.advance(Unknown Source)
   at com.fs.starfarer.combat.entities.Ship.fire(Unknown Source)
   at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source)
   at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
   at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
   at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

where should I start looking for what's wring with the weapons? I checked the vanilla ones to see if anything looked too different but I'm a bit lost
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 671
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3912 on: May 27, 2018, 12:18:36 PM »

Hello, this is for know, directly with Alex, i think, well, i have a problem with my SAD Faction, who act like Remnant.

Compared to them, they drop survey data.


But like them, if you fight a fleet who flee you, then you let them go, well, you got survey data.
Than you can farm easily.  This is not worth like Ai drop, but same.


A means to fix that?
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Anarchistic Defectors A fan-mod of Shadowyard.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3913 on: May 27, 2018, 12:28:35 PM »

I'm assuming you copy-pasted RemnantFleetInteractionConfigGen to work for your faction? IIRC the bug is in there, so you'll need to fix it to only work for ship losses, in the postPlayerSalvageGeneration() method.

Here's what the fixed method looks like on my end, currently:

Spoiler
Code: java
				public void postPlayerSalvageGeneration(InteractionDialogAPI dialog, FleetEncounterContext context, CargoAPI salvage) {
if (!(dialog.getInteractionTarget() instanceof CampaignFleetAPI)) return;

CampaignFleetAPI fleet = (CampaignFleetAPI) dialog.getInteractionTarget();

DataForEncounterSide data = context.getDataFor(fleet);
List<FleetMemberAPI> losses = new ArrayList<FleetMemberAPI>();
for (FleetMemberData fmd : data.getOwnCasualties()) {
losses.add(fmd.getMember());
}

List<DropData> dropRandom = new ArrayList<DropData>();

int [] counts = new int[3];
String [] groups = new String [] {Drops.AI_CORES1, Drops.AI_CORES2, Drops.AI_CORES3};
//for (FleetMemberAPI member : fleet.getFleetData().getMembersListCopy()) {
for (FleetMemberAPI member : losses) {
if (member.isStation()) {
counts[2] += 10;
}

if (member.isCapital()) {
counts[2] += 2;
} else if (member.isCruiser()) {
counts[2] += 1;
} else if (member.isDestroyer()) {
counts[1] += 1;
} else if (member.isFrigate()) {
counts[0] += 1;
}
}

// if (fleet.isStationMode()) {
// counts[2] += 10;
// }

for (int i = 0; i < counts.length; i++) {
int count = counts[i];
if (count <= 0) continue;

DropData d = new DropData();
d.group = groups[i];
d.chances = (int) Math.ceil(count * 1f);
dropRandom.add(d);
}

Random salvageRandom = new Random(Misc.getSalvageSeed(fleet));
CargoAPI extra = SalvageEntity.generateSalvage(salvageRandom, 1f, 1f, 1f, null, dropRandom);
for (CargoStackAPI stack : extra.getStacksCopy()) {
salvage.addFromStack(stack);
}
}

[close]

Logged

Snrasha

  • Admiral
  • *****
  • Posts: 671
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3914 on: May 27, 2018, 01:27:17 PM »

Thank you!
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Anarchistic Defectors A fan-mod of Shadowyard.
Pages: 1 ... 259 260 [261] 262 263 ... 467