Skip to content

Commit 9f2a14e

Browse files
committed
Add Quasars
1 parent f998750 commit 9f2a14e

File tree

10 files changed

+56
-8
lines changed

10 files changed

+56
-8
lines changed
160 KB
Loading
350 KB
Loading
42.3 KB
Loading

SBA_Serv/GUI/ObjWrappers/NebulaWrapper.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@
44
from GUIEntity import GUIEntity
55
from World.WorldMath import intpos
66
from GUI.Helpers import wrapcircle, debugfont
7-
from World.WorldEntities import BlackHole
7+
from World.WorldEntities import Quasar
88
from GUI.GraphicsCache import Cache
99

1010
class NebulaGUI(GUIEntity):
1111
"""description of class"""
1212
def __init__(self, nebula, world):
1313
super(NebulaGUI, self).__init__(nebula, world)
14-
self._imageName = "Nebula/Nebula" + repr(int(nebula.major) * 2) + "x" + repr(int(nebula.minor) * 2) + "-"
15-
self._imageName = self._imageName + str(random.randint(1, Cache().getMaxImages(self._imageName)))
14+
if isinstance(nebula, Quasar):
15+
self._imageName = "Nebula/Quasar"
16+
else:
17+
self._imageName = "Nebula/Nebula"
18+
self._imageName += repr(int(nebula.major) * 2) + "x" + repr(int(nebula.minor) * 2) + "-"
19+
self._imageName += str(random.randint(1, Cache().getMaxImages(self._imageName)))
1620
self._dist = nebula.minor
1721
self.zorder = -5
1822

SBA_Serv/World/WorldCommands.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def __init__(self, obj, short=1):
525525
def execute(self, t):
526526
bpull = 500
527527
for body in self._obj.in_celestialbody:
528-
if isinstance(body, WorldEntities.CelestialBody): # Nebula, BlackHoles, Stars, Constellation
528+
if isinstance(body, WorldEntities.CelestialBody) and not isinstance(body, WorldEntities.Quasar): # Nebula, BlackHoles, Stars, Constellation
529529
self._obj.energy += t * 24
530530
bpull = body.pull
531531
break
@@ -567,6 +567,10 @@ def isComplete(self):
567567
return self._done
568568

569569
def execute(self, t):
570+
# Can't raise shields in Quasar
571+
if any(isinstance(y, WorldEntities.Quasar) for y in self._obj.in_celestialbody):
572+
self._done = True
573+
570574
if self._sound:
571575
self._sound = False
572576
self._obj.player.sound = "SHIELD"

SBA_Serv/World/WorldEntities.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,31 @@ def spawn(world, cfg, pos=None):
216216
world.append(n)
217217
return n
218218

219+
class Quasar(Nebula):
220+
"""
221+
Quasars are an odd shape and act like a Nebula.
222+
223+
They also reduce energy regen, drain shields, and prevent shields from working.
224+
"""
225+
def __init__(self, pos, size=(384, 256), pull=1000, mass=-1):
226+
super(Quasar, self).__init__(pos, size, pull, mass)
227+
228+
def update(self, t):
229+
# Objects in Quasars lose energy and shields
230+
for obj in self.in_celestialbody:
231+
if isinstance(obj, Ship):
232+
obj.energy -= (obj.energyRechargeRate * 0.75) * t
233+
obj.shield -= (obj.shieldConversionRate * 0.75) * t
234+
235+
super(Quasar, self).update(t)
236+
237+
@staticmethod
238+
def spawn(world, cfg, pos=None):
239+
if pos == None:
240+
pos = getPositionAwayFromOtherObjects(world, cfg.getint("Quasar", "buffer_object"), cfg.getint("Quasar", "buffer_edge"))
241+
n = Quasar(pos, random.choice(eval(cfg.get("Quasar", "sizes"))), cfg_rand_min_max(cfg, "Quasar", "pull"))
242+
world.append(n)
243+
return n
219244

220245
class Planet(Influential, PhysicalRound):
221246
"""

SBA_Serv/default.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ sizes=[(512,128),(512,144),(512,256),(384,144),(384,256)]
114114
pull_min=1750
115115
pull_max=2500
116116

117+
[Quasar]
118+
number = 0
119+
buffer_object = 128
120+
buffer_edge = 128
121+
sizes=[(512,384),(384,256)]
122+
pull_min=500
123+
pull_max=1250
124+
117125
[Constellation]
118126
number = 2
119127
buffer_object = 48

SBA_Serv/game_discoveryquest.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ number = 2
1212
number = 2
1313

1414
[Nebula]
15-
number = 3
15+
number = 2
16+
17+
[Quasar]
18+
number = 1
1619

1720
[Asteroid]
1821
number = 10
@@ -65,6 +68,7 @@ points_asteroid = 2
6568
points_planet = 2
6669
points_blackhole = 3
6770
points_nebula = 1
71+
points_quasar = 5
6872
points_star = 3
6973
points_outpost = 2
7074
points_dragon = 6

doc/client/guides/objects.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ There are many different types of objects you may encounter during your travels.
1212
<img src="{{ site.baseurl }}/img/obj/BlackHole.png" alt="Black Hole" class="left"/>
1313
**Black Holes** are stationary and you cannot collide with them. They have massive gravity wells which can be hard to escape from with thrusters alone. Staying too long in the center of a black hole can crush your ship.
1414

15-
<img src="{{ site.baseurl }}/img/obj/Constellation.png" alt="Constellation" class="left"/>
16-
**Constellations** are stationary decorations. They may be useful for research in Discovery Quest though.
15+
<img src="{{ site.baseurl }}/img/obj/Constellation.png" alt="Constellation" class="left"/>
16+
**Constellations** are stationary decorations. They may be useful for research in Discovery Quest though or collecting Energy.
1717

1818
<img src="{{ site.baseurl }}/img/obj/Dragon.png" alt="Dragon" class="left"/>
1919
**Dragons** are hungry for ships. If you are in their site, they will prey upon you.
2020

2121
<img src="{{ site.baseurl }}/img/obj/Nebula.png" alt="Nebula" class="left"/>
22-
**Nebulas** are stationary and you cannot collide with them. They will apply a drag to your ship and slow it down. You can Lower your Energy Scoop to collect energy from them.
22+
**Nebulas** are stationary and you cannot collide with them. They will apply a drag to your ship and slow it down. You can Lower your Energy Scoop to collect energy from them. Other ships cannot detect you within a Nebula.
2323

2424
<img src="{{ site.baseurl }}/img/obj/Planet.png" alt="Planet" class="left"/>
2525
**Planets** are stationary and have a gravity well. Colliding with them will cause damage.
2626

27+
<img src="{{ site.baseurl }}/img/obj/Quasar.png" alt="Quasar" class="left"/>
28+
**Quasars** are dangerous and prevent Shielding, drain your shields, and slow down energy regeneration on your ship. In addition to the same properties as Nebulas above; however, they can't be mined for Energy.
29+
2730
<img src="{{ site.baseurl }}/img/obj/Mine.png" alt="Space Mine" class="left"/>
2831
**Space Mines** are dropped by enemy ships and cause explosions which can damage you and send you off course. Some may track and follow your ship.
2932

doc/img/obj/Quasar.png

93.8 KB
Loading

0 commit comments

Comments
 (0)