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 ... 640 641 [642] 643 644 ... 706

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

ctuncks

  • Commander
  • ***
  • Posts: 115
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9615 on: February 18, 2023, 05:06:28 AM »

Yes, the former.
Thanks for the reply, still a bit hazy on what does what specifically.
This sounds like a mod feature!
I did a lot of digging around turns out it's Graphics Lib that adds those glows, I've had it installed for so long I thought it was a vanilla feature.
IIRC there's nothing special here, so copy-pasting the gravitonbeam weapon file with a different weapon ID should produce the same result. But if you want a differently proportioned core, you can provide a different beam texture. See hil.wpn for an example for how to provide a custom texture.
Turns out this was an unintended side effect of having the wrong parts of a duplicated weapon file left in place from another mod. Thanks for the heads up that these weren't normal effects
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9616 on: February 18, 2023, 08:44:09 AM »

what layer does a BaseEveryFrameCombatPlugin's renderInUICoords() method render on?
or is it all of them? having some wierdness with colours that could be explained by this; the alpha of anything I render seems to be set to full

edit : did a test w/ a sprite & it seems like the alpha is just getting thrown away, is there any way for me to fix this on my end? attached a screenshot below.
 large image

[close]

Does the system have 0 "down" duration? Looking at the code, I think this may happen then, yeah - there'll be one frame where the effect level is 1, the state is it charging down, and unapply() will not have been called yet. I wouldn't call this intentional but it's not something I want to touch at this point - it could break something very subtle.

and ty for the explanation! iirc (I changed it after asking the question heh) it had a down of one, though I managed to fix it by just having unapply() set a bool that my script checked for.
« Last Edit: February 20, 2023, 05:25:26 AM by Ruddygreat »
Logged

alaricdragon

  • Commander
  • ***
  • Posts: 145
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9617 on: February 18, 2023, 12:42:01 PM »

hello once more all, i have yet one more random question
does anyone know how to create a pop-up notification like the one that tech mining gives at the end of each month?
thanks again for all the responses to my random questions in the past
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9618 on: February 18, 2023, 08:42:04 PM »

hello once more all, i have yet one more random question
does anyone know how to create a pop-up notification like the one that tech mining gives at the end of each month?
thanks again for all the responses to my random questions in the past

Either create your intel instance and add that to manager, or just use    void addMessage(IntelInfoPlugin intel, MessageClickAction action); from CampaignUIAPI

Code
			ProductionReportIntel intel = new ProductionReportIntel(gatheringPoint, data, 
totalCost + weaponCost, prod.getAccruedProduction(),
wantedToDoProduction && unableToDoProduction);
Global.getSector().getIntelManager().addIntel(intel);
Code
    private static void addReportMessage() {
        ForgeProductionReport intel = new ForgeProductionReport();
        Global.getSector().getCampaignUI().addMessage(intel);
    }

There's also methods that take Strings instead of intel instances as an argument, in case you don't want anything fancy: addMessage(String text)
« Last Edit: February 18, 2023, 08:47:21 PM by Ontheheavens »
Logged
   

bananana

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9619 on: February 20, 2023, 12:21:44 AM »

issue resolved
« Last Edit: February 20, 2023, 03:05:18 AM by bananana »
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9620 on: February 20, 2023, 12:53:13 AM »

What is the correct usage of CombatEngineAPI.spawnProjectile(ShipAPI ship, WeaponAPI weapon, String weaponId, String projSpecId, Vector2f point, float angle, Vector2f shipVelocity);?

Every time I have tried to use it, it crashes with a nullpointerexception in the constructor of either MovingRay or BallisticProjectile. For example calling this method with non-null variables, and with the strings "lightdualac" and "lightdualac_shot" will cause a crash. This makes it impossible to spawn projectiles that are indirectly spawned via MIRV missiles, e.g. the "sabot_warhead2" projectile. Can this be clarified please?
Logged

NinjaSiren

  • Lieutenant
  • **
  • Posts: 94
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9621 on: February 20, 2023, 01:32:01 AM »

