Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.98a is out! (03/27/25)

Pages: 1 ... 7 8 [9] 10 11 ... 46

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

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: API request
« Reply #120 on: August 12, 2013, 12:41:59 PM »

WeaponAPI:

void setCustomDPS(float DPS)

This is very useful when the actual damage is made from scripted plugins on the weapon itself, this is extremely common when a beam with no opacity is used to trigger some type of damage while having 0 DPS on the weapon info.

CombatEngineAPI:

void removeEntity(CombatEntityAPI target, boolean explode)

Again very useful when you want to remove hulk ships with the actual explosion without applying an insane damage that can be seen by the player.

void removeEntity(CombatEntityAPI target, ExplosionAPI custom_explosion)

Custom explosions anyone? The ExplosionAPI is figurative since i have no idea if it exists but again, it would be very useful.

Is there anyway to get hold of events happening in the engine (CombatEngineAPI), like a ship being hit, weapons are fired, etc, without needing to going thro all the projectiles/ships?
« Last Edit: August 12, 2013, 12:56:12 PM by silentstormpt »
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: API request
« Reply #121 on: August 22, 2013, 10:12:05 AM »

Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: API request
« Reply #122 on: August 22, 2013, 10:21:08 AM »

Already on Alex's schedule :)
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26087
    • View Profile
Re: API request
« Reply #123 on: August 22, 2013, 10:30:39 AM »

Actually, already done and in the patch notes :)
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1374
    • View Profile
    • GitHub Profile
Re: API request
« Reply #124 on: August 24, 2013, 09:10:17 AM »

SectorAPI:
  • boolean getPaused()

As I notice it now has a setPaused(). :)
Logged
Active mods: LazyLib | Combat Radar | Console Commands | Version Checker  ||  Old mods: Autosave | Omnifactory | Simulator Overhaul
Feel free to use any code I've written or PM me for help with your own. Anyone is free to translate my work.

Wyvern

  • Admiral
  • *****
  • Posts: 4100
    • View Profile
Re: API request
« Reply #125 on: August 25, 2013, 12:56:17 PM »

MutableShipStatsAPI:
  • MutableStat getBeamWeaponFluxCostMult()
  • MutableStat getEnergyWeaponFluxCostMult()
  • MutableStat getBallisticWeaponFluxCostMult()
  • MutableStat getMissileWeaponFluxCostMult()

...Or something along those lines; was trying to make a system that would reduce flux costs of energy weapons when active, to encourage the use of energy weapons in a particular ship's universal slots without directly increasing their damage output.  And, err, apparently I can't do that right now?
Logged
Wyvern is 100% correct about the math.

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: API request
« Reply #126 on: August 30, 2013, 10:12:55 AM »

WeaponAPI:
  • setCustomWeaponImage(String url);

This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: API request
« Reply #127 on: September 03, 2013, 09:25:56 AM »

Ive searched on the API for methods i could use to merge fleets or refill them with supplies, fuel and crew to no avail, i always need to create a new CampaignFleetAPI from the
*.faction file data.

CampaignFleetAPI:

CampaignFleetAPI sector.createFleet(List<FleetMemberAPI> fleetMembers);
Dont forget that these fleetmembers already have their cargo set when we call this method or else returns null.
This also allows me to create a mergeFleet method by grabing their fleetMembers and combine them into a new List<>


FleetMemberAPI:

setSupplies(float quantity);
setCrew(float quantity, CargoAPI.CrewXPLevel CrewXPLevel);
setFuel(float quantity);
(add methods instead of set, would also be nice to have but we can make those ourselves)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26087
    • View Profile
Re: API request
« Reply #128 on: September 03, 2013, 09:34:47 AM »

Adding functionality to creating a fleet via the API is probably a good idea. Regarding cargo management, though, that's done on a fleet level, not on a fleet member level. Individual ships don't carry cargo or fuel, they just contribute capacity to do so to the fleet.

WeaponAPI:
  • setCustomWeaponImage(String url);
This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)

You can already use the AnimationAPI to do this, this seems redundant.

SectorAPI:
  • boolean getPaused()

As I notice it now has a setPaused(). :)

Oops, added.


MutableShipStatsAPI:
  • MutableStat getBeamWeaponFluxCostMult()
  • MutableStat getEnergyWeaponFluxCostMult()
  • MutableStat getBallisticWeaponFluxCostMult()
  • MutableStat getMissileWeaponFluxCostMult()

...Or something along those lines; was trying to make a system that would reduce flux costs of energy weapons when active, to encourage the use of energy weapons in a particular ship's universal slots without directly increasing their damage output.  And, err, apparently I can't do that right now?

See:
public StatBonus getEnergyWeaponFluxCostMod();
public StatBonus getBallisticWeaponFluxCostMod();
public StatBonus getMissileWeaponFluxCostMod();
public MutableStat getBeamWeaponFluxCostMult();

