快速存读档
# @taroxd metadata 1.0
# @require taroxd_core
# @require keyboard
# @id quick_sl
# @display 快速存读档
# @help 
#
#    使用方法:按下下方设置的按键可以快速存档读档。
#    事件脚本中调用:
#      quick_save 快速存档
#      quick_load 快速读档
#      quick_save_quiet 存档(无音效)

module Taroxd::QuickSL

  module_function

  # 存档位置
  def quick_save_index
    0
  end

  # 是否按下了存档键
  def trigger_save?
    Keyboard.trigger?(Keyboard::S)
  end

  # 是否按下了读档键
  def trigger_load?
    Keyboard.trigger?(Keyboard::L)
  end

  def quick_save_quiet
    DataManager.save_game(quick_save_index)
  end

  def quick_save
    quick_save_quiet ? Sound.play_save : Sound.play_buzzer
  end

  def quick_load
    if DataManager.load_game(quick_save_index)
      Sound.play_load
      SceneManager.scene.fadeout_all
      $game_system.on_after_load
      SceneManager.goto(Scene_Map)
    else
      Sound.play_buzzer
    end
  end

  def update_call_quick_save
    quick_save if !$game_system.save_disabled && trigger_save?
  end

  def update_call_quick_load
    quick_load if trigger_load?
  end

  def update_call_quickSL
    update_call_quick_save
    update_call_quick_load
  end
end

class Scene_Map < Scene_Base
  include Taroxd::QuickSL
  def_after(:update_scene) { update_call_quickSL unless scene_changing? }
end

class Scene_Title < Scene_Base
  include Taroxd::QuickSL
  def_after(:update) { update_call_quick_load unless scene_changing? }
end

class Game_Interpreter
  include Taroxd::QuickSL
end
坐标类
# @taroxd metadata 1.0
# @display 坐标类
# @id point
#
# 该类的作用是表示一个地图上的点的坐标
# 可以伪装成 Game_Character 的对象传给一些接受 character 参数的方法。


module Taroxd
  Point = Struct.new(:x, :y) do

    alias_method :real_x, :x
    alias_method :real_y, :y

    def moveto(x, y)
      self.x = x
      self.y = y
    end

    def pos?(x2, y2)
      x == x2 && y == y2
    end

    def same_pos?(other)
      x == other.x && y == other.y
    end

    def screen_x
      $game_map.adjust_x(x) * 32 + 16
    end

    def screen_y
      $game_map.adjust_y(y) * 32 + 32
    end
  end
end
图片跟随地图移动
# @taroxd metadata 1.0
# @id picture_with_map
# @display 图片跟随地图移动
# @require taroxd_core
# @help 编号大于 50 的图片会跟随地图移动。
Taroxd::PictureWithMap = true

class Game_Picture
  # 图片是否随地图移动
  def move_with_map?
    @number > 50
  end

  def_with :x do |old|
    move_with_map? ? $game_map.adjust_x(old / 32.0) * 32 : old
  end

  def_with :y do |old|
    move_with_map? ? $game_map.adjust_y(old / 32.0) * 32 : old
  end
end