Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 262 263 [264] 265 266 ... 709

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3945 on: September 05, 2018, 09:13:40 AM »

A hit from the EMP ship system will, but that's not an intrinsic property of either EMP arcs or EMP weapon damage.

Missiles can also have an "emp resistance" set through code, which will make them ignore this effect for X EMP system hits.
Logged

Takion Kasukedo

  • Admiral
  • *****
  • Posts: 506
  • No longer drinking (Alcohol that is)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3946 on: September 06, 2018, 03:10:16 AM »

If clip size is unspecified, it defaults to 1, btw.

Let's say the clip size is 20. If ammo/second is .1, this means it takes 10 seconds for 1 ammo to regenerate. Since the clip size is 20, it would take 20 * 10 = 200 seconds per clip. A more reasonable ammo/second of 1 would mean a 20 second reload time per clip. Does that make sense?

That seems to make sense, thanks Alex!

Another question for those modders out there, though.

How does one make a high-profile projectile that smashes through ordnance and low-profile objects, allowing it to reach it's maximum distance without having all of it's damage go into a stray rocket?
Logged
Is now able to cook a decent Creamy Salmon Pasta, amok other things.

Still loves purple. Still not skilled enough to make a mod that doesn't get that one damn error.

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2847
  • Your Friendly Forum Friend
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3947 on: September 06, 2018, 06:57:31 AM »

Another question for those modders out there, though.

How does one make a high-profile projectile that smashes through ordnance and low-profile objects, allowing it to reach it's maximum distance without having all of it's damage go into a stray rocket?
I THINK the only way to do this is by making a projectile plasma based (IE the same thing the PCannon uses)
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3948 on: September 06, 2018, 08:51:00 AM »

Pretty sure this is correct, yeah.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4680
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3949 on: September 07, 2018, 08:46:55 AM »

Is there an easy way to, given a Vector2f and a CombatEntityAPI, get the nearest point on the entity's targeting radius?

EDIT: or better yet, to the nearest point on its collision bounds
« Last Edit: September 07, 2018, 08:49:18 AM by Histidine »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3950 on: September 07, 2018, 09:15:16 AM »

com.fs.starfarer.api.util.Misc.getTargetingRadius() gets you the targeting radius from that point; from there it's a bit of vector math. IIRC there's nothing like that for collision bounds.

Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3951 on: September 07, 2018, 11:45:18 AM »

On the Plasma Cannon projectile effect... it'd sure be nice to have a boolean for other .proj types, but IIRC can't we also use collision masks?  Or does that not work any more?
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3952 on: September 13, 2018, 02:16:40 AM »

...or better yet, to the nearest point on its collision bounds
LazyLib has a function for this using CollisionUtils.getCollisionPoint(), which takes in two Vector2f (acting as start and end of a line) and a combatEntityAPI. It returns the first hit location the line would hit on the collision bounds of the target.

Histidine

  • Admiral
  • *****
  • Posts: 4680
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3953 on: September 13, 2018, 05:12:18 AM »

I need the nearest point though, not the one on a line passing through the entity center.

e.g. the point marked with an orange star, not the red one:


(actually I don't need it any more, decided that using the targeting radius was good enough and the best approach I've been able to think of for the way I wanted involves ray cast spam)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3954 on: September 13, 2018, 09:14:17 AM »

If it still matters, or for future reference:

Code: java
public static Vector2f closestPointOnSegmentToPoint(Vector2f p1, Vector2f p2, Vector2f p3) {
float u = (p3.x - p1.x) * (p2.x - p1.x) + (p3.y - p1.y) * (p2.y - p1.y);
float denom = Vector2f.sub(p2, p1, new Vector2f()).length();
denom *= denom;

u /= denom;

// if closest point on line is outside the segment, clamp to on the segment
if (u < 0) u = 0;
if (u > 1) u = 1;

Vector2f i = new Vector2f();
i.x = p1.x + u * (p2.x - p1.x);
i.y = p1.y + u * (p2.y - p1.y);
return i;
}

Segment is p1 to p2, external point is p3.

(The approach is figuring out where a normal from the line to the point would be on the line.)
Logged

Machine

  • Commander
  • ***
  • Posts: 114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3955 on: September 17, 2018, 05:00:55 PM »

So what is the range of the random seed used by sector generation?

Doing some testing I realized that the seed "MN-0" works, and it works up to a number that is over "MN-9000000000000000000" but below "MN-9999999999999999999" at which point the game won't recognize it as a valid seed.

Fun fact "MN-9999999999999999999" is not the limit as I expected, it is something lower than that since "MN-9999999999999999998" wouldn't work either; nor is it "MN-9000000000000000000", since the game generates seeds that are over it, although somewhat rarely?.
Also I did spend some time getting random seeds; none seemed to be less than 19 digits (I admit I might have missed some that were), that said, less than 19 digits seeds do work.

Why would I want to know about this? I actually want to have a customized star system to generate in a "random" location that is seed dependent. Considering that I could just assume the range to be "0 to 9999999999999999999", to select a "random" point between a circle, this is not a big issue...
However mainly out of curiosity, I would like to know what are the ranges for this, both the maximum and minimum the game would accept, and the range the game actually generates the seeds.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3956 on: September 17, 2018, 05:20:37 PM »

The seed is a long-type value.

However, if you're looking to use an rng based on the seed, I'd suggest just using StarSystemGenerator.random during the sector generation process.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4680
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3957 on: September 22, 2018, 08:03:29 AM »

Could SettingsAPI.getVariant(variantId) (and maybe FactoryAPI.createFleetMember(variantId)) with a variant that doesn't exist return null instead of throwing a RuntimeException? Doing a try/catch to check if a variant exists feels pretty silly.
« Last Edit: September 22, 2018, 08:06:12 AM by Histidine »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3958 on: September 22, 2018, 09:09:14 AM »

Added: SettingsAPI.doesVariantExist(String variantId)

I'd like to keep the runtime exception behavior since it makes it easier for me to track down problems (say, when a variant is not found due to a *bug*) because then I'll know the variant ID that caused it.
Logged

Plasmatic

  • Admiral
  • *****
  • Posts: 500
  • Curious no?
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3959 on: September 22, 2018, 11:57:39 PM »

What program would be best used to modify .csv files?

A program that isn't microsoft excel.

I've tried libreoffice, but apparently that makes the game crash even when i save as a .csv.

so I'm wondering if I'm missing something..
Logged
"Better to remain silent and be thought a fool than to speak out and remove all doubt"
- Maurice Switzer
Pages: 1 ... 262 263 [264] 265 266 ... 709