how do you get if a planetary market has a com relay, via code?

Is it like this? sector.getEntityById(Entities.COMM_RELAY) / sector.getEntityById(Entities.COMM_RELAY_MAKESHIFT)

I am unsure
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9622 on: February 20, 2023, 04:59:16 AM »

I need to get tags of specific IntelInfoPlugins. How do I get a hold of SectorMapAPI instance in order to call Set<String> getIntelTags(SectorMapAPI map)? Searched through, all the usages are only extensions of caller methods, nothing returns SectorMapAPI.

Edit: I'm pretty sure I can't get that instance and by extension can't get tags, because what most likely happens is that map instance is generated only in obfuscated code and stays there. If this is correct I'd like to request respective API additions.

Edit 2: How "void setHidden(boolean hidden)" in IntelInfoPlugin is supposed to work? I have my intels, I set the boolean to true, debugger shows the field is indeed true - but the...

Oh God... In the process of writing this I looked into the BaseIntelPlugin and realized that what I thought to be a completely legit mechanism of making the intel visible/hidden (as implied by the javadoc comment) is actually not a functioning feature at all. I guess I can't set intel items to be hidden/shown after all:

Code
	public boolean isHidden() {
// never mind; handled by making comm relay in Galatia non-functional until the jump-point is stabilized
// but procurement missions etc generated inside Galatia still show up, so: need to do this
return TutorialMissionIntel.isTutorialInProgress(); 
//return hidden != null;
}

public void setHidden(boolean hidden) {
if (hidden) {
this.hidden = hidden;
} else {
this.hidden = null;
}
}
« Last Edit: February 20, 2023, 08:33:55 AM by Ontheheavens »
Logged
   

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9623 on: February 20, 2023, 02:48:46 PM »

My question is: what's stopping you from exposing the vast majority of simple getter/setter methods that are present in implementing classes but are not present in the API? ButtonAPI's being just an example, there are plenty of cases like this - had a comment on getTurretGunSpriteName(), where the method was right there in the class but it required indirect reflection to get to use it - said method being added by you in upcoming patch too.

Mainly time and a reason to do it. Exposing everything that could be reasonably exposed via the API would be a very substantial undertaking, and a lot of older stuff specifically wasn't written with it in mind. Stuff gets added to the API, generally speaking when:
1) I need to use it from code that's outside of core, or
2) Someone asks for it

So, given that second one - just added these and a few more to ButtonAPI :)

