Author Topic: Possible to apply an effect to every system in a particular Galaxy?  (Read 663 times)

diencephalon

  • Sentient
  • **
  • Posts: 57
  • Karma: +5/-0
    • View Profile
Playing some multiplayer games with my friends, we generally have multiple smallish galaxies with pretty large system spacing, and I've noticed that blowing up the Black Hole seems to apply graded damage in a sphere 100,000 units in radius. I was planning on modding /scripts/server/objects/star.as to rework the distance based damage factor into a distance based delay, but otherwise apply fatal damage to *every* star in a Galaxy, but looking through the scripts (mapgeneration in particular) I can't see any actual hierarchy from Galaxy/Black Hole to Systems/Stars.

I could do it positionally (if more than 1 Black Holes exists, on destruction for each system figure out if it was the closest black hole and if so apply systemdamage), but that seems clumsy, wasteful, and likely to result in weirdness if there are dumbbell, corkscrew or irregular galaxies floating about (which there always are in our games).

Is there a more elegant way to cycle through the systems 'belonging' to one particular galaxy?

Thanks.
« Last Edit: June 02, 2015, 06:56:46 PM by diencephalon »

dalolorn

  • Sentient
  • **
  • Posts: 199
  • Karma: +7/-0
  • ABEM Developer
    • View Profile
Re: Possible to apply an effect to every system in a particular Galaxy?
« Reply #1 on: June 03, 2015, 04:55:27 AM »
Unfortunately, as far as I know, this sort of thing isn't really stored by the game.

Have you tried looking into the map generation scripts (the ones in maps/MapName/, not the ones in scripts/)?

Yulgalminakf

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Possible to apply an effect to every system in a particular Galaxy?
« Reply #2 on: June 23, 2015, 12:17:33 PM »
"..\Steam\steamapps\common\Star Ruler 2\scripts\server\map_generation.as" contains a class called "GalaxyData" defined all the way at the bottom. In it, it has a list of all the systems surrounding the black hole. At the top of the file there's "array<GalaxyData@> generatedGalaxies", which I'm assuming is populated with all the generated galaxies (huh-doy). The only problem is (and I'm having difficulties with this myself) importing into a file contained in "scripts/definitions". If I find any solutions, I'll be sure to let you know.

Edit: I finally found the solution! Add "#section server" above any code that deals with stuff in the server.
« Last Edit: June 23, 2015, 05:58:36 PM by Yulgalminakf »

dalolorn

  • Sentient
  • **
  • Posts: 199
  • Karma: +7/-0
  • ABEM Developer
    • View Profile
Re: Possible to apply an effect to every system in a particular Galaxy?
« Reply #3 on: June 24, 2015, 04:37:25 AM »
Well, good luck with this.

I should note, though, that to my knowledge, the only way to see a black hole in the base game is to play a Spiral Galaxy with more than X systems, which causes the galaxy to spawn with a black hole in the center. For the moment, multiple black holes in one galaxy can only occur in ABEM.