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)

Author Topic: How does .isNeutralFaction() work?  (Read 1531 times)

JDCollie

  • Captain
  • ****
  • Posts: 261
    • View Profile
    • My Youtube Channel
How does .isNeutralFaction() work?
« on: April 26, 2014, 11:40:32 AM »

I am curious if anyone knows what values the method .isNeutralFaction() evaluates in determining if a faction is indeed neutral? The API didn't help me any, and I seriously know almost nothing about Java, so anything anyone could tell me would help a lot :D
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: How does .isNeutralFaction() work?
« Reply #1 on: April 26, 2014, 11:47:15 AM »

I believe it just checks if it's the 'neutral' faction. This faction doesn't actually exist, it's just used for things like the abandoned station that no faction owns.

If you want to check if something's actually neutral towards you, you'd use
Code: java
if (fleet.getFaction().getRelationship("player") == 0f)
« Last Edit: April 26, 2014, 11:50:46 AM by LazyWizard »
Logged

JDCollie

  • Captain
  • ****
  • Posts: 261
    • View Profile
    • My Youtube Channel
Re: How does .isNeutralFaction() work?
« Reply #2 on: April 26, 2014, 01:58:27 PM »

I believe it just checks if it's the 'neutral' faction. This faction doesn't actually exist, it's just used for things like the abandoned station that no faction owns.

If you want to check if something's actually neutral towards you, you'd use
Code: java
if (fleet.getFaction().getRelationship("player") == 0f)
Do you happen to know if it evaluates membership based upon the faction id? I have unplesant suspicion that it does, but I don't know how to make a program to test it myself.
Logged