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["Mechanic"])) 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.IndustrialBuilding, waypoints={"DOOR": ghwaypoints.GlassDoor(name=self.shopname)}, door_sign=self._generate_shop_sign(), 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_GARAGE), scale=gears.scale.HumanScale) intscenegen = pbge.randmaps.SceneGenerator( intscene, gharchitecture.IndustrialBuilding()) self.register_scene(nart, intscene, intscenegen, ident="INTERIOR", dident="LOCALE") foyer = self.register_element( 'FOYER', pbge.randmaps.rooms.ClosedRoom( anchor=pbge.randmaps.anchors.south, decorate=gharchitecture.FactoryDecor()), dident="INTERIOR") mycon2 = plotutility.TownBuildingConnection( nart, self, self.elements["LOCALE"], intscene, room1=building, room2=foyer, door1=building.waypoints["DOOR"], move_door1=False) npc1.place(intscene, team=team2) self.shop = services.Shop( npc=npc1, ware_types=services.MECHA_STORE, rank=self.rank + random.randint(0, 15), shop_faction=self.elements.get("SHOP_FACTION")) foyer.contents.append(ghwaypoints.MechEngTerminal()) return True
def custom_init(self, nart): # Create a building within the town. npc_name, garage_name = self.generate_npc_and_building_name() building = self.register_element( "_EXTERIOR", ghterrain.ScrapIronBuilding( waypoints={ "DOOR": ghwaypoints.ScrapIronDoor(name=garage_name) }, 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") intscene = gears.GearHeadScene(35, 35, garage_name, player_team=team1, civilian_team=team2, attributes=(gears.tags.SCENE_PUBLIC, gears.tags.SCENE_GARAGE), scale=gears.scale.HumanScale) intscenegen = pbge.randmaps.SceneGenerator( intscene, gharchitecture.ScrapIronWorkshop()) 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") foyer.contents.append(ghwaypoints.MechEngTerminal()) foyer.contents.append(ghwaypoints.MechaPoster()) mycon2 = plotutility.TownBuildingConnection( self, self.elements["LOCALE"], intscene, room1=building, room2=foyer, door1=building.waypoints["DOOR"], move_door1=False) npc = self.register_element( "SHOPKEEPER", gears.selector.random_character( self.rank, name=npc_name, local_tags=self.elements["LOCALE"].attributes, job=gears.jobs.ALL_JOBS["Mechanic"])) npc.place(intscene, team=team2) self.shop = services.Shop( npc=npc, shop_faction=gears.factions.TerranDefenseForce, ware_types=services.BARE_ESSENTIALS_STORE, rank=self.rank // 4) return True