Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** DRG - Custom Terrain Tags
- # Version : 1.00
- # Author : LiTTleDRAgo
- #==============================================================================
- #============================================================================
- # ** RPG::MapInfo
- #----------------------------------------------------------------------------
- # This class handles the map info.
- #============================================================================
- $data_maps = load_data("Data/MapInfos.rxdata")
- class RPG::MapInfo
- def name
- v = @name.gsub(/\\[Nn]\[(\d+)\]/) {$game_actors[$1.to_i].nil? ? '' :
- $game_actors[$1.to_i].name}
- return v.gsub(/\[.*\]/) {""}
- end
- end
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # This class handles the map. It includes scrolling and passable determining
- # functions. Refer to "$game_map" for the instance of this class.
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Alias Method
- #--------------------------------------------------------------------------
- alias drg2032013_setup setup
- #--------------------------------------------------------------------------
- # * Setup
- #--------------------------------------------------------------------------
- def setup(map_id)
- setup_custom_terrain_tags(map_id)
- drg2032013_setup(map_id)
- end
- #--------------------------------------------------------------------------
- # * Setup custom_terrain_tags
- #--------------------------------------------------------------------------
- def setup_custom_terrain_tags(map_id = @map_id)
- map_data = $data_maps[map_id]
- @temp_terrain = {}
- return if map_data.nil?
- if map_data.instance_variable_get(:@name)[/<Tags(\d+)>/i]
- load_data = $1.to_i
- end
- if load_data
- @map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
- data = load_data(sprintf("Data/Map%03d.rxdata", load_data))
- if [data.width, data.height] != [@map.width, @map.height]
- raise "The map dimension is different"
- end
- data.events.keys.each {|i|
- @temp_terrain[i] = Game_Event.new(load_data, data.events[i])
- s = [@temp_terrain[i].direction,@temp_terrain[i].pattern]
- x = [@temp_terrain[i].x, @temp_terrain[i].y]
- @temp_terrain[x] = case @temp_terrain[i].character_name
- when 'Terrain_Tags01'
- case s[0]
- when 2,4,6,8
- case @temp_terrain[i].pattern
- when 0 then s[0]==2 ? (0) : s[0]==4 ? (4) : s[0]==6 ? (8) : (12)
- when 1 then s[0]==2 ? (1) : s[0]==4 ? (5) : s[0]==6 ? (9) : (13)
- when 2 then s[0]==2 ? (2) : s[0]==4 ? (6) : s[0]==6 ? (10) : (14)
- when 3 then s[0]==2 ? (3) : s[0]==4 ? (7) : s[0]==6 ? (11) : (15)
- end
- end
- end }
- end
- end
- #--------------------------------------------------------------------------
- # * Get Terrain Tag
- #--------------------------------------------------------------------------
- alias drg2032013_terrain_tag terrain_tag
- def terrain_tag(x, y)
- result = @temp_terrain[[x,y]] || drg2032013_terrain_tag(x, y)
- return result
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement