| module Kal | |
| module TurnMove | |
| # Enable or disable turn movement. | |
| ENABLE = true | |
| # If you want to use a switch to enable turn movement. | |
| SWITCH = nil | |
| # Only events that have the following comment string as a comment | |
| # on their first page are affected. Set to nil or false if you don't | |
| # want to use this option. | |
| COMMENT = "turn-move" | |
| end | |
| end | |
| class Game_Event | |
| alias_method :update_self_movement_turnmove_kal, :update_self_movement | |
| def update_self_movement | |
| return if is_turnmove_kal? && !$game_player.moving? | |
| update_self_movement_turnmove_kal | |
| end | |
| def is_turnmove_kal? | |
| return false unless Kal::TurnMove::ENABLE | |
| switch = Kal::TurnMove::SWITCH | |
| return false if switch && !$game_switches[switch] | |
| comment = Kal::TurnMove::COMMENT | |
| return false if comment && !has_comment_turnmove_kal? | |
| true | |
| end | |
| def has_comment_turnmove_kal? | |
| comments = @event.pages.first.list.select do |command| | |
| command.code == 108 || command.code == 408 | |
| end | |
| comments.any? { |c| c.parameters.first.include?(Kal::TurnMove::COMMENT) } | |
| end | |
| end |