(There are some cases where the methods are unsuitable for external use for whatever reason, but that I think is fairly rare. But e.g. exposing specific things from within core code that aren't exposed at all may be another matter, a rats nest of dependencies that has to all be exposed in some way...)


what layer does a BaseEveryFrameCombatPlugin's renderInUICoords() method render on?
or is it all of them? having some wierdness with colours that could be explained by this; the alpha of anything I render seems to be set to full

edit : did a test w/ a sprite & it seems like the alpha is just getting thrown away, is there any way for me to fix this on my end? attached a screenshot below.

Above all of them, and below the rest of the UI. No idea what's going on with the sprite - did you set its blend mode to something weird? This has nothing to do with where it's being rendered, I don't think; looks to me like some kind of error on your end more than likely!


What is the correct usage of CombatEngineAPI.spawnProjectile(ShipAPI ship, WeaponAPI weapon, String weaponId, String projSpecId, Vector2f point, float angle, Vector2f shipVelocity);?

Every time I have tried to use it, it crashes with a nullpointerexception in the constructor of either MovingRay or BallisticProjectile. For example calling this method with non-null variables, and with the strings "lightdualac" and "lightdualac_shot" will cause a crash. This makes it impossible to spawn projectiles that are indirectly spawned via MIRV missiles, e.g. the "sabot_warhead2" projectile. Can this be clarified please?

Hmm - it's used a bunch of times in the API for things like mines, some Omega weapons, etc. Also, data.scripts.plugins.TestCombatPlugin calls this to spray a bunch of lightmg shots, and I recall this working.

how do you get if a planetary market has a com relay, via code?

Is it like this? sector.getEntityById(Entities.COMM_RELAY) / sector.getEntityById(Entities.COMM_RELAY_MAKESHIFT)

I am unsure

You can do:
market.hasCondition(Conditions.COMM_RELAY)

It's a hidden condition that doesn't show up and the comm relay script iirc manages it under the hood.


I need to get tags of specific IntelInfoPlugins. How do I get a hold of SectorMapAPI instance in order to call Set<String> getIntelTags(SectorMapAPI map)? Searched through, all the usages are only extensions of caller methods, nothing returns SectorMapAPI.

I'm pretty sure you can just pass in null for the map; intel plugins are supposed to handle that. The vanilla ones do (unless I messed up); I just added a comment to the javadoc to make this expectation clear. Worst case you could do this in a try/catch block, *shudder*.


Oh God... In the process of writing this I looked into the BaseIntelPlugin and realized that what I thought to be a completely legit mechanism of making the intel visible/hidden (as implied by the javadoc comment) is actually not a functioning feature at all. I guess I can't set intel items to be hidden/shown after all:

Oh wow, my apologies :(

Ah, this is a bug, actually - in the dev version, this code already has:
return TutorialMissionIntel.isTutorialInProgress() || hidden != null;
So looks like it came up or was reported and I fixed it up at some point.
Logged

rogerbacon

  • Commander
  • ***
  • Posts: 142
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9624 on: February 20, 2023, 03:48:23 PM »

I want to create an "OnHit" event that, if it hits a shield on a target with less than 360 degree shields, will do some random damage to a non-shielded point on the ship. In other words, it would do damage just like the target was shot from that direction hitting armor and hull as normal.

Vectors confuse me so any help on how to manipulate the direction from the original shot to a random point on the unshielded arc would be appreciated.

Logged

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9625 on: February 20, 2023, 09:53:25 PM »


What is the correct usage of CombatEngineAPI.spawnProjectile(ShipAPI ship, WeaponAPI weapon, String weaponId, String projSpecId, Vector2f point, float angle, Vector2f shipVelocity);?

Every time I have tried to use it, it crashes with a nullpointerexception in the constructor of either MovingRay or BallisticProjectile. For example calling this method with non-null variables, and with the strings "lightdualac" and "lightdualac_shot" will cause a crash. This makes it impossible to spawn projectiles that are indirectly spawned via MIRV missiles, e.g. the "sabot_warhead2" projectile. Can this be clarified please?

Hmm - it's used a bunch of times in the API for things like mines, some Omega weapons, etc. Also, data.scripts.plugins.TestCombatPlugin calls this to spray a bunch of lightmg shots, and I recall this working.

Yeah the problem is that there are two spawnProjectile methods defined, and TestCombatPlugin only uses the one that takes a weaponID (which works flawlessly). The problem is that the second overload that takes a weaponID and a projectileID is always crashing whenever i try to use it, and I can't get it to not crash with a lot of different input combinations.
Logged

NinjaSiren

  • Lieutenant
  • **
  • Posts: 94
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9626 on: February 21, 2023, 06:55:53 AM »

My question is: what's stopping you from exposing the vast majority of simple getter/setter methods that are present in implementing classes but are not present in the API? ButtonAPI's being just an example, there are plenty of cases like this - had a comment on getTurretGunSpriteName(), where the method was right there in the class but it required indirect reflection to get to use it - said method being added by you in upcoming patch too.

Mainly time and a reason to do it. Exposing everything that could be reasonably exposed via the API would be a very substantial undertaking, and a lot of older stuff specifically wasn't written with it in mind. Stuff gets added to the API, generally speaking when:
1) I need to use it from code that's outside of core, or
2) Someone asks for it

So, given that second one - just added these and a few more to ButtonAPI :)

