From 20cb34af5017de3b7a7475326beadf3630326a61 Mon Sep 17 00:00:00 2001 From: "FunnyMan3595 (Charlie Nolan)" Date: Thu, 25 Oct 2007 01:38:24 -0500 Subject: [PATCH] basic_tiles is now a part of the mod. --- engine/basic_tiles.py | 121 ++--------------------------------- {engine => main_game}/basic_tiles.py | 20 ++++++ main_game/tiles.py | 12 ++++ 3 files changed, 38 insertions(+), 115 deletions(-) rewrite engine/basic_tiles.py (99%) copy {engine => main_game}/basic_tiles.py (77%) diff --git a/engine/basic_tiles.py b/engine/basic_tiles.py dissimilarity index 99% index f4cde6e..b4344ba 100644 --- a/engine/basic_tiles.py +++ b/engine/basic_tiles.py @@ -1,115 +1,6 @@ -from engine.tile import * -from engine.shop import make_shop - -class empty(tile): - type = "empty" - -class no_op(empty): - def go_to(self, teleported = False): - return super(no_op, self).go_to(teleported) -no_regen = no_encounters = no_op - -class regen(empty): - def go_to(self, teleported = False): - went = super(regen, self).go_to(teleported) - if went: - self.hp_mp_ticks() - return went - -class random_encounters(empty): - def go_to(self, teleported = False): - went = super(random_encounters, self).go_to(teleported) - if went: - self.maybe_fight() - return went - -class door(empty): - save = ("open",) - type = "door" - def __init__(self, map_pos, *args): - super(door, self).__init__(map_pos) - self.open = False - def go_to(self, teleported = False): - if not self.open: - self.open = True - self.type = "door_open" - return False - return super(door, self).go_to(teleported) - -class warp_tile(empty): - def __init__(self, map_pos, target_row, target_col, *args): - # Pass the buck. - super(warp_tile, self).__init__(map_pos) - - # If we got ('s', 's'), the start square of the map, we preserve it. - # Otherwise, we process row and col into integers. - if target_row == target_col == 's': - row = col = 's' - else: - row = self.argument("target row", target_row, int) - col = self.argument("target col", target_col, int) - - # Save the target position. - self.target_pos = (row, col) - -class map_tile(warp_tile): - def __init__(self, map_pos, target_map, target_row = None, target_col = None, *args): - # If we got both row and col, we just pass those into warp_tile. - # If we got neither, we use ('s', 's'), the start square of the map. - if target_row != None and target_col == None: - raise MapException("target row without target col in tile map_tile on map", map_pos[0].name) - elif target_row == None: - (target_row, target_col) = ('s', 's') - - # Pass the buck. - warp_tile.__init__(self, map_pos, target_row, target_col) - - # Find and store the target map. - self.target_map = self.argument("target map", target_map, a_map) - -class tutorial(empty): - def __init__(self, map_pos, main_game = False, *args): - super(tutorial, self).__init__(map_pos) - self.main_game = self.argument("main game", main_game, bool) - - def tutorial(self): - # TODO: Exception - pass - - def go_to(self, teleported = False): - went = super(tutorial, self).go_to(teleported) - if went: - self.tutorial() - return went - -class shop(tile): - type = "shop" - save = ("shop",) - level = 1 - shop_args = {} - - def __init__(self, map_pos, level=None, *args): - super(shop, self).__init__(map_pos, *args) - - if level != None: - self.level = self.argument("shop level", level, int) - - self.shop = make_shop(self.level, **self.shop_args) - - def go_to(self, teleported = False): - game.ui.shop_mode(self.shop) - -class climb_tile(tile): - type = "step" - level = 1 - def __init__(self, map_pos, level = None, *args): - super(climb_tile, self).__init__(map_pos, *args) - - if level != None: - self.level = self.argument("climb level", level, int) - - def go_to(self, teleported = False): - if game.party.climb_level >= self.level: - return super(climb_tile, self).go_to(teleported) - else: - return False +# This file is part of Realism, which is Copyright FunnyMan3595 (Charlie Nolan) +# and licensed under the GNU GPL v3. For more details, see LICENSE in the main +# Realism directory. + +from mod_import import do_mod_import +do_mod_import("basic_tiles", globals()) diff --git a/engine/basic_tiles.py b/main_game/basic_tiles.py similarity index 77% copy from engine/basic_tiles.py copy to main_game/basic_tiles.py index f4cde6e..321c2d4 100644 --- a/engine/basic_tiles.py +++ b/main_game/basic_tiles.py @@ -1,3 +1,23 @@ +# This file is part of Realism, which is Copyright FunnyMan3595 (Charlie Nolan) +# and licensed under the GNU GPL v3. For more details, see LICENSE in the main +# Realism directory. + +# WARNING: All mod formats are under heavy development. They may change at any +# time, breaking old mods. For this reason, we DO NOT RECOMMEND making mods +# at this time. + +# This file defines the basic map tiles used in the game. These tiles cannot +# be used directly in a map, but they are used by the standard map tiles. For +# instance, a standard "safe" tile is the combination of the "no_encounters" +# and "regen" basic tiles. + +# This file has the same format as /basic_tiles.py. +# For a complete guide to modding, see MODDING, in the Realism main directory. + +# Like all the .py files, this is Python code. Most mod makers should be able +# to understand and adapt it, but knowledge of Python will help, and may allow +# you to do neat tricks. + from engine.tile import * from engine.shop import make_shop diff --git a/main_game/tiles.py b/main_game/tiles.py index 833b108..9bfd694 100644 --- a/main_game/tiles.py +++ b/main_game/tiles.py @@ -2,6 +2,18 @@ # and licensed under the GNU GPL v3. For more details, see LICENSE in the main # Realism directory. +# WARNING: All mod formats are under heavy development. They may change at any +# time, breaking old mods. For this reason, we DO NOT RECOMMEND making mods +# at this time. + +# This file defines the map tiles used in the game. It has the same format as +# /tiles.py. +# For a complete guide to modding, see MODDING, in the Realism main directory. + +# Like all the .py files, this is Python code. Most mod makers should be able +# to understand and adapt it, but knowledge of Python will help, and may allow +# you to do neat tricks. + from engine.tile import * import engine.basic_tiles as basic -- 2.11.4.GIT