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 2 [3] 4 5 ... 42

Author Topic: API request thread (please read OP before posting!)  (Read 217568 times)

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: API request
« Reply #30 on: December 13, 2012, 02:03:01 PM »

CombatEntityApi
-SetLocation
-setVelocity


I was thinking of making objectives which teleport nearby units when captured, then resets ownership. Another idea that would use this is a carrier that can teleport fighter squadrons forward.

Then again I can see this causing some problems if illegal values (on top of other ships or outside the map bounds) are entered.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: API request
« Reply #31 on: December 13, 2012, 02:24:22 PM »

CombatEntityApi
-SetLocation
-setVelocity

Not necessary - getLocation() and getVelocity() return an Object, not a primitive type, so you can modify the returned Vector2f and have your effects show up in game (as long as you use location.set(x,y) instead of location = new Vector2f(x, y), since the latter will create a new object and lose the reference - argh, I explained that terribly).
« Last Edit: December 13, 2012, 02:26:06 PM by LazyWizard »
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: API request
« Reply #32 on: December 13, 2012, 02:33:59 PM »

CombatEntityApi
-SetLocation
-setVelocity

Not necessary - getLocation() and getVelocity() return an Object, not a primitive type, so you can modify the returned Vector2f and have your effects show up in game (as long as you use location.set(x,y) instead of location = new Vector2f(x, y), since the latter will create a new object and lose the reference - argh, I explained that terribly).

Actually, that was rather good
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: API request
« Reply #33 on: December 13, 2012, 02:52:07 PM »

For instance a ship could bump an asteroid and equip it as ammo, then fire it as a weapon

You should already be able to do this with the API as it is now.

With regards to missiles, would a new contrail type similar to a tracer trail be possible? It's not exactly on topic, but I was reminded and I think it would be a rather cool thing to have.

No. Tried that a long time ago, couldn't get it to look good given the highly varied paths missiles can take.


Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: API request
« Reply #34 on: December 13, 2012, 02:57:00 PM »

For instance a ship could bump an asteroid and equip it as ammo, then fire it as a weapon

You should already be able to do this with the API as it is now.

With regards to missiles, would a new contrail type similar to a tracer trail be possible? It's not exactly on topic, but I was reminded and I think it would be a rather cool thing to have.

No. Tried that a long time ago, couldn't get it to look good given the highly varied paths missiles can take.




Ah cool, now I got to learn to mod weapons, great -_-
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: API request
« Reply #35 on: December 13, 2012, 03:16:10 PM »

CombatEntityApi
-SetLocation
-setVelocity

Not necessary - getLocation() and getVelocity() return an Object, not a primitive type, so you can modify the returned Vector2f and have your effects show up in game (as long as you use location.set(x,y) instead of location = new Vector2f(x, y), since the latter will create a new object and lose the reference - argh, I explained that terribly).

You explained it well enough for me! For some reason I assumed that the get methods would return a new copy of the Vector2f rather than a reference to the actual instance. I think thats a convention that got burned into my brain a while back...
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: API request
« Reply #36 on: December 14, 2012, 04:59:06 AM »

Can you please modify the SetAmmo API one?

For instance:

SetWeaponAmmo(string Weapon ID, int amount)

and

SetAmmoofType(string weapon_Type( I.E ballistic/missile) int amount)
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: API request
« Reply #37 on: December 15, 2012, 07:53:22 PM »

SectorAPI
  • List<StarSystemAPI> getStarSystems()

This would make creating universally compatible utility mods much, much easier. :)


Spoiler
Can you please modify the SetAmmo API one?

For instance:

SetWeaponAmmo(string Weapon ID, int amount)

and

SetAmmoofType(string weapon_Type( I.E ballistic/missile) int amount)
[close]

Weapons don't really work that way. I'm not sure what you're looking to do here, but feel free to PM me if you need help with it. :)
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: API request
« Reply #38 on: December 16, 2012, 09:02:46 AM »

SectorAPI
  • List<StarSystemAPI> getStarSystems()

This would make creating universally compatible utility mods much, much easier. :)


Spoiler
Can you please modify the SetAmmo API one?

For instance:

SetWeaponAmmo(string Weapon ID, int amount)

and

SetAmmoofType(string weapon_Type( I.E ballistic/missile) int amount)
[close]

Weapons don't really work that way. I'm not sure what you're looking to do here, but feel free to PM me if you need help with it. :)
As in, would the SetAmmo method work to do individual weapon ammo or increase all ammo for a weapon type?
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: API request
« Reply #39 on: December 18, 2012, 01:20:59 AM »

CombatEngineAPI
  • float getMapHeight()
  • float getMapWidth()

Also, just checking that you saw this:

SectorAPI
  • List<StarSystemAPI> getStarSystems()

This would make creating universally compatible utility mods much, much easier. :)

Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: API request
« Reply #40 on: December 18, 2012, 01:23:51 AM »

Doesn't that one exist already? Pretty sure I've seen it somewhere.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: API request
« Reply #41 on: December 18, 2012, 01:36:12 AM »

There's a getStarSystem(String name), which only helps if you know what system the mod is using already.

Plus, it will be necessary someday anyway, once the multi-system update arrives. ;)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: API request
« Reply #42 on: December 18, 2012, 09:45:17 AM »

CombatEngineAPI
  • float getMapHeight()
  • float getMapWidth()

Also, just checking that you saw this:

SectorAPI
  • List<StarSystemAPI> getStarSystems()

This would make creating universally compatible utility mods much, much easier. :)

Yep, saw that too. I'll add it - like you said, probably likely to be necessary in any event.

On a related note, I expect to have to break some parts of the API horribly after the 0.54.1a release...
Logged

Psiyon

  • Admiral
  • *****
  • Posts: 772
  • Trippy
    • View Profile
Re: API request
« Reply #43 on: December 23, 2012, 04:15:36 PM »

Figure I'd just use this thread instead of making a new one:

Any chance of a method that lets us mess around with the supply consumption amount on a fleet-wide scale? I saw a getFuelUseMod() mutable stat in MutableShipStats, but none for supplies.

Something like:
MutableStat getFleetSupplyUse();

would be wonderful. Thanks in advance.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: API request
« Reply #44 on: December 25, 2012, 10:28:47 AM »

Any chance of a method that lets us mess around with the supply consumption amount on a fleet-wide scale? I saw a getFuelUseMod() mutable stat in MutableShipStats, but none for supplies.

Not quite yet - sorry. It's getting a bit too far into "tweak things that are likely to change wholesale" territory...
Logged
Pages: 1 2 [3] 4 5 ... 42