(There are some cases where the methods are unsuitable for external use for whatever reason, but that I think is fairly rare. But e.g. exposing specific things from within core code that aren't exposed at all may be another matter, a rats nest of dependencies that has to all be exposed in some way...)


what layer does a BaseEveryFrameCombatPlugin's renderInUICoords() method render on?
or is it all of them? having some wierdness with colours that could be explained by this; the alpha of anything I render seems to be set to full

edit : did a test w/ a sprite & it seems like the alpha is just getting thrown away, is there any way for me to fix this on my end? attached a screenshot below.

Above all of them, and below the rest of the UI. No idea what's going on with the sprite - did you set its blend mode to something weird? This has nothing to do with where it's being rendered, I don't think; looks to me like some kind of error on your end more than likely!


What is the correct usage of CombatEngineAPI.spawnProjectile(ShipAPI ship, WeaponAPI weapon, String weaponId, String projSpecId, Vector2f point, float angle, Vector2f shipVelocity);?

Every time I have tried to use it, it crashes with a nullpointerexception in the constructor of either MovingRay or BallisticProjectile. For example calling this method with non-null variables, and with the strings "lightdualac" and "lightdualac_shot" will cause a crash. This makes it impossible to spawn projectiles that are indirectly spawned via MIRV missiles, e.g. the "sabot_warhead2" projectile. Can this be clarified please?

Hmm - it's used a bunch of times in the API for things like mines, some Omega weapons, etc. Also, data.scripts.plugins.TestCombatPlugin calls this to spray a bunch of lightmg shots, and I recall this working.

how do you get if a planetary market has a com relay, via code?

Is it like this? sector.getEntityById(Entities.COMM_RELAY) / sector.getEntityById(Entities.COMM_RELAY_MAKESHIFT)

I am unsure

You can do:
market.hasCondition(Conditions.COMM_RELAY)

It's a hidden condition that doesn't show up and the comm relay script iirc manages it under the hood.


I need to get tags of specific IntelInfoPlugins. How do I get a hold of SectorMapAPI instance in order to call Set<String> getIntelTags(SectorMapAPI map)? Searched through, all the usages are only extensions of caller methods, nothing returns SectorMapAPI.

I'm pretty sure you can just pass in null for the map; intel plugins are supposed to handle that. The vanilla ones do (unless I messed up); I just added a comment to the javadoc to make this expectation clear. Worst case you could do this in a try/catch block, *shudder*.


Oh God... In the process of writing this I looked into the BaseIntelPlugin and realized that what I thought to be a completely legit mechanism of making the intel visible/hidden (as implied by the javadoc comment) is actually not a functioning feature at all. I guess I can't set intel items to be hidden/shown after all:

Oh wow, my apologies :(

Ah, this is a bug, actually - in the dev version, this code already has:
return TutorialMissionIntel.isTutorialInProgress() || hidden != null;
So looks like it came up or was reported and I fixed it up at some point.

thanks, will test this
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9627 on: February 21, 2023, 01:32:43 PM »

Above all of them, and below the rest of the UI. No idea what's going on with the sprite - did you set its blend mode to something weird? This has nothing to do with where it's being rendered, I don't think; looks to me like some kind of error on your end more than likely!

ah-ha, thank you!
I didn't touch the blending at all ... which included forgetting to set the cap that turned it on, fixed that and it all works fine now!

bananana

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9628 on: February 22, 2023, 12:56:14 AM »

is it possible to change the time for how long the hit glow stays on the beam end point after beam is no longer hitting anything ?

is it possible to change how long the takeoff/landing animation plays for a given fighter, or all fighters in wing? and get the current progress of said animation?
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Zsar

  • Captain
  • ****
  • Posts: 279
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9629 on: February 22, 2023, 08:30:01 AM »

Can I get a FleetEncounterContextPlugin with populated DataForEncounterSide? Currently it seems that only CampaignEventListener#reportEncounterLootGenerated provides such a structure to mod-reachable code, but that one always has empty #disabledInLastEngagement, #destroyedInLastEngagement members, even if spawned from an ending battle where I observed ships being disabled/destroyed.

I kind of expect to get one from CampaignEventListener#reportBattleFinished but cannot find a way.

... Going to put that into the API requests thread, if not, but wanted to ask here first in case I am just blind.
Logged
Pages: 1 ... 640 641 [642] 643 644 ... 706