Example #1
0
    def custom_init(self, nart):
        # Create the shopkeeper
        npc1 = self.register_element("SHOPKEEPER", gears.selector.random_character(
            self.rank, job=gears.jobs.ALL_JOBS["Bartender"]))

        self.shopname = self._generate_shop_name()

        # Create a building within the dungeon.
        building = self.register_element(
            "_EXTERIOR", ghterrain.BrickBuilding(
                waypoints={"DOOR": ghwaypoints.WoodenDoor(name=self.shopname)},
                door_sign=(ghterrain.CafeSign1East, ghterrain.CafeSign1South)
            ),
            dident="LOCALE")

        # Add the interior scene.
        team1 = teams.Team(name="Player Team")
        team2 = teams.Team(name="Civilian Team")
        intscene = gears.GearHeadScene(
            35, 35, self.shopname, player_team=team1, civilian_team=team2,
            attributes=(gears.tags.SCENE_SEMIPUBLIC, gears.tags.SCENE_BUILDING, gears.tags.SCENE_CULTURE),
            scale=gears.scale.HumanScale)

        intscenegen = pbge.randmaps.PackedBuildingGenerator(
            intscene, gharchitecture.DefaultBuilding(floor_terrain=ghterrain.HardwoodFloor)
        )
        self.register_scene(nart, intscene, intscenegen, ident="INTERIOR", dident="LOCALE")
        foyer = self.register_element('FOYER', pbge.randmaps.rooms.ClosedRoom(width=random.randint(20, 25),
                                                                              height=random.randint(11, 15),
                                                                              anchor=pbge.randmaps.anchors.south),
                                      dident="INTERIOR")

        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)
        npc1.place(intscene, team=barteam)

        myfloor = pbge.randmaps.rooms.Room(foyer.width - 2, foyer.height - mybar.height - 2,
                                           anchor=pbge.randmaps.anchors.south,
                                           decorate=gharchitecture.RestaurantDecor())
        foyer.contents.append(myfloor)

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

        self.got_explanation = False
        self.coffee_price = self.rank * 10

        return True
Example #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
    def custom_init(self, nart):
        # Create the shopkeeper
        npc1 = self.register_element(
            "SHOPKEEPER",
            gears.selector.random_character(
                self.rank,
                local_tags=self.elements["LOCALE"].attributes,
                job=gears.jobs.ALL_JOBS["Bartender"]))
        npc1.name = self.elements.get("NPC_NAME", "") or npc1.name

        self.shopname = self.elements.get("SHOP_NAME",
                                          "") or self._generate_shop_name()

        # Create a building within the town.
        building = self.register_element(
            "_EXTERIOR",
            get_building(
                self,
                ghterrain.ResidentialBuilding,
                waypoints={"DOOR": ghwaypoints.GlassDoor(name=self.shopname)},
                door_sign=(ghterrain.TavernSign1East,
                           ghterrain.TavernSign1South),
                tags=[
                    pbge.randmaps.CITY_GRID_ROAD_OVERLAP,
                    pbge.randmaps.IS_CITY_ROOM, pbge.randmaps.IS_CONNECTED_ROOM
                ]),
            dident="LOCALE")

        # Add the interior scene.
        team1 = teams.Team(name="Player Team")
        team2 = teams.Team(name="Civilian Team")
        intscene = gears.GearHeadScene(
            35,
            35,
            self.shopname,
            player_team=team1,
            civilian_team=team2,
            faction=self.elements.get("SHOP_FACTION"),
            attributes=self.elements.get("INTERIOR_TAGS",
                                         (gears.tags.SCENE_PUBLIC, )) +
            (gears.tags.SCENE_BUILDING, gears.tags.SCENE_MEETING,
             gears.tags.SCENE_CULTURE),
            scale=gears.scale.HumanScale)

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

        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)
        npc1.place(intscene, team=barteam)

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

        myfloor = pbge.randmaps.rooms.Room(
            foyer.width - 2,
            foyer.height - mybar.height - 2,
            anchor=pbge.randmaps.anchors.south,
            decorate=gharchitecture.RestaurantDecor())
        foyer.contents.append(myfloor)

        self.add_sub_plot(nart, "TAVERN_BONUS", necessary=False)

        return True