Unless they aren't in 0.54.1a? I think they are, but I'm not 100% sure.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 4100
    • View Profile
Re: API request
« Reply #129 on: September 03, 2013, 09:42:20 AM »

MutableShipStatsAPI:
  • MutableStat getBeamWeaponFluxCostMult()
  • MutableStat getEnergyWeaponFluxCostMult()
  • MutableStat getBallisticWeaponFluxCostMult()
  • MutableStat getMissileWeaponFluxCostMult()

...Or something along those lines; was trying to make a system that would reduce flux costs of energy weapons when active, to encourage the use of energy weapons in a particular ship's universal slots without directly increasing their damage output.  And, err, apparently I can't do that right now?

See:
public StatBonus getEnergyWeaponFluxCostMod();
public StatBonus getBallisticWeaponFluxCostMod();
public StatBonus getMissileWeaponFluxCostMod();
public MutableStat getBeamWeaponFluxCostMult();

Unless they aren't in 0.54.1a? I think they are, but I'm not 100% sure.
Hm... Apparently I forgot to update my API reference files; would explain why I couldn't see those methods.  Oops.  And thanks.
Logged
Wyvern is 100% correct about the math.

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: API request
« Reply #130 on: September 03, 2013, 09:46:45 AM »

WeaponAPI:
  • setCustomWeaponImage(String url);
This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)

You can already use the AnimationAPI to do this, this seems redundant.

On the UI (refit/cargo screen), that image used when you buy/sell that weapon
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1374
    • View Profile
    • GitHub Profile
Re: API request
« Reply #131 on: September 03, 2013, 10:24:49 AM »

WeaponAPI:
  • setCustomWeaponImage(String url);
This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)

You can already use the AnimationAPI to do this, this seems redundant.

On the UI (refit/cargo screen), that image used when you buy/sell that weapon

I've done this by setting frame 0 to the appearance I want a weapon to have in the campaign, then using a custom animation plugin that only iterates through frames 1-max. This allows your weapon to have completely different appearances in campaign and combat mode.
Logged
Active mods: LazyLib | Combat Radar | Console Commands | Version Checker  ||  Old mods: Autosave | Omnifactory | Simulator Overhaul
Feel free to use any code I've written or PM me for help with your own. Anyone is free to translate my work.

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: API request
« Reply #132 on: September 03, 2013, 10:40:36 AM »

WeaponAPI:
  • setCustomWeaponImage(String url);
This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)

You can already use the AnimationAPI to do this, this seems redundant.

On the UI (refit/cargo screen), that image used when you buy/sell that weapon

I've done this by setting frame 0 to the appearance I want a weapon to have in the campaign, then using a custom animation plugin that only iterates through frames 1-max. This allows your weapon to have completely different appearances in campaign and combat mode.

Sorry, i know exactly how you managed that, let me try a more clear way what i meant.
If i went with the animationAPI, the turret would be fine on the cargo screen but if i applied to the ship (in the refit screen) it would still be the turret and not just the cannon (because the AnimationAPI is only used when in combat). Unless i completely mistaken how the AnimationAPI works tho.

This would allow us to set images that could be a 3D profile of the weapon, but when you applied said weapon on the refit or see it on combat, this weapon would ofc a 2D sprite.

Another possible solution would be, a extra line on the *.wpn file like, "weaponSprite" that would only take effect if its used, else, it uses the default "turretSprite" / "hardpointSprite" as the Cargo image.
« Last Edit: September 03, 2013, 10:50:30 AM by silentstormpt »
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1374
    • View Profile
    • GitHub Profile
Re: API request
« Reply #133 on: September 16, 2013, 07:43:15 PM »

ShipSystemAPI:
  • State getState()
  • float getEffectLevel()

Also, stickied this thread since it's so long-lived and has a singular purpose (requesting exposure of existing features to the API).
« Last Edit: September 16, 2013, 07:45:47 PM by LazyWizard »
Logged
Active mods: LazyLib | Combat Radar | Console Commands | Version Checker  ||  Old mods: Autosave | Omnifactory | Simulator Overhaul
Feel free to use any code I've written or PM me for help with your own. Anyone is free to translate my work.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: API request
« Reply #134 on: September 17, 2013, 01:04:39 PM »

ShipAPI:  setCR(float CR):  would set Combat Rating values to float value.
WingAPI: setReplacements(float replacements), would set how many chassis a Wing currently has to float value.

Basically, I ran into issues with spawnShipOrWing(); I think those things are just a bug, but they more or less expose issues underlying the CR system atm. 

Setting CR in a Mission should just require a valid ShipAPI, not a FleetAPI.  Same with setting the number of chassis available; we should just get the ShipAPI and the WingAPI and be able to set it. 

Why?  Because it's really clunky to work back to FleetMemberAPI and if they've just spawned, they might not even be there yet, so null.
Logged
Please check out my SS projects :)
Xeno's Mod Pack
Pages: 1 ... 7 8 [9] 10 11 ... 46