Пример #1
0
    def custom_init(self, nart):
        # Create a building within the town.
        building = self.register_element(
            "_EXTERIOR",
            ghterrain.ResidentialBuilding(
                waypoints={
                    "DOOR": ghwaypoints.ScrapIronDoor(name="Town Hall")
                },
                tags=[pbge.randmaps.CITY_GRID_ROAD_OVERLAP]),
            dident="LOCALE")

        # Add the interior scene.
        team1 = teams.Team(name="Player Team")
        team2 = teams.Team(name="Civilian Team",
                           faction=self.elements["METRO_FACTION"])
        intscene = gears.GearHeadScene(
            35,
            35,
            "Town Hall",
            player_team=team1,
            civilian_team=team2,
            attributes=(gears.tags.SCENE_PUBLIC, gears.tags.SCENE_BUILDING,
                        gears.tags.SCENE_GOVERNMENT),
            scale=gears.scale.HumanScale)
        intscenegen = pbge.randmaps.SceneGenerator(
            intscene, gharchitecture.ResidentialBuilding())
        self.register_scene(nart,
                            intscene,
                            intscenegen,
                            ident="INTERIOR",
                            dident="LOCALE")
        foyer = self.register_element(
            '_introom',
            pbge.randmaps.rooms.ClosedRoom(
                anchor=pbge.randmaps.anchors.south, ),
            dident="INTERIOR")

        mycon2 = plotutility.TownBuildingConnection(
            self,
            self.elements["LOCALE"],
            intscene,
            room1=building,
            room2=foyer,
            door1=building.waypoints["DOOR"],
            move_door1=False)

        npc = self.register_element(
            "LEADER",
            gears.selector.random_character(
                self.rank,
                local_tags=self.elements["LOCALE"].attributes,
                job=gears.jobs.ALL_JOBS["Mayor"],
                faction=self.elements["METRO_FACTION"]))
        npc.place(intscene, team=team2)

        self.town_origin_ready = True

        bodyguard = self.register_element(
            "BODYGUARD",
            gears.selector.random_character(
                self.rank,
                local_tags=self.elements["LOCALE"].attributes,
                job=gears.jobs.choose_random_job(
                    (gears.tags.Military, ),
                    self.elements["LOCALE"].attributes),
                faction=self.elements["METRO_FACTION"]))
        bodyguard.place(intscene, team=team2)

        return True
Пример #2
0
    def custom_init(self, nart):
        npc_name, building_name = self.generate_npc_and_building_name()

        # Create a building within the town.
        building = self.register_element(
            "_EXTERIOR",
            ghterrain.ResidentialBuilding(
                waypoints={"DOOR": ghwaypoints.GlassDoor(name=building_name)},
                tags=[pbge.randmaps.CITY_GRID_ROAD_OVERLAP]),
            dident="METROSCENE")

        # Add the interior scene.
        team1 = teams.Team(name="Player Team")
        team2 = self.register_element("FOYER_TEAM",
                                      teams.Team(name="Civilian Team"))
        intscene = gears.GearHeadScene(50,
                                       35,
                                       building_name,
                                       player_team=team1,
                                       civilian_team=team2,
                                       attributes=(gears.tags.SCENE_PUBLIC,
                                                   gears.tags.SCENE_BUILDING,
                                                   gears.tags.SCENE_MEETING),
                                       scale=gears.scale.HumanScale)

        intscenegen = pbge.randmaps.PackedBuildingGenerator(
            intscene, gharchitecture.ResidentialBuilding())
        self.register_scene(nart,
                            intscene,
                            intscenegen,
                            ident="LOCALE",
                            dident="METROSCENE")
        foyer = self.register_element('_introom',
                                      pbge.randmaps.rooms.ClosedRoom(
                                          width=random.randint(20, 25),
                                          height=random.randint(11, 15),
                                          anchor=pbge.randmaps.anchors.south,
                                      ),
                                      dident="LOCALE")
        foyer.contents.append(team2)

        mybar = ghrooms.BarArea(random.randint(5, 10),
                                random.randint(2, 3),
                                anchor=pbge.randmaps.anchors.north)
        foyer.contents.append(mybar)

        barteam = self.register_element(
            "BAR_TEAM", teams.Team(name="Bar Team", allies=[team2]))
        mybar.contents.append(barteam)

        npc = self.register_element(
            "BARTENDER",
            gears.selector.random_character(
                self.rank,
                name=npc_name,
                local_tags=self.elements["METROSCENE"].attributes,
                job=gears.jobs.ALL_JOBS["Bartender"]))
        npc.place(intscene, team=barteam)

        mycon = plotutility.TownBuildingConnection(
            self,
            self.elements["METROSCENE"],
            intscene,
            room1=building,
            room2=foyer,
            door1=building.waypoints["DOOR"],
            move_door1=False)

        return True