From 0e27afedd940e4adb6d8456f51d2508544e406e9 Mon Sep 17 00:00:00 2001 From: jwvhewitt Date: Tue, 23 Jul 2024 23:23:20 +0900 Subject: [PATCH] EscortShip mission is basically working but it needs ship graphics. --- design/Trailblazer.txt | 2 +- game/content/gharchitecture.py | 7 +++++++ game/content/ghplots/dd_intro.py | 20 +++++++++++--------- game/content/ghplots/mission_bigobs.py | 6 +++++- game/content/ghplots/missionbuilder.py | 8 +++++++- game/content/megaprops.py | 2 +- history.md | 1 + pbge/scenes/__init__.py | 7 +++++-- 8 files changed, 38 insertions(+), 15 deletions(-) diff --git a/design/Trailblazer.txt b/design/Trailblazer.txt index 971f84e4..9aae49f5 100644 --- a/design/Trailblazer.txt +++ b/design/Trailblazer.txt @@ -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,) diff --git a/game/content/gharchitecture.py b/game/content/gharchitecture.py index 1a1c9332..f01394b6 100644 --- a/game/content/gharchitecture.py +++ b/game/content/gharchitecture.py @@ -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 diff --git a/game/content/ghplots/dd_intro.py b/game/content/ghplots/dd_intro.py index bd342b41..92c81755 100644 --- a/game/content/ghplots/dd_intro.py +++ b/game/content/ghplots/dd_intro.py @@ -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): diff --git a/game/content/ghplots/mission_bigobs.py b/game/content/ghplots/mission_bigobs.py index 2ca4cc37..2d207b54 100644 --- a/game/content/ghplots/mission_bigobs.py +++ b/game/content/ghplots/mission_bigobs.py @@ -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"] diff --git a/game/content/ghplots/missionbuilder.py b/game/content/ghplots/missionbuilder.py index 622a56f9..3c0cc75c 100644 --- a/game/content/ghplots/missionbuilder.py +++ b/game/content/ghplots/missionbuilder.py @@ -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,)) @@ -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 diff --git a/game/content/megaprops.py b/game/content/megaprops.py index cf82f77b..dd5e140c 100644 --- a/game/content/megaprops.py +++ b/game/content/megaprops.py @@ -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)) diff --git a/history.md b/history.md index 831cc179..6a02e76c 100644 --- a/history.md +++ b/history.md @@ -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 diff --git a/pbge/scenes/__init__.py b/pbge/scenes/__init__.py index 20d15dc1..5b646e1e 100644 --- a/pbge/scenes/__init__.py +++ b/pbge/scenes/__init__.py @@ -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): @@ -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)