Added decent spacing to all scripts thanks to Rubocop

This commit is contained in:
Maruno17
2021-12-18 15:25:40 +00:00
parent f7b76ae62e
commit d17fc40a47
207 changed files with 18577 additions and 18587 deletions

View File

@@ -19,7 +19,7 @@ class PokemonMapFactory
@maps[0] = Game_Map.new
@mapIndex = 0
oldID = ($game_map) ? $game_map.map_id : 0
setMapChanging(id,@maps[0]) if oldID!=0 && oldID!=@maps[0].map_id
setMapChanging(id, @maps[0]) if oldID != 0 && oldID != @maps[0].map_id
$game_map = @maps[0]
@maps[0].setup(id)
setMapsInRange
@@ -27,9 +27,9 @@ class PokemonMapFactory
end
def map
@mapIndex = 0 if !@mapIndex || @mapIndex<0
@mapIndex = 0 if !@mapIndex || @mapIndex < 0
return @maps[@mapIndex] if @maps[@mapIndex]
raise "No maps in save file... (mapIndex=#{@mapIndex})" if @maps.length==0
raise "No maps in save file... (mapIndex=#{@mapIndex})" if @maps.length == 0
if @maps[0]
echoln "Using next map, may be incorrect (mapIndex=#{@mapIndex}, length=#{@maps.length})"
return @maps[0]
@@ -39,21 +39,21 @@ class PokemonMapFactory
def hasMap?(id)
for map in @maps
return true if map.map_id==id
return true if map.map_id == id
end
return false
end
def getMapIndex(id)
for i in 0...@maps.length
return i if @maps[i].map_id==id
return i if @maps[i].map_id == id
end
return -1
end
def getMap(id,add = true)
def getMap(id, add = true)
for map in @maps
return map if map.map_id==id
return map if map.map_id == id
end
map = Game_Map.new
map.setup(id)
@@ -62,10 +62,10 @@ class PokemonMapFactory
end
def getMapNoAdd(id)
return getMap(id,false)
return getMap(id, false)
end
def getNewMap(playerX,playerY)
def getNewMap(playerX, playerY)
id = $game_map.map_id
conns = MapFactoryHelper.getMapConnections
if conns[id]
@@ -96,16 +96,16 @@ class PokemonMapFactory
# their transfer to that map.
def setCurrentMap
return if $game_player.moving?
return if $game_map.valid?($game_player.x,$game_player.y)
newmap = getNewMap($game_player.x,$game_player.y)
return if $game_map.valid?($game_player.x, $game_player.y)
newmap = getNewMap($game_player.x, $game_player.y)
return if !newmap
oldmap=$game_map.map_id
if oldmap!=0 && oldmap!=newmap[0].map_id
setMapChanging(newmap[0].map_id,newmap[0])
oldmap = $game_map.map_id
if oldmap != 0 && oldmap != newmap[0].map_id
setMapChanging(newmap[0].map_id, newmap[0])
end
$game_map = newmap[0]
@mapIndex = getMapIndex($game_map.map_id)
$game_player.moveto(newmap[1],newmap[2])
$game_player.moveto(newmap[1], newmap[2])
$game_map.update
pbAutoplayOnTransition
$game_map.refresh
@@ -144,17 +144,17 @@ class PokemonMapFactory
@fixup = false
end
def setMapChanging(newID,newMap)
Events.onMapChanging.trigger(self,newID,newMap)
def setMapChanging(newID, newMap)
Events.onMapChanging.trigger(self, newID, newMap)
end
def setMapChanged(prevMap)
Events.onMapChange.trigger(self,prevMap)
Events.onMapChange.trigger(self, prevMap)
@mapChanged = true
end
def setSceneStarted(scene)
Events.onMapSceneChange.trigger(self,scene,@mapChanged)
Events.onMapSceneChange.trigger(self, scene, @mapChanged)
@mapChanged = false
end
@@ -194,42 +194,42 @@ class PokemonMapFactory
end
# Only used by dependent events
def isPassableStrict?(mapID,x,y,thisEvent = nil)
def isPassableStrict?(mapID, x, y, thisEvent = nil)
thisEvent = $game_player if !thisEvent
map = getMapNoAdd(mapID)
return false if !map
return false if !map.valid?(x,y)
return false if !map.valid?(x, y)
return true if thisEvent.through
if thisEvent==$game_player
if thisEvent == $game_player
if !($DEBUG && Input.press?(Input::CTRL))
return false if !map.passableStrict?(x,y,0,thisEvent)
return false if !map.passableStrict?(x, y, 0, thisEvent)
end
else
return false if !map.passableStrict?(x,y,0,thisEvent)
return false if !map.passableStrict?(x, y, 0, thisEvent)
end
for event in map.events.values
next if event == thisEvent || !event.at_coordinate?(x, y)
return false if !event.through && event.character_name!=""
return false if !event.through && event.character_name != ""
end
return true
end
def getTerrainTag(mapid,x,y,countBridge = false)
def getTerrainTag(mapid, x, y, countBridge = false)
map = getMapNoAdd(mapid)
return map.terrain_tag(x,y,countBridge)
return map.terrain_tag(x, y, countBridge)
end
# NOTE: Assumes the event is 1x1 tile in size. Only returns one terrain tag.
def getFacingTerrainTag(dir = nil,event = nil)
tile = getFacingTile(dir,event)
def getFacingTerrainTag(dir = nil, event = nil)
tile = getFacingTile(dir, event)
return GameData::TerrainTag.get(:None) if !tile
return getTerrainTag(tile[0],tile[1],tile[2])
return getTerrainTag(tile[0], tile[1], tile[2])
end
def getTerrainTagFromCoords(mapid,x,y,countBridge = false)
tile = getRealTilePos(mapid,x,y)
def getTerrainTagFromCoords(mapid, x, y, countBridge = false)
tile = getRealTilePos(mapid, x, y)
return GameData::TerrainTag.get(:None) if !tile
return getTerrainTag(tile[0],tile[1],tile[2])
return getTerrainTag(tile[0], tile[1], tile[2])
end
def areConnected?(mapID1, mapID2)
@@ -268,38 +268,38 @@ class PokemonMapFactory
# Gets the distance from this event to another event. Example: If this event's
# coordinates are (2,5) and the other event's coordinates are (5,1), returns
# the array (3,-4), because (5-2=3) and (1-5=-4).
def getThisAndOtherEventRelativePos(thisEvent,otherEvent)
return [0,0] if !thisEvent || !otherEvent
def getThisAndOtherEventRelativePos(thisEvent, otherEvent)
return [0, 0] if !thisEvent || !otherEvent
return getRelativePos(
thisEvent.map.map_id,thisEvent.x,thisEvent.y,
otherEvent.map.map_id,otherEvent.x,otherEvent.y)
thisEvent.map.map_id, thisEvent.x, thisEvent.y,
otherEvent.map.map_id, otherEvent.x, otherEvent.y)
end
def getThisAndOtherPosRelativePos(thisEvent,otherMapID,otherX,otherY)
return [0,0] if !thisEvent
def getThisAndOtherPosRelativePos(thisEvent, otherMapID, otherX, otherY)
return [0, 0] if !thisEvent
return getRelativePos(
thisEvent.map.map_id,thisEvent.x,thisEvent.y,otherMapID,otherX,otherY)
thisEvent.map.map_id, thisEvent.x, thisEvent.y, otherMapID, otherX, otherY)
end
# Unused
def getOffsetEventPos(event,xOffset,yOffset)
def getOffsetEventPos(event, xOffset, yOffset)
event = $game_player if !event
return nil if !event
return getRealTilePos(event.map.map_id,event.x+xOffset,event.y+yOffset)
return getRealTilePos(event.map.map_id, event.x + xOffset, event.y + yOffset)
end
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
def getFacingTile(direction = nil,event = nil,steps = 1)
event = $game_player if event==nil
return [0,0,0] if !event
def getFacingTile(direction = nil, event = nil, steps = 1)
event = $game_player if event == nil
return [0, 0, 0] if !event
x = event.x
y = event.y
id = event.map.map_id
direction = event.direction if direction==nil
return getFacingTileFromPos(id,x,y,direction,steps)
direction = event.direction if direction == nil
return getFacingTileFromPos(id, x, y, direction, steps)
end
def getFacingTileFromPos(mapID,x,y,direction = 0,steps = 1)
def getFacingTileFromPos(mapID, x, y, direction = 0, steps = 1)
id = mapID
case direction
when 1
@@ -323,9 +323,9 @@ class PokemonMapFactory
x += steps
y -= steps
else
return [id,x,y]
return [id, x, y]
end
return getRealTilePos(mapID,x,y)
return getRealTilePos(mapID, x, y)
end
def getRealTilePos(mapID, x, y)
@@ -354,7 +354,7 @@ class PokemonMapFactory
return nil
end
def getFacingCoords(x,y,direction = 0,steps = 1)
def getFacingCoords(x, y, direction = 0, steps = 1)
case direction
when 1
x -= steps
@@ -377,7 +377,7 @@ class PokemonMapFactory
x += steps
y -= steps
end
return [x,y]
return [x, y]
end
def updateMaps(scene)
@@ -464,9 +464,9 @@ module MapFactoryHelper
if !@@MapDims[id]
begin
map = load_data(sprintf("Data/Map%03d.rxdata", id))
@@MapDims[id] = [map.width,map.height]
@@MapDims[id] = [map.width, map.height]
rescue
@@MapDims[id] = [0,0]
@@MapDims[id] = [0, 0]
end
end
# Return map in cache
@@ -475,11 +475,11 @@ module MapFactoryHelper
# Returns the X or Y coordinate of an edge on the map with id.
# Considers the special strings "N","W","E","S"
def self.getMapEdge(id,edge)
return 0 if edge=="N" || edge=="W"
def self.getMapEdge(id, edge)
return 0 if edge == "N" || edge == "W"
dims = getMapDims(id) # Get dimensions
return dims[0] if edge=="E"
return dims[1] if edge=="S"
return dims[0] if edge == "E"
return dims[1] if edge == "S"
return dims[0] # real dimension (use width)
end
@@ -494,7 +494,7 @@ module MapFactoryHelper
return true
end
def self.mapInRangeById?(id,dispx,dispy)
def self.mapInRangeById?(id, dispx, dispy)
range = 6 # Number of tiles
dims = MapFactoryHelper.getMapDims(id)
return false if dispx >= (dims[0] + range) * Game_Map::REAL_RES_X