Skip to content

Commit

Permalink
EscortShip mission is basically working but it needs ship graphics.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwvhewitt committed Jul 23, 2024
1 parent a70158c commit 0e27afe
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion design/Trailblazer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Mecha
portrait = "mecha_trailblazer.png"
desc = "The Trailblazer is Maquise Spinner's scout mecha design. The Silver Knights frequently train new Hopefuls using Trailblazers as well."

environment_list = (GroundEnv,UrbanEnv,SpaceEnv,AquaticEnv)
environment_list = (GroundEnv,UrbanEnv,SpaceEnv)
faction_list = (None,)
role_list = (Support,)

Expand Down
7 changes: 7 additions & 0 deletions game/content/gharchitecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ class MechaScaleSemiDeadzoneRuins(GearHeadArchitecture):
DEFAULT_ROOM_CLASSES = (ghrooms.WreckageRoom, ghrooms.MSRuinsRoom)


class MechaScaleOcean(GearHeadArchitecture):
ENV = gears.tags.AquaticEnv
DEFAULT_CONVERTER = pbge.randmaps.converter.BasicConverter(None)
DEFAULT_FLOOR_TERRAIN = ghterrain.Water
DEFAULT_ROOM_CLASSES = (pbge.randmaps.rooms.OpenRoom,)


class HumanScaleDeadzone(GearHeadArchitecture):
ENV = gears.tags.GroundEnv
# DEFAULT_WALL_TERRAIN = ghterrain.DefaultWall
Expand Down
20 changes: 11 additions & 9 deletions game/content/ghplots/dd_intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,17 @@ def _skip_first_mission(self,camp):

def _test_mission(self,camp):
return missionbuilder.BuildAMissionSeed(
camp, "Test Mission",
self.elements["LOCALE"], self.elements["ENTRANCE"],
allied_faction=gears.factions.DeadzoneFederation,
enemy_faction=gears.factions.AegisOverlord, rank=25,
objectives=(missionbuilder.BAMO_TEST_MISSION,),
one_chance=True,
scenegen=pbge.randmaps.SceneGenerator, architecture=gharchitecture.MechaScaleSemiDeadzone(),
cash_reward=100
)
camp, "Test Mission",
self.elements["LOCALE"], self.elements["ENTRANCE"],
allied_faction=gears.factions.DeadzoneFederation,
enemy_faction=gears.factions.AegisOverlord, rank=25,
objectives=(missionbuilder.BAMO_TEST_MISSION,),
one_chance=True,
#scenegen=pbge.randmaps.SceneGenerator, architecture=gharchitecture.MechaScaleSemiDeadzone(),
scenegen=pbge.randmaps.SceneGenerator, architecture=gharchitecture.MechaScaleOcean(),
adv_type="BAM_ESCORT_MISSION", custom_elements={"ENTRANCE_ANCHOR": pbge.randmaps.anchors.west},
cash_reward=100
)


class DZDIntro_CousinIntro(DZDIntro_GetInTheMekShimli):
Expand Down
6 changes: 5 additions & 1 deletion game/content/ghplots/mission_bigobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,14 @@ def custom_init(self, nart):
def t_START(self, camp: gears.GearHeadCampaign):
if not self.did_init:
self.subplots["THREAT"].activate(camp)
self.did_init = True
myprop = self.elements["SHIP"]
for p in myprop.get_members_in_play(camp):
self.initial_health += p.current_health
my_enemies = self.elements[CTE_ENEMY_TEAM].get_members_in_play(camp)
if my_enemies:
game.combat.enter_combat(camp, my_enemies[0])
self.did_init = True


def t_COMBATROUND(self, camp: gears.GearHeadCampaign):
myprop = self.elements["SHIP"]
Expand Down
8 changes: 7 additions & 1 deletion game/content/ghplots/missionbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,15 @@ class BuildAMissionPlot(Plot):
active = True
scope = "LOCALE"

DEFAULT_SCENE_WIDTH = 50
DEFAULT_SCENE_HEIGHT = 50

def custom_init(self, nart):
"""An empty map that will add subplots for the mission's objectives."""
team1 = teams.Team(name="Player Team")
myscene = gears.GearHeadScene(
50, 50, "Combat Zone", player_team=team1, scale=self.adv.scale,
self.DEFAULT_SCENE_WIDTH, self.DEFAULT_SCENE_HEIGHT,
"Combat Zone", player_team=team1, scale=self.adv.scale,
combat_music=self.elements["COMBAT_MUSIC"], exploration_music=self.elements["EXPLO_MUSIC"],
environment=self.adv.environment,
attributes=self.elements.get("SCENE_ATTRIBUTES", (gears.tags.SCENE_OUTDOORS,))
Expand Down Expand Up @@ -420,6 +424,8 @@ class EscortMissionPlot(BuildAMissionPlot):
# Kinda like the road mission, but we've got a ESCORT_ROOM in which to deploy whatever we're escorting and a
# clear path to the other side of the map.
LABEL = "BAM_ESCORT_MISSION"
DEFAULT_SCENE_WIDTH = 60
DEFAULT_SCENE_HEIGHT = 60

def _generate_entrance_room(self):
# Set ENTRANCE_ANCHOR, ENTRANCE_ROOM, and _ENTRANCE
Expand Down
2 changes: 1 addition & 1 deletion game/content/megaprops.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ def __init__(self, *args, rank=50, **kwargs):
size = max(min(rank//10 + 1, 10), 2)
length = max(min(rank//20 + 1, 5), 2)
for t in range(length):
self.contents.append(gears.base.Prop(size=size, name="Ship", imagename="prop_block.png"))
self.contents.append(gears.base.Prop(size=size, name="Ship", imagename="prop_block.png", altitude=0))

#print(MegaProp._generate_spiral(20))
1 change: 1 addition & 0 deletions history.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* PlacableThing's altitude property now does something
* Combat can be set to keep going even if there are no active enemies on map
* Room contents with fixed positions will now be placed on map
* Props are immovable even after they are destroyed
Expand Down
7 changes: 5 additions & 2 deletions pbge/scenes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ class PlaceableThing(KeyObject):
"""A thing that can be placed on the map."""

# By default, a hidden thing just isn't displayed.
def __init__(self, hidden=False, **keywords):
def __init__(self, hidden=False, altitude=None, **keywords):
self.hidden = hidden
self.pos = None
self.offset_pos = None
self.altitude = altitude
super(PlaceableThing, self).__init__(**keywords)

def place(self, scene, pos=None, team=None):
Expand Down Expand Up @@ -366,7 +367,9 @@ def tile_altitude(self, x, y):
return 0

def model_altitude(self, m, x, y):
if not hasattr(m, "mmode") or not m.mmode or m.mmode.altitude is None:
if hasattr(m, "altitude") and isinstance(m.altitude, int):
return m.altitude
elif not hasattr(m, "mmode") or not m.mmode or m.mmode.altitude is None:
return self.tile_altitude(x, y)
else:
return max(self._map[x][y].altitude(), m.mmode.altitude)
Expand Down

0 comments on commit 0e27afe

Please sign in